Description Usage Arguments Details Value References Examples
View source: R/OptStiefelGBB.R
Gradient based optimization on the Stiefel manifold
1 | OptStiefelGBB(fun, X, size, opts, ...)
|
fun |
function to be minimized. It must take |
X |
the initial orthonormal matrix |
size |
if initial value for |
opts |
a list of options for the optimization |
... |
additional argmuents to pass to |
This R package ports the MATLAB code from the authors' website http://optman.blogs.rice.edu/
list with X
, which is the solution found, and out
,
which includes supplementary material
Zaiwen Wen and Wotao Yin. A Feasible method for Optimization with Orthogonality Constraints, Optimization Online, 11/2010. Also as Rice CAAM Tech Report TR10-26.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # find the first eigenvector
fun <- function(X, A) {
G = -(A %*% X)
f = 0.5 * sum(t(G) %*% X)
list(f = f, G = G)
}
n = 1000; k = 1
A = matrix(rnorm(n^2), n, n)
A = t(A) %*% A
res = OptStiefelGBB(fun, size = c(n, k), A = A)
# objective function should be close to the sum of the first eigenvalue
eig = eigen(A)
sum(eig$values[1:k])
-2 * res$out$fval
plot(res$X[, 1], eig$vectors[, 1])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.