Skip to content

Commit

Permalink
minor style tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
alexpghayes committed Mar 20, 2018
1 parent 8ef1bf9 commit c6a4930
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion R/sfpca.R
Expand Up @@ -111,7 +111,7 @@ sfpca_r <- function(X, lambda_u = 0, lambda_v = 0, alpha_u = 0, alpha_v = 0,
delta_u <- norm(u - tmp_u) / norm(tmp_u)
}

# same as u case except place with v, and add a single transposition
# same as u case except add a single transposition
while (delta_v > tol) {
tmp_v <- v
v <- prox_l1(v + (t(X) %*% u - S_v %*% v) / L_v, lambda_v / L_v)
Expand Down
7 changes: 6 additions & 1 deletion README.Rmd
Expand Up @@ -24,6 +24,11 @@ So far I have:
- Implemented the L1 penalized rank 1 SFPCA algorithm in C++ using Armadillo
- Wrapped the C++ implementation with `Rcpp`
- Tested both implementations with `testthat`
- Passed `R CMD check` with no warnings or errors
- Passed `R CMD check` with no warnings or errors on Linux & Windows

**This application is in progress and is not yet complete**

TODO:

- How to get rid of the R CMD check NOTE on registering native routines
- C++ cleanup as per comments in `sfpca.cpp`
7 changes: 6 additions & 1 deletion README.md
Expand Up @@ -11,6 +11,11 @@ So far I have:
- Implemented the L1 penalized rank 1 SFPCA algorithm in C++ using Armadillo
- Wrapped the C++ implementation with `Rcpp`
- Tested both implementations with `testthat`
- Passed `R CMD check` with no warnings or errors
- Passed `R CMD check` with no warnings or errors on Linux & Windows

**This application is in progress and is not yet complete**

TODO:

- How to get rid of the R CMD check NOTE on registering native routines
- C++ cleanup as per comments in `sfpca.cpp`
12 changes: 6 additions & 6 deletions tests/testthat/test-sfpca.R
Expand Up @@ -7,12 +7,12 @@ expect_agrees_with_matlab <- function(testfile) {
test <- R.matlab::readMat(testfile)

res_r <- sfpca_r(X = test$x,
lambda_u = as.numeric(test$lamu),
lambda_v = as.numeric(test$lamv),
alpha_u = as.numeric(test$alphau),
alpha_v = as.numeric(test$alphav),
Omega_u = test$Omegu,
Omega_v = test$Omegv)
lambda_u = as.numeric(test$lamu),
lambda_v = as.numeric(test$lamv),
alpha_u = as.numeric(test$alphau),
alpha_v = as.numeric(test$alphav),
Omega_u = test$Omegu,
Omega_v = test$Omegv)

res_cpp <- sfpca(X = test$x,
lambda_u = as.numeric(test$lamu),
Expand Down

0 comments on commit c6a4930

Please sign in to comment.