Skip to content

Commit

Permalink
Removed n_cores option for updateTheta since it is not used anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
Louis Dijkstra committed Nov 28, 2022
1 parent a1bfc70 commit 63ec7d8
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 67 deletions.
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export(set_attributes_to_edges_visnetwork)
export(strip_cvn)
export(updateTheta)
export(updateY)
export(updateZ)
export(updateZ_wrapper)
export(visnetwork)
export(visnetwork_cvn)
Expand Down
19 changes: 1 addition & 18 deletions R/update-Theta.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@
#' @param Sigma A list with empirical covariance matrices \eqn{{\Sigma}}
#' @param n_obs A \eqn{m}-dimensional vector with the number of observations per graph
#' @param rho The \eqn{\rho} ADMM's penalty parameter (Default: 1)
#' @param n_cores Number of cores used (Default: 1)
#'
#' @return A list with matrices with the new values of \eqn{\Theta}
#'
#' @export
updateTheta <- function(m, Z, Y, Sigma, n_obs, rho = 1, n_cores = 1) {
updateTheta <- function(m, Z, Y, Sigma, n_obs, rho = 1) {

# we use the fact that we can separate the optimization problem for each
# individual graph i = 1, 2,..., m
Expand All @@ -32,20 +31,4 @@ updateTheta <- function(m, Z, Y, Sigma, n_obs, rho = 1, n_cores = 1) {
# The new Theta matrix
Q %*% diag(Lambda) %*% t(Q)
})

# mclapply(1:m, function(i) {
#
# # perform an eigendecomposition
# eigen_decomposition <- eigen(Sigma[[i]] - rho * Z[[i]]/ n_obs[i] + rho * Y[[i]] / n_obs[i])
#
# # obtain matrices Q and Lambda (Lambda is a diagonal matrix, so first only the diagonal is stored)
# Q <- eigen_decomposition$vectors
# Lambda <- eigen_decomposition$values
#
# # Lambda is updated
# Lambda <- n_obs[i]/(2 * rho) * (-Lambda + sqrt(Lambda^2 + 4*rho/n_obs[i]))
#
# # The new Theta matrix
# Q %*% diag(Lambda) %*% t(Q)}, mc.cores = n_cores # number of cores used
# )
}
4 changes: 1 addition & 3 deletions man/updateTheta.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 0 additions & 44 deletions man/updateZ.Rd

This file was deleted.

2 changes: 1 addition & 1 deletion sandbox/profile-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ W <- CVNSim::create_weight_matrix("full", m = m)
library(tictoc)
tic()

cvn_new <- CVN(data, W, n_cores = 4, maxiter = 1000, lambda1 = lambda1, lambda2 = lambda2, verbose = F)
cvn_new <- CVN(data, W, n_cores = 1, maxiter = 1000, lambda1 = lambda1, lambda2 = lambda2, verbose = F)
toc()


Expand Down

0 comments on commit 63ec7d8

Please sign in to comment.