Skip to content

Commit 1ab63c8

Browse files
removing ppp back to Rfast
1 parent 3ecef4d commit 1ab63c8

11 files changed

Lines changed: 16 additions & 171 deletions

File tree

DESCRIPTION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Imports:
2525
smashr,
2626
Rcpp,
2727
ebnm,
28+
Rfast,
2829
Suggests:
2930
susieR,
3031
knitr,

NAMESPACE

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Generated by roxygen2: do not edit by hand
2-
useDynLib(fsusieR, .registration = TRUE)
3-
importFrom(Rcpp, sourceCpp)
2+
43
S3method(Eloglik,susiF)
54
S3method(HMM_regression,susiF)
65
S3method(L_mixsq,mixture_normal)

R/RcppExports.R

Lines changed: 0 additions & 15 deletions
This file was deleted.

R/computational_functions.R

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ cal_cor_cs <- function(obj,X){
6363
# \item{Shat}{ matrix pxJ standard error, Shat[j,t] corresponds to standard error of the regression coefficient of Y[,t] on X[,j] }
6464
#
6565
# @export
66-
#
66+
#' @importFrom Rfast colsums
67+
#' @importFrom Rfast colVars
68+
#' @importFrom Rfast cova
6769
cal_Bhat_Shat <- function(Y,
6870
X ,
6971
v1 ,
@@ -77,12 +79,12 @@ cal_Bhat_Shat <- function(Y,
7779
if(missing(ind_analysis)){
7880

7981

80-
d <- colSumsCpp(X^2)
82+
d <- colSums(X^2)
8183
Bhat <- (t(X)%*%Y )/d
8284

8385
Shat <- do.call( cbind,
8486
lapply( 1:ncol(Bhat),
85-
function(i) ( colVarsCpp( Y [,i] -sweep( X,2, Bhat[,i], "*")))
87+
function(i) (Rfast::colVars( Y [,i] -sweep( X,2, Bhat[,i], "*")))
8688
)
8789
)
8890

@@ -95,7 +97,7 @@ cal_Bhat_Shat <- function(Y,
9597

9698
Bhat <- do.call(cbind,lapply(1:length(ind_analysis),
9799
function(l){
98-
d <- colSumsCpp(X[ind_analysis[[l]], ]^2)
100+
d <- Rfast::colsums(X[ind_analysis[[l]], ]^2)
99101
out <- (t(X[ind_analysis[[l]], ])%*%Y[ind_analysis[[l]], l])/d
100102
return(out)
101103
}
@@ -105,7 +107,7 @@ cal_Bhat_Shat <- function(Y,
105107

106108

107109
Shat <- matrix(mapply(function(l,j)
108-
( covCpp(matrix(Y[ind_analysis[[l]],l] - X[ind_analysis[[l]], j] * Bhat[j,l])) /(length(ind_analysis[[l]])-1)),
110+
(Rfast::cova(matrix(Y[ind_analysis[[l]],l] - X[ind_analysis[[l]], j] * Bhat[j,l])) /(length(ind_analysis[[l]])-1)),
109111
l=rep(1:dim(Y)[2],each= ncol(X)),
110112
j=rep(1:dim(X)[2], ncol(Y))
111113
),
@@ -114,12 +116,12 @@ cal_Bhat_Shat <- function(Y,
114116
Shat<- sqrt( pmax(Shat, 1e-64))
115117

116118
}else{
117-
d <- colSumsCpp(X[ind_analysis , ]^2)
119+
d <- Rfast::colsums(X[ind_analysis , ]^2)
118120
Bhat <- (t(X[ind_analysis , ])%*%Y[ind_analysis , ])/d
119121

120122
Shat <- do.call( cbind,
121123
lapply( 1:ncol(Bhat),
122-
function(i) ( colVarsCpp(Y [ind_analysis,i] -sweep( X[ind_analysis,],2, Bhat[ ,i], "*")))
124+
function(i) (Rfast::colVars(Y [ind_analysis,i] -sweep( X[ind_analysis,],2, Bhat[ ,i], "*")))
123125
)
124126
)
125127
Shat<- sqrt( pmax(Shat, 1e-64))
@@ -143,6 +145,7 @@ cal_Bhat_Shat <- function(Y,
143145
}
144146

145147

148+
146149
#' @title Compute likelihood for the weighted ash problem
147150
#
148151
#' @description Add description here.

R/utils.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ is.wholenumber <- function (x, tol = .Machine$double.eps^0.5)
2626
'%!in%' <- function(x,y)!('%in%'(x,y))
2727

2828
# Based on Rfast implementation.
29-
#
29+
#' @importFrom Rfast cova
3030
fast_lm <- function(x,y)
3131
{
3232

33-
be <- solve(crossprod(x),crossprod(x,y))
34-
sd <- sqrt(covCpp(y - x %*% be) /(length(x)-1))
33+
be <- solve(crossprod(x),crossprod(x,y))
34+
sd <- sqrt(Rfast::cova(y - x %*% be) /(length(x)-1))
3535

3636

37-
return(c(be,sd))
37+
return(c(be,sd))
3838
}
3939

4040

src/RcppExports.cpp

Lines changed: 0 additions & 57 deletions
This file was deleted.

src/RcppExports.o

-91.1 KB
Binary file not shown.

src/colobs.cpp

Lines changed: 0 additions & 55 deletions
This file was deleted.

src/colobs.o

-60.4 KB
Binary file not shown.

src/fsusieR.dll

-959 KB
Binary file not shown.

0 commit comments

Comments
 (0)