Skip to content

Commit

Permalink
Merge pull request #41 from ocbe-uio/avoid-solve
Browse files Browse the repository at this point in the history
Reduced calls to `solve()`
  • Loading branch information
Theo-qua authored Mar 26, 2024
2 parents d1136bd + 8130c12 commit dca38ae
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: MADMMplasso
Title: Multi Variate Multi Response 'ADMM' with Interaction Effects
Version: 0.0.0.9016
Version: 0.0.0.9017
Authors@R:
c(
person(
Expand Down
5 changes: 3 additions & 2 deletions R/admm_MADMMplasso.R
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ admm_MADMMplasso <- function(beta0, theta0, beta, beta_hat, theta, rho1, X, Z, m

SVD_D <- Diagonal(x = svd.w$d)
R_svd <- (svd.w$u %*% SVD_D) / N
R_svd_inv <- solve(R_svd)

rho <- rho1
Big_beta11 <- V
Expand Down Expand Up @@ -155,8 +156,8 @@ admm_MADMMplasso <- function(beta0, theta0, beta, beta_hat, theta, rho1, X, Z, m
part_z <- DD3 %*% t(W_hat)
part_y <- DD3 %*% my_beta_jj

beta_hat_j <- solve(solve(R_svd) + (svd.w$tv) %*% part_z)
beta_hat_j <- beta_hat_j %*% ((svd.w$tv) %*% part_y)
beta_hat_j <- solve(R_svd_inv + svd.w$tv %*% part_z)
beta_hat_j <- beta_hat_j %*% (svd.w$tv %*% part_y)
beta_hat_j <- part_z %*% beta_hat_j
beta_hat_JJ <- part_y - beta_hat_j
beta_hat_JJ <- matrix(beta_hat_JJ, ncol = 1)
Expand Down

0 comments on commit dca38ae

Please sign in to comment.