wavefunction_analysis.opt package

Submodules

wavefunction_analysis.opt.grassmann module

class Grassmann(mf=None, S=None, Q=None, Y=None, P=None, update_method='steepest_descent')[source]

Bases: object

barzilai_borwein_step(G0, G1, T0)[source]
init_guess()[source]
kernel(C=None, tol=8)[source]
polak_ribiere_step(G0, G1, T0)[source]
class Involution_Grassmann(mf=None, S=None, Q=None, Y=None, P=None, update_method='steepest_descent')[source]

Bases: Grassmann

init_guess()[source]
project_tangent_space(V, G)[source]
update(C, T)[source]
class Projection_Grassmann(mf=None, S=None, Q=None, Y=None, P=None, update_method='steepest_descent')[source]

Bases: Grassmann

init_guess()[source]
project_tangent_space(P, G)[source]
class Quotient_Grassmann(mf=None, S=None, Q=None, Y=None, P=None, update_method='steepest_descent')[source]

Bases: Grassmann

conjugate_gradient_step(Y, G0, G1, T0)[source]
init_guess()[source]
project_tangent_space(Y, G)[source]
tangent_parallel_transport(Y, G, T)[source]
update(Y, T)[source]
cs_decompose(T, full=True, scale=1.0)[source]
geodesic_exp(T, full=True, scale=1.0)[source]
geodesic_svd(B, scale=1.0)[source]
geodesic_svd_compact(Y, T)[source]

wavefunction_analysis.opt.optimization module

cg_fletcher_reeves(transport, preconditioner, x1, g0, g1)[source]
cg_polak_ribiere(transport, preconditioner, x1, g0, g1)[source]
choose_direction(method='fletcher_reeves')[source]
conjugate_gradient(func, gradf, retraction, transport, preconditioner, x0, ls_method='armijo', cg_method='fletcher_reeves', nmax=50, thresh=1e-08, *args, **kwargs)[source]
gradient_descent(func, gradf, retraction, x0, ls_method='armijo', nmax=50, thresh=1e-08, *args, **kwargs)[source]

method options: float, newton, backtracking, armijo, steepest

ls_armijo(func, gradf, retraction, x0, tau=0.5, r=0.0001, alpha=1.0)

alpha is the step size we need to determine reduce it from a large value

ls_backtracking(func, gradf, retraction, x0, tau=0.5, r=0.0001, alpha=1.0)[source]

alpha is the step size we need to determine reduce it from a large value

ls_newton_raphson(func, gradf, retraction, x0, **kwargs)[source]
ls_steepest(step=1.0)[source]
newton_2nd(func, gradf, hessf, tangent_solver, geodesic, x0, dt=1.0, nmax=50, thresh=1e-08, *args, **kwargs)[source]
trust_region(func, gradf, hessf, tangent_solver, geodesic, x0, dt=1.0, nmax=50, thresh=1e-08, *args, **kwargs)[source]

wavefunction_analysis.opt.riemannian module

Grassmann(**kwargs)[source]
class Grassmann_Quotient(ndim=None, x0=None, A=None, B=None, retraction='qr', **kwargs)[source]

Bases: Stiefel

Grassmann is a quotient space from Stiefel with extra idempotency condition for density matrix P = p p^dagger this class uses point p rather than P `Gr(k,n) = St(k,n) / O(k)

= {p in F^{n*k} | p^dagger B p = I_k, PBP = P}

T_p Gr(k,n) = {V in F^{n*n} | p^dagger V = 0}`

check_sanity()[source]
check_tangent(x, v)[source]

verify the obtained vector v is truly a tangent

property dimension
property dist

calculate the distance between two tangent vectors at one point

exp(x, v, dt=1.0)[source]

exp_p (V) = p V cos(s) V^dagger + U sin(s) V^dagger qr is needed for numerically stablity

get_tangent(x, v)[source]
horizontal_lift(x, v, lift=True)[source]

Delta = (0 & - B^T \ B & 0) Delta_p^horizontal = Delta * p = p_perp * B in Stiefel representation

inverse_retraction_polar(x1, x2, dt=1.0)[source]
log(x1, x2, dt=1.0)[source]

adopted from alg. 1 from 10.1007/s10444-023-10090-8 recovers Stiefel from exp operation and avoids matrix inverse

newton_2nd(gradf, hessf, x0, dt=1.0, nmax=50, thresh=1e-08)[source]
projection(x, v)[source]

the resulted tangent vector is perpendicular to BX <Delta, BX> = 0

retraction_polar(x, v, dt=1.0)[source]

Retr_p V = U V^dagger where UsV^dagger = svd(p+V)

retraction_qr(x, v, dt=1.0)[source]

Retr_p V = QD where QR = qr(p+V) and D=diag(sgn(diag(R)+.5))

tangent_solver(x, grad, hess, method='direct')[source]
transport(x0, vg, v0, dt=1.0)[source]

parallel transport v0 at x0 along geodesic defined by vg to tangent space of x1 refer to 10.1137/S0895479895290954

weingarten(x, v, grad, normal)[source]

connection between tangent vectors

class OrthogonalGroup(ndim=None, x0=None, A=None, B=None, retraction='qr', **kwargs)[source]

Bases: Riemannian

the points are n*n square matrix, n-dimensions and n-planes

check_sanity()[source]
property eigenvalue
exp(x, v, dt=1.0)[source]

geodesic mapping tangent vector v of x to other points on manifold exp_p: T_p M -> M

func(x)[source]

assume x is normalized

func_grad(x)[source]

assume x is normalized

log(x1, x2, dt=1.0)[source]

geodesic mapping points on manifold to the tangent space of the first point log_p: M -> T_p M

projection(x, v)[source]

project a general matrix v to the tangent space of a point x on the manifold

retraction_cayley(x, v, dt=1.0)[source]
retraction_norm(x, v, dt=1.0)[source]

put (x+v) on the sphere

retraction_polar(x, v, dt=1.0)[source]
retraction_qr(x, v, dt=1.0)[source]
class Riemannian(ndim=None, x0=None, A=None, B=None, retraction='qr', **kwargs)[source]

Bases: object

check_tangent(x, v)[source]

verify the obtained vector v is truly a tangent

conjugate_gradient(method=None, cg_method='fletcher_reeves', nmax=50, thresh=1e-08, *args, **kwargs)[source]
property dimension
property dist

calculate the distance between two tangent vectors at one point

exp(x, v, dt=1.0)[source]

geodesic mapping tangent vector v of x to other points on manifold exp_p: T_p M -> M

geodesic(x, v, dt=1.0)

geodesic mapping tangent vector v of x to other points on manifold exp_p: T_p M -> M

gradient_descent(method=None, nmax=50, thresh=1e-08, *args, **kwargs)[source]
inverse_retraction()[source]

approximation to logrithrim geodesic mapping project points to get the connecting tangent vector at first point

log(x1, x2, dt=1.0)[source]

geodesic mapping points on manifold to the tangent space of the first point log_p: M -> T_p M

property norm

calculate the length of a tangent vector v of point x use euclidean norm by default

projection(x, v)[source]

project a general matrix v to the tangent space of a point x on the manifold

retraction(x, v)[source]

approximation to exponential geodesic mapping project new vector x+v from point x to the manifold

riemannian_gradient(x, grad)[source]

project euclidean gradient to riemannian gradient of a function

riemannian_hessian(x, v, grad, hess, normal=None)[source]

project euclidean hessian to riemannian hessian of a function

to_tangent_space(x, v)

project a general matrix v to the tangent space of a point x on the manifold

transport(x0, x1, v0)[source]

parallel or vector transport moves tangent vector v0 at point x0 to point x1 T_{x0->x1} (v0): v0 in T_{x0} M -> v1 in T_{x1} M = Proj_M (x1, v0) here x0 is a dummy variable project v0 to the tangent space of x1

weingarten(x, v, *args, **kwargs)[source]

connection between tangent vectors

class Stiefel(ndim=None, x0=None, A=None, B=None, retraction='qr', **kwargs)[source]

Bases: OrthogonalGroup

St(k,n) = {p in F^{n*k} | p^dagger B p = I_k} the point p is a n*k matrix, n-dimensions and k-planes quotient space from OrthogonalGroup where k<n whose tangent vector V is on the tangent space of point p T_p St(k,n) = {V in F^{n*k} | p^dagger B V + V^dagger B p = 0_k}

check_sanity()[source]
check_tangent(x, v)[source]

verify the obtained vector v is truly a tangent

property dimension
property dist

calculate the distance between two tangent vectors at one point

exp(x, v, dt=1.0)[source]

exp_p V = (p \ V) exp((p^dagger V & - V^dagger V \ I_n & p^dagger V)) (exp(-p^dagger V) \ 0_n)

inverse_retraction_polar(x1, x2, dt=1.0)[source]
inverse_retraction_qr(x1, x2, dt=1.0)[source]
log(x1, x2, dt=1.0)[source]

geodesic mapping points on manifold to the tangent space of the first point log_p: M -> T_p M

projection(x, v)[source]

Proj(p,V) = V - p Sym(p^dagger B V)

retraction_polar(x, v, dt=1.0)[source]

Retr_p V = U V^dagger where UsV^dagger = svd(p+V)

retraction_qr(x, v, dt=1.0)[source]

Retr_p V = QD where QR = qr(p+V) and D=diag(sgn(diag(R)+.5))

weingarten(x, v, grad, normal)[source]

connection between tangent vectors

get_random_matrix(ndim, seed=None, sym=True)[source]
solve_sylvester(A, C, B=None, solver='iter')[source]

solve X from AX + XB = C aka. Lyapunov, Stein equation return X

Module contents