pystop.solver.slpg_smooth
X, output_dict = slpg_smooth( obj_fun, manifold, Xinit = None, maxit= 100, gtol = 1e-5, post_process = True, verbosity = 2, **kwargs)
Minimize a smooth objective function fun over the Stiefel manifold starting from Xinit
by the penalty-free infeasible first-order method (SLPG). The word ''penalty-free'' means SLPG does not need the penalty parameter
Input arguments
obj_fun : callable
The function that is to be minimized.
fval, grad = obj_fun(X)
It should have two returns: fval
denotes the function value at grad
is a matrix in
manifold : STOP manifold class The specified Stiefel manifold
21from pystop.manifold import Stiefel
2manifold = Stiefel(1000,10)
Xinit : ndarray, shape (n, p)
Initial guess. Array of real elements of size Xinit
is not specified, the SLPG_smooth
solver uses the manifold.Init_point()
instead.
maxit : int Maximum number of iterations to perform.
gtol : float
SLPG_smooth
terminates when post_process : bool
Post-processing for infeasible methods to achieve a feasible solution by orthonormalization. It is implemented by the manifold.Post_process()
provided by STOP manifold class.
verbosity : int Level of information logged by the solver while it operates, 0 is silent, 2 is most information.
Output results
X : ndarray, shape (n, p)
The final results returned by the SLPG_smooth
solver
output_dict : dict
A dictionary of information. One can see which attributes are available using the keys()
method.
iter
fval
kkt
fea
fvals
kkts
feas
In these examples, we solve the following nonlinear eigenvalue problem
where
The following examples introduces how to apply PenCF to solve this problem.
x1# Importing packages
2import numpy as np
3import scipy as sp
4import matplotlib.pyplot as plt
5from scipy.sparse import diags
6from scipy.sparse.linalg import spsolve
7
8# Adding essential materials
9from pystop.manifold import Stiefel
10from pystop.solver import SLPG_smooth
11
12# Set parameters
13n = 1000
14p = 20
15alpha = 1
16M = Stiefel(n,p)
17
18# Defining objective function
19L = diags(np.array([-1, 2, -1]), np.array([1, 0, -1]), shape = (n,n)).tocsc()
20def obj_fun(X):
21 LX = L@X
22 rho = np.sum(X * X, 1)
23 Lrho = spsolve(L, rho)
24 fval = 0.5*np.sum(X* LX) + (alpha /4) * np.sum(rho * Lrho)
25 grad = LX + alpha * Lrho[: ,np.newaxis] * X
26 return fval, grad
27
28# Execute the solver
29X_init = M.Init_point() # Set initial point
30X, out_dict = SLPG_smooth(obj_fun, M, Xinit= X_init, maxit= 1000, gtol=1e-8)
31
32plt.semilogy(out_dict['kkts'])
33plt.semilogy(out_dict['feas'])