src/calc_sum_squares_latent.cpp
changed.
Other files ignored by Codecov
src/RcppExports.cpp
has changed.
10 | 10 | // [[Rcpp::export]] |
|
11 | 11 | NumericVector calc_sum_squares_latent( |
|
12 | 12 | arma::sp_mat Y, |
|
13 | - | NumericMatrix X, |
|
14 | - | NumericMatrix W, |
|
15 | - | NumericVector ybar, |
|
13 | + | arma::mat X, |
|
14 | + | arma::mat W, |
|
15 | + | arma::vec ybar, |
|
16 | 16 | int threads |
|
17 | 17 | ) { |
|
18 | 18 |
22 | 22 | double SST = 0; // total sum of squares across all documents |
|
23 | 23 | ||
24 | 24 | ||
25 | + | // convert R equivalent classes to arma classes |
|
26 | + | ||
27 | + | ||
25 | 28 | // for each observations... |
|
26 | 29 | RcppThread::parallelFor( |
|
27 | 30 | 0, |
39 | 42 | double sse = 0; |
|
40 | 43 | double sst = 0; |
|
41 | 44 | ||
42 | - | for(int v = 0; v < W.ncol(); v++ ){ |
|
45 | + | for(int v = 0; v < W.n_cols; v++ ){ |
|
43 | 46 | double Yhat = 0; |
|
44 | 47 | ||
45 | - | for(int k = 0; k < X.ncol(); k++ ){ |
|
48 | + | for(int k = 0; k < X.n_cols; k++ ){ |
|
46 | 49 | Yhat = Yhat + X(d , k ) * W(k , v ); |
|
47 | 50 | } |
|
48 | 51 |
Files | Coverage |
---|---|
R/calc_rsquared.R | 97.87% |
src/calc_sum_squares_latent.cpp | 100.00% |
Project Totals (2 files) | 98.28% |