Algorithms¶
This section contains the API documentation for the algorithms module.
Finite MPS algorithms¶
- class Dmrg(kwargs)¶
Density Matrix Renormalisation Group algorithm for marix product states.
- Properties
tol (
double) – tolerance for convergence criterion, defaults to1e-10.miniter (
int) – minimum number of iteration, defaults to 5.maxiter (
int) – maximum number of iteration, defaults to 100.verbosity (
Verbosity) – verbosity level of the algorithm, defaults toVerbosity.iter.doplot (
logical) – plot progress, defaults tofalse.which (
char) – eigenvalue selector (passed as thesigmaargument toeigsolve()), defaults to'largestabs'.dynamical_tols (
logical) – indicate whether or not to use a dynamical tolerance scaling for the algorithm’s subroutines based on the current error measure, defaults tofalsetol_min (
double) – smallest allowed convergence tolerance for soubroutines, defaults to1e-12.tol_max (
double) – highest allowed convergence tolerance for soubroutines, defaults to1e-10.eigs_tolfactor (
double) – relative scaling factor for determining the convergence tolerance of the eigensolver subroutine based on the current error measure, defaults to1e-6sweepstyle (
char) – sweep style indicating how to sweep through the MPS at each iteration, options are:'f2f': (default) front-to-front, sweeping from site 1 to the end and back.'b2b': back-to-back, sweeping from site N to the start and back.'m2m': mid-to-mid, sweeping from the middle site to both ends and back.
alg_eigs (
KrylovSchurorArnoldi) – algorithm used for the local eigsolver updates, defaults toKrylovSchur('MaxIter', 100, 'KrylovDim', 20).
- fixedpoint(alg, mpo, mps, envs)¶
Find the fixed point MPS of a finite MPO, given an initial guess.
Usage
[mps, envs, eta] = fixedpoint(alg, mpo, mps, envs)- Arguments
alg (
Dmrg) – DMRG algorithm.mpo (
FiniteMpo) – matrix product operator.mps (
FiniteMps) – initial guess for MPS fixed point.envs (
FiniteEnvironment) – initial guess for the environments.
- Returns
mps (
FiniteMps) – MPS fixed point.envs (
FiniteEnvironment) – corresponding environments.eta (
double) – final error measure at convergence.
Infinite MPS algorithms¶
- class Vumps(kwargs)¶
Bases:
handleVariational fixed point algorithm for uniform matrix product states.
- Properties
tol (
double) – tolerance for convergence criterion, defaults to1e-10.miniter (
int) – minimum number of iteration, defaults to5.maxiter (
int) – maximum number of iteration, defaults to code:100.verbosity (
Verbosity) – verbosity level of the algorithm, defaults toVerbosity.iter.doplot (
logical) – plot progress, defaults tofalse.which (
char) – eigenvalue selector (passed as thesigmaargument toeigsolve()), defaults to'largestabs'.dynamical_tols (
logical) – indicate whether or not to use a dynamical tolerance scaling for the algorithm’s subroutines based on the current error measure, defaults totrue.tol_min (
double) – smallest allowed convergence tolerance for soubroutines, defaults to1e-12.tol_max (
double) – highest allowed convergence tolerance for soubroutines, defaults to1e-10.eigs_tolfactor (
double) – relative scaling factor for determining the convergence tolerance of the local update solver subroutine based on the current error measure, defaults to1e-6.canonical_tolfactor (
double) – relative scaling factor for determining the convergence tolerance of the canonicalization subroutine based on the current error measure, defaults to1e-8.environments_tolfactor (
double) – relative scaling factor for determining the convergence tolerance of the environment solver subroutine based on the current error measure, defaults to1e-6.multiAC (
char) – execution style for the local AC updates for a multi-site unit cell, options are:'parallel': (default) update all AC tensors simultaneously.'sequential': update one AC tensor at a time, sweeping through the unit cell.
dynamical_multiAC (
logical) – automatically switch from'sequential'to'parallel'if the error measure becomes small enough, defaults tofalse.tol_multiAC (
char) – tolerance for automatically switching from'sequential'to'parallel'if the error measure falls below this value, defaults toInf.alg_eigs (
KrylovSchurorArnoldi) – algorithm used for the eigsolver subroutines, defaults toArnoldi('MaxIter', 100, 'KrylovDim', 20).
- fixedpoint(alg, mpo, mps)¶
Find the fixed point MPS of an infinite MPO, given an initial guess.
Usage
[mps, lambda, GL, GR, eta] = fixedpoint(alg, mpo, mps)- Arguments
alg (
Vumps) – VUMPS algorithm.mpo (
InfMpo) – matrix product operator.mps (
UniformMps) – initial guess for MPS fixed point.
- Returns
mps (
UniformMps) – MPS fixed point.lambda (
double) – eigenvalue.GL (
cellofMpsTensor) – left environment tensors.GR (
cellofMpsTensor) – right environment tensors.eta (
double) – final error measure at convergence.
- class IDmrg(kwargs)¶
Infinite Density Matrix Renormalization Group algorithm.
- Properties
tol (
double) – tolerance for convergence criterion, defaults to1e-10.miniter (
int) – minimum number of iteration, defaults to 5.maxiter (
int) – maximum number of iteration, defaults to 100.verbosity (
Verbosity) – verbosity level of the algorithm, defaults toVerbosity.iter.which (
char) – eigenvalue selector (passed as thesigmaargument toeigsolve()), defaults to'largestabs'.dynamical_tols (
logical) – indicate whether or not to use a dynamical tolerance scaling for the algorithm’s subroutines based on the current error measure, defaults tofalse.tol_min (
double) – smallest allowed convergence tolerance for soubroutines, defaults to1e-12.tol_max (
double) – highest allowed convergence tolerance for soubroutines, defaults to1e-6.eigs_tolfactor (
double) – relative scaling factor for determining the convergence tolerance of the local update solver subroutine based on the current error measure, defaults to1e-4.alg_eigs (
KrylovSchurorArnoldi) – algorithm used for the eigsolver subroutines, defaults toArnoldi('MaxIter', 100, 'KrylovDim', 20).
- fixedpoint(alg, mpo, mps)¶
Find the fixed point MPS of an infinite MPO, given an initial guess.
Usage
[mps, lambda, GL, GR] = fixedpoint(alg, mpo, mps)- Arguments
alg (
IDmrg) – IDMRG algorithm.mpo (
InfMpo) – matrix product operator.mps (
UniformMps) – initial guess for MPS fixed point.
- Returns
mps (
UniformMps) – MPS fixed point.lambda (
double) – eigenvalue.GL (
cellofMpsTensor) – left environment tensors.GR (
cellofMpsTensor) – right environment tensors.
- class IDmrg2(kwargs)¶
Infinite Density Matrix Renormalization Group algorithm with 2-site updates.
- Properties
tol (
double) – tolerance for convergence criterion, defaults to1e-10.miniter (
int) – minimum number of iteration, defaults to 5.maxiter (
int) – maximum number of iteration, defaults to 100.verbosity (
Verbosity) – verbosity level of the algorithm, defaults toVerbosity.iter.doplot (
logical) – plot progress, defaults tofalse.which (
char) – eigenvalue selector (passed as thesigmaargument toeigsolve()), defaults to'largestabs'.dynamical_tols (
logical) – indicate whether or not to use a dynamical tolerance scaling for the algorithm’s subroutines based on the current error measure, defaults tofalse.tol_min (
double) – smallest allowed convergence tolerance for soubroutines, defaults to1e-12.tol_max (
double) – highest allowed convergence tolerance for soubroutines, defaults to1e-6.eigs_tolfactor (
double) – relative scaling factor for determining the convergence tolerance of the local update solver subroutine based on the current error measure, defaults to1e-7.trunc (
struct) – truncation method for local 2-site update, seeTensor.tsvd()for details on truncation options.alg_eigs (
KrylovSchurorArnoldi) – algorithm used for the eigsolver subroutines, defaults toArnoldi('MaxIter', 100, 'KrylovDim', 20).
- fixedpoint(alg, mpo, mps)¶
Find the fixed point MPS of an infinite MPO, given an initial guess.
Usage
[mps, lambda, GL, GR] = fixedpoint(alg, mpo, mps)- Arguments
alg (
IDmrg2) – IDMRG2 algorithm.mpo (
InfMpo) – matrix product operator.mps (
UniformMps) – initial guess for MPS fixed point.
- Returns
mps (
UniformMps) – MPS fixed point.lambda (
double) – eigenvalue.GL (
cellofMpsTensor) – left environment tensors.GR (
cellofMpsTensor) – right environment tensors.
- class QPAnsatz(kwargs)¶
Quasi-Particle excitation ansatz.
- Properties
alg_eigs (
KrylovSchurorArnoldi) – algorithm used for the eigsolver subroutines, defaults toArnoldi('MaxIter', 100, 'KrylovDim', 30, 'Tol', 1e-8).alg_environments (
struct) – algorithm used for the environment subroutines (seeAbstractTensor.linsolve()for details), defaults tostruct('Tol', 1e-10, 'Algorithm', 'bicgstabl').howmany (
int) – number of excitations to compute.which (
char) – eigenvalue selector (passed as thesigmaargument toeigsolve()), defaults to'largestabs'.
- excitations(alg, mpo, qp)¶
Find excitations
Usage
[qp, mu] = excitations(alg, mpo, qp)- Arguments
alg (
QPAnsatz) – Quasi-particle ansatz algorithm.mpo (
InfMpo) – matrix product operator.mps (
UniformMps) – initial guess for MPS fixed point.
- Returns
qp (
InfQP) – vector of quasiparticle states.mu (
double) – vector of corresponding eigenvalues.
- class Vomps(kwargs)¶
Fixed point algorithm for maximizing overlap.
- Properties
tol (
double) – tolerance for convergence criterion, defaults to1e-10.miniter (
int) – minimum number of iteration, defaults to 5.maxiter (
int) – maximum number of iteration, defaults to 100.verbosity (
Verbosity) – verbosity level of the algorithm, defaults toVerbosity.iter.which (
char) – eigenvalue selector (passed as thesigmaargument toeigsolve()), defaults to'largestabs'.dynamical_tols (
logical) – indicate whether or not to use a dynamical tolerance scaling for the algorithm’s subroutines based on the current error measure, defaults totrue.tol_min (
double) – smallest allowed convergence tolerance for soubroutines, defaults to1e-12.tol_max (
double) – highest allowed convergence tolerance for soubroutines, defaults to1e-6.eigs_tolfactor (
double) – relative scaling factor for determining the convergence tolerance of the local update solver subroutine based on the current error measure, defaults to1e-4.canonical_tolfactor (
double) – relative scaling factor for determining the convergence tolerance of the canonicalization subroutine based on the current error measure, defaults to1e-8.environments_tolfactor (
double) – relative scaling factor for determining the convergence tolerance of the environment solver subroutine based on the current error measure, defaults to1e-4.multiAC (
char) – execution style for the local AC updates for a multi-site unit cell, options are:'parallel': (default) update all AC tensors simultaneously.'sequential': update one AC tensor at a time, sweeping through the unit cell.
dynamical_multiAC (
logical) – automatically switch from'sequential'to'parallel'if the error measure becomes small enough, defaults tofalse.tol_multiAC (
char) – tolerance for automatically switching from'sequential'to'parallel'if the error measure falls below this value, defaults toInf.
- approximate(alg, mpo, mps1, mps2)¶
Approximate the product of an MPS and an MPO as an MPS.
Usage
[mps2, GL, GR] = approximate(alg, mpo, mps1, mps2)- Arguments
alg (
Vumps) – VUMPS algorithm.mpo (
InfMpo) – matrix product operator.mps1 (
UniformMps) – MPS to which the MPO is applied.mps2 (
UniformMps) – initial guess for MPS approximation.
- Returns
mps2 (
UniformMps) – MPS approximation, such thatmps2\(\approx\)mpo * mps1.GL (
cellofMpsTensor) – left environment tensors.GR (
cellofMpsTensor) – right environment tensors.
- class Expand(kwargs)¶
Bond expansion algorithm for uniform matrix product states.
- Properties
bondsmethod (
char) – bond expansion method, options are:'off': no bond expansion.'factor': (default) multiply the bond dimsion in each sector by a fixed factor'explicit': manually provide bond dimension expansion.'extrapolate': extrapolate the bond dimension in each sector according to a pre-defined exponential distribution.'twosite': expand bond dimension according to a truncated two-site update.
chargesmethod (
char) – charge expansion method, options are:'off': (default) no charge expansion.'fusionproduct': expand virtual charges according to the fusion product of each previous virtual space with the corresponding physical space.'twosite': expand virtual charges according to a truncated two-site update.
schmidtcut (
double) – cut in singular values used in two-site update, defaults to1e-5.notrunc (
logical) – disable truncation such that the bond dimension is only grown, defaults tofalse.noisefactor (
double) – noise factor applied to expanded MPS entries in order to improve stability, defaults to1e-3.which (
char) – eigenvalue selector used in two-site update routine (passed as thesigmaargument toeigsolve()), defaults to'largestabs'.minbond (
int) – minimal bond dimension in for each charge, defaults to1maxbond (
int) – maximal bond dimension for each charge, defaults to1e9.tolbond (
double) – tolerance on expanded bond dimension compared to their current values, defaults to0.2.bondfactor (
double) – expansion factor used for the'factor'bond expansion method, defaults to1.2.cutfactor (
double) – cut factor used in bond dimension extrapolation for the'extrapolate'bond expansion method, defaults to1.explicitbonds (
int) – vector of integers indicating the bond dimsension to add/subtract for each charge, defaults to[].mincharges (
int) – minimal number of charges in eevery virtual space, defaults to2.finalize (
function_handle) – optional finalization.
- changebonds(alg, mpo, mps1)¶
Change charges and bond dimensions of MPS virtual spaces.
Usage
[mps2, flag] = changebonds(alg, mpo, mps1)- Arguments
alg (
Expand) – bond expansion algorithm.mpo (
InfMpo) – matrix product operator.mps1 (
UniformMps) – MPS to be expanded.
- Returns
mps2 (
UniformMps) – expanded MPS.flag (
struct) – explain.
Infinite PEPS algorithms¶
- class Ctmrg(kwargs)¶
Corner Transfer Matrix Renormalisation Group algorithm for PEPS.
- Properties
tol (
double) – tolerance for convergence criterion, defaults to1e-10.miniter (
int) – minimum number of iteration, defaults to5.maxiter (
int) – maximum number of iteration, defaults to100.projectortype (
char) – projector scheme used in the algorithm, currently only supports a single default value.trunc (
struct) – specification of truncation options, seeTensor.tsvd()for details.verbosity (
Verbosity) – verbosity level of the algorithm, defaults toVerbosity.iter.doplot (
logical) – plot progress, defaults tofalse.
- fixedpoint(alg, peps_top, peps_bot, envs)¶
Find the fixed point CTMRG environment of an infinite PEPS overlap.
Usage
[envs, new_norm, err] = fixedpoint(alg, peps_top, peps_bot, envs)- Arguments
alg (
Ctmrg) – CTMRG algorithm.peps_top (
UniformPeps) – top-layer uniform PEPS, usually interpreted as the ‘ket’ in the overlap.peps_bot (
UniformPeps) – bottom-layer uniform PEPS, usually interpreted as the ‘bra’ in the overlap, defaults to the top layer state.envs (
CtmrgEnv) – initial guess for the fixed point CTMRG environment.
- Returns
envs (
CtmrgEnv) – fixed point CTMRG environment.new_norm (
double) – corresponding norm.err (
double) – final error measure at convergence.
Eigsolvers¶
- class Arnoldi(kwargs)¶
Arnoldi Krylov algorithm for linear algebra problems.
- Properties
tol (
double) – convergence tolerance, defaults to1e-10.maxiter (
int) – maximum number of iterations, defaults to100.krylovdim (
int) – Krylov subspace dimension, defaults to20.deflatedim (
int) – number of Krylov vectors to keep when deflating.reorth (
int) – reorthogonalize basis if larger than this number, defaults to20.nobuild (
int) – frequency of convergence check when building, defaults to3.verbosity (
Verbosity) – display information, defaults toVerbosity.warn.
- eigsolve(alg, A, v0, howmany, sigma)¶
Find a few eigenvalues and eigenvectors of an operator using an Arnoldi routine.
Usage
[V, D, flag] = eigsolve(A, v, howmany, sigma)D = eigsolve(A, v, ...)- Arguments
A (
matrixorfunction_handle) – A square matrix. A function handle which implements one of the following, depending on sigma:A x, if sigma is 0 or ‘smallestabs’(A - sigma * I) x, if sigma is a nonzero scalarA * x, for all other cases
v (
vector) – initial guess for the eigenvector.howmany (
int) – amount of eigenvalues and eigenvectors that should be computed. By default this is 1, and this should not be larger than the total dimension of A.sigma (
charor numeric) – selector for the eigenvalues, should be either one of the following:‘largestabs’, ‘lm’: default, eigenvalues of largest magnitude
‘largestreal’, ‘lr’: eigenvalues with largest real part
‘largestimag’, ‘li’: eigenvalues with largest imaginary part.
‘smallestabs’, ‘sm’: default, eigenvalues of smallest magnitude
‘smallestreal’, ‘sr’: eigenvalues with smallest real part
‘smallestimag’, ‘si’: eigenvalues with smallest imaginary part.
numeric : eigenvalues closest to sigma.
- Returns
V ((1, howmany)
vector) – vector of eigenvectors.D (
numeric) – vector of eigenvalues if only a single output argument is asked, diagonal matrix of eigenvalues otherwise.flag (
int) – convergence info flag:flag = 0: all eigenvalues are converged.
flag = 1: invariant subspace was found and the algorithm was aborted.
flag = 2: algorithm did not converge after maximum number of iterations.
- class KrylovSchur(kwargs)¶
KrylovSchur wrapper for Matlab implementation of eigs
- Properties
tol (
double) – convergence tolerance, defaults to1e-10.maxiter (
int) – maximum number of iterations, defaults to100.krylovdim (
int) – Krylov subspace dimension, defaults to20.verbosity (
Verbosity) – display information, defaults toVerbosity.warn.
- eigsolve(alg, A, v0, howmany, sigma, kwargs)¶
Find a few eigenvalues and eigenvectors of an operator using the builtin Matlab eigs routine.
Usage
[V, D, flag] = eigsolve(A, v, howmany, sigma, kwargs)D = eigsolve(A, v, ...)- Arguments
A (
matrixorfunction_handle) – A square matrix. A function handle which implements one of the following, depending on sigma:A x, ifsigmais 0 or ‘smallestabs’:code:(A - sigma * I) x`, if sigma is a nonzero scalar
:code:A * x`, for all other cases
v (
vector) – initial guess for the eigenvector.howmany (
int) – amount of eigenvalues and eigenvectors that should be computed. By default this is 1, and this should not be larger than the total dimension of A.sigma (
charornumeric) – selector for the eigenvalues, should be either one of the following:‘largestabs’, ‘lm’: default, eigenvalues of largest magnitude
‘largestreal’, ‘lr’: eigenvalues with largest real part
‘largestimag’, ‘li’: eigenvalues with largest imaginary part.
‘smallestabs’, ‘sm’: default, eigenvalues of smallest magnitude
‘smallestreal’, ‘sr’: eigenvalues with smallest real part
‘smallestimag’, ‘si’: eigenvalues with smallest imaginary part.
numeric : eigenvalues closest to sigma.
- Keyword Arguments
IsSymmetric (
logical) – flag to speed up the algorithm if the operator is symmetric, false by default.- Returns
V ((1, howmany)
vector) – vector of eigenvectors.D (
numeric) – vector of eigenvalues if only a single output argument is asked, diagonal matrix of eigenvalues otherwise.flag (
int) – convergence info flag:if flag = 0 then all eigenvalues are converged, otherwise not.