optimize_indicator_matrix: Optimize Binary Indicator Matrix with Row Uniformity

View source: R/multiscaleSVDxpts.R

optimize_indicator_matrixR Documentation

Optimize Binary Indicator Matrix with Row Uniformity

Description

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.

Usage

optimize_indicator_matrix(
  m,
  max_iter = 1000,
  tol = 0.000001,
  preprocess = TRUE,
  verbose = FALSE
)

Arguments

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.

Value

'm * I'

Examples

set.seed(123)
m <- matrix(rnorm(500), nrow = 5)
result <- optimize_indicator_matrix(m, max_iter = 1000, tol = 1e-6, verbose = TRUE)
print(result)

stnava/ANTsR documentation built on April 13, 2025, 4:10 a.m.