Learn R Programming

rstiefel (version 1.0.1)

optStiefel: Optimize a function on the Stiefel manifold

Description

Find a local minimum of a function defined on the stiefel manifold using algorithms described in Wen and Yin (2013).

Usage

optStiefel(F, dF, Vinit, method = "bb", searchParams = NULL, tol = 1e-08,
  maxIters = 100, verbose = FALSE, maxLineSearchIters = 20)

Arguments

F

A function V(P, S) -> R^1

dF

A function to compute the gradient of F. Returns a P x S matrix with dF(X)_ij = d(F(X))/dX_ij

Vinit

The starting point on the stiefel manifold for the optimization

method

Line search type: "bb" or curvilinear

searchParams

List of parameters for the line search algorithm. If the line search algorithm is the standard curvilinear search than the search parameters are rho1 and rho2. If the line search algorithm is "bb" then the parameters are rho and eta.

tol

Convergence tolerance. Optimization stops when Fprime < abs(tol), an approximate stationary point.

maxIters

Maximum iterations for each gradient step

verbose

Boolean indicating whether to print function value and iteration number at each step.

maxLineSearchIters

Maximum iterations for for each line search (one step in the gradient descent algorithm)

Value

A stationary point of F on the Stiefel manifold.

References

(Wen and Yin, 2013)

Examples

Run this code
# NOT RUN {
## Find the first eigenspace spanned by the first P eigenvectors for a 
## matrix M. The size of the matrix has been kept small and the tolerance 
## has been raised to keep the runtime 
## of this example below the CRAN submission threshold. 

N <- 500
P <- 3
Lam <- diag(c(10, 5, 3, rep(1, N-P)))
U <- rustiefel(N, N)
M <- U %*% Lam %*% t(U)

F <- function(V) { - sum(diag(t(V) %*% M %*% V)) }
dF <- function(V) { - 2*M %*% V }
V = optStiefel(F, dF, Vinit=rustiefel(N, P),
               method="curvilinear",
               searchParams=list(rho1=0.1, rho2=0.9, tau=1),tol=1e-4)
               
print(sprintf("Sum of first %d eigenvalues is %f", P, -F(V)))

# }

Run the code above in your browser using DataLab