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 to 1e-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 to Verbosity.iter.

  • doplot (logical) – plot progress, defaults to false.

  • which (char) – eigenvalue selector (passed as the sigma argument to eigsolve()), 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 to false

  • tol_min (double) – smallest allowed convergence tolerance for soubroutines, defaults to 1e-12.

  • tol_max (double) – highest allowed convergence tolerance for soubroutines, defaults to 1e-10.

  • eigs_tolfactor (double) – relative scaling factor for determining the convergence tolerance of the eigensolver subroutine based on the current error measure, defaults to 1e-6

  • sweepstyle (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 (KrylovSchur or Arnoldi) – algorithm used for the local eigsolver updates, defaults to KrylovSchur('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: handle

Variational fixed point algorithm for uniform matrix product states.

Properties
  • tol (double) – tolerance for convergence criterion, defaults to 1e-10.

  • miniter (int) – minimum number of iteration, defaults to 5.

  • maxiter (int) – maximum number of iteration, defaults to code:100.

  • verbosity (Verbosity) – verbosity level of the algorithm, defaults to Verbosity.iter.

  • doplot (logical) – plot progress, defaults to false.

  • which (char) – eigenvalue selector (passed as the sigma argument to eigsolve()), 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 to true.

  • tol_min (double) – smallest allowed convergence tolerance for soubroutines, defaults to 1e-12.

  • tol_max (double) – highest allowed convergence tolerance for soubroutines, defaults to 1e-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 to 1e-6.

  • canonical_tolfactor (double) – relative scaling factor for determining the convergence tolerance of the canonicalization subroutine based on the current error measure, defaults to 1e-8.

  • environments_tolfactor (double) – relative scaling factor for determining the convergence tolerance of the environment solver subroutine based on the current error measure, defaults to 1e-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 to false.

  • tol_multiAC (char) – tolerance for automatically switching from 'sequential' to 'parallel' if the error measure falls below this value, defaults to Inf.

  • alg_eigs (KrylovSchur or Arnoldi) – algorithm used for the eigsolver subroutines, defaults to Arnoldi('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 (cell of MpsTensor) – left environment tensors.

  • GR (cell of MpsTensor) – 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 to 1e-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 to Verbosity.iter.

  • which (char) – eigenvalue selector (passed as the sigma argument to eigsolve()), 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 to false.

  • tol_min (double) – smallest allowed convergence tolerance for soubroutines, defaults to 1e-12.

  • tol_max (double) – highest allowed convergence tolerance for soubroutines, defaults to 1e-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 to 1e-4.

  • alg_eigs (KrylovSchur or Arnoldi) – algorithm used for the eigsolver subroutines, defaults to Arnoldi('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 (cell of MpsTensor) – left environment tensors.

  • GR (cell of MpsTensor) – right environment tensors.

class IDmrg2(kwargs)

Infinite Density Matrix Renormalization Group algorithm with 2-site updates.

Properties
  • tol (double) – tolerance for convergence criterion, defaults to 1e-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 to Verbosity.iter.

  • doplot (logical) – plot progress, defaults to false.

  • which (char) – eigenvalue selector (passed as the sigma argument to eigsolve()), 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 to false.

  • tol_min (double) – smallest allowed convergence tolerance for soubroutines, defaults to 1e-12.

  • tol_max (double) – highest allowed convergence tolerance for soubroutines, defaults to 1e-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 to 1e-7.

  • trunc (struct) – truncation method for local 2-site update, see Tensor.tsvd() for details on truncation options.

  • alg_eigs (KrylovSchur or Arnoldi) – algorithm used for the eigsolver subroutines, defaults to Arnoldi('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 (cell of MpsTensor) – left environment tensors.

  • GR (cell of MpsTensor) – right environment tensors.

class QPAnsatz(kwargs)

Quasi-Particle excitation ansatz.

Properties
  • alg_eigs (KrylovSchur or Arnoldi) – algorithm used for the eigsolver subroutines, defaults to Arnoldi('MaxIter', 100, 'KrylovDim', 30, 'Tol', 1e-8).

  • alg_environments (struct) – algorithm used for the environment subroutines (see AbstractTensor.linsolve() for details), defaults to struct('Tol', 1e-10, 'Algorithm', 'bicgstabl').

  • howmany (int) – number of excitations to compute.

  • which (char) – eigenvalue selector (passed as the sigma argument to eigsolve()), 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 to 1e-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 to Verbosity.iter.

  • which (char) – eigenvalue selector (passed as the sigma argument to eigsolve()), 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 to true.

  • tol_min (double) – smallest allowed convergence tolerance for soubroutines, defaults to 1e-12.

  • tol_max (double) – highest allowed convergence tolerance for soubroutines, defaults to 1e-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 to 1e-4.

  • canonical_tolfactor (double) – relative scaling factor for determining the convergence tolerance of the canonicalization subroutine based on the current error measure, defaults to 1e-8.

  • environments_tolfactor (double) – relative scaling factor for determining the convergence tolerance of the environment solver subroutine based on the current error measure, defaults to 1e-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 to false.

  • tol_multiAC (char) – tolerance for automatically switching from 'sequential' to 'parallel' if the error measure falls below this value, defaults to Inf.

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 that mps2 \(\approx\) mpo * mps1.

  • GL (cell of MpsTensor) – left environment tensors.

  • GR (cell of MpsTensor) – 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 to 1e-5.

  • notrunc (logical) – disable truncation such that the bond dimension is only grown, defaults to false.

  • noisefactor (double) – noise factor applied to expanded MPS entries in order to improve stability, defaults to 1e-3.

  • which (char) – eigenvalue selector used in two-site update routine (passed as the sigma argument to eigsolve()), defaults to 'largestabs'.

  • minbond (int) – minimal bond dimension in for each charge, defaults to 1

  • maxbond (int) – maximal bond dimension for each charge, defaults to 1e9.

  • tolbond (double) – tolerance on expanded bond dimension compared to their current values, defaults to 0.2.

  • bondfactor (double) – expansion factor used for the 'factor' bond expansion method, defaults to 1.2.

  • cutfactor (double) – cut factor used in bond dimension extrapolation for the 'extrapolate' bond expansion method, defaults to 1.

  • 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 to 2.

  • 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 to 1e-10.

  • miniter (int) – minimum number of iteration, defaults to 5.

  • maxiter (int) – maximum number of iteration, defaults to 100.

  • projectortype (char) – projector scheme used in the algorithm, currently only supports a single default value.

  • trunc (struct) – specification of truncation options, see Tensor.tsvd() for details.

  • verbosity (Verbosity) – verbosity level of the algorithm, defaults to Verbosity.iter.

  • doplot (logical) – plot progress, defaults to false.

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 to 1e-10.

  • maxiter (int) – maximum number of iterations, defaults to 100.

  • krylovdim (int) – Krylov subspace dimension, defaults to 20.

  • deflatedim (int) – number of Krylov vectors to keep when deflating.

  • reorth (int) – reorthogonalize basis if larger than this number, defaults to 20.

  • nobuild (int) – frequency of convergence check when building, defaults to 3.

  • verbosity (Verbosity) – display information, defaults to Verbosity.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 (matrix or function_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 scalar

    • 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 (char or 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 to 1e-10.

  • maxiter (int) – maximum number of iterations, defaults to 100.

  • krylovdim (int) – Krylov subspace dimension, defaults to 20.

  • verbosity (Verbosity) – display information, defaults to Verbosity.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 (matrix or function_handle) – A square matrix. A function handle which implements one of the following, depending on sigma:

    • A x, if sigma is 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 (char or 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.

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.