View source: R/multiscaleSVDxpts.R
optimize_indicator_matrix | R Documentation |
This function optimizes the sum of the matrix 'm * I', where 'I' is a binary indicator matrix with the constraint that each column may have only one non-zero entry. It ensures that the distribution of 1's is uniform across rows, softens the constraint to avoid infinite loops, and includes an optional verbose output to report the progress of the optimization.
optimize_indicator_matrix(
m,
max_iter = 1000,
tol = 0.000001,
preprocess = TRUE,
verbose = FALSE
)
m |
A numeric matrix to optimize. |
max_iter |
The maximum number of iterations to avoid infinite loops. Default is 1000. |
tol |
A numeric value representing the tolerance for convergence. If the change in the objective function is less than this value, the loop stops. Default is 1e-6. |
preprocess |
Logical. If TRUE, flips the sign of each row where the entries are predominantly negative. |
verbose |
Logical. If TRUE, reports the objective value and convergence progress at each iteration. |
'm * I'
set.seed(123)
m <- matrix(rnorm(500), nrow = 5)
result <- optimize_indicator_matrix(m, max_iter = 1000, tol = 1e-6, verbose = TRUE)
print(result)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.