ortho_optim {orthoDr} | R Documentation |
Orthogonality constrained optimization
Description
A general purpose optimization solver with orthogonality constraint.
The orthogonality constrained optimization method is a nearly direct
translation from Wen and Yin (2010)'s MATLAB
code.
Usage
ortho_optim(
B,
fn,
grad = NULL,
...,
maximize = FALSE,
control = list(),
maxitr = 500,
verbose = FALSE
)
Arguments
B |
Initial |
fn |
A function that calculate the objective function value.
The first argument should be |
grad |
A function that calculate the gradient. The first argument
should be |
... |
Arguments passed to |
maximize |
By default, the solver will try to minimize the objective
function unless |
control |
A list of tuning variables for optimization. |
maxitr |
Maximum number of iterations |
verbose |
Should information be displayed |
Value
A orthoDr
object that consists of a list
with named entries of:
B |
The optimal |
fn |
The final functional value |
itr |
The number of iterations |
converge |
convergence code |
References
Wen, Z., & Yin, W. (2013). A feasible method for optimization with orthogonality constraints. Mathematical Programming, 142(1), 397-434. DOI: doi:10.1007/s10107-012-0584-1
Examples
# an eigen value problem
library(pracma)
set.seed(1)
n <- 100
k <- 6
A <- matrix(rnorm(n * n), n, n)
A <- t(A) %*% A
B <- gramSchmidt(matrix(rnorm(n * k), n, k))$Q
fx <- function(B, A) -0.5 * sum(diag(t(B) %*% A %*% B))
gx <- function(B, A) -A %*% B
fit <- ortho_optim(B, fx, gx, A = A)
fx(fit$B, A)
# compare with the solution from the eigen function
sol <- eigen(A)$vectors[, 1:k]
fx(sol, A)