MPS¶
This section contains the API documentation for the mps module.
States¶
- class MpsTensor(tensor, alegs)¶
Bases:
home.docs.checkouts.readthedocs.org.user_builds.tensortrack.checkouts.latest.src.tensors.AbstractTensorGeneric MPS tensor objects that have a notion of virtual, physical and auxiliary legs.
- Properties
var (
TensororSparseTensor) – tensor data of the MPS tensor.plegs (
int) – number of physical legs.alegs (
int) – number of auxiliary legs.
Todo
Document all methods.
- insert_onespace(tsrc, varargin)¶
Insert a trivial space at position
i, corresponding to an additional auxiliary leg.See also
- ctranspose(t)¶
Compute the adjoint of a tensor. This is defined as swapping the codomain and domain, while computing the adjoint of the matrix blocks.
Usage
t = ctranspose(t)t = t'
- initializeC(A)¶
Initialize a set of gauge tensors for the given mpstensors.
- expand(A, leftvspace, rightvspace, noisefactor)¶
Expand a tensor to the given virtual spaces.
- multiplyleft(A, C)¶
Multiply a gauge matrix from the left.
- multiplyright(A, C)¶
Multiply a gauge matrix from the right.
- vectorize(t, type)¶
Collect all parameters in a vector, weighted to reproduce the correct inproduct.
- Arguments
t (
MpsTensor) – input tensor.type (‘real’ or ‘complex’) – optionally specify if complex entries should be seen as 1 or 2 parameters. Defaults to ‘complex’, with complex parameters.
- Returns
v (
numeric) – real or complex vector containing the parameters of the tensor.
- devectorize(v, t, type)¶
Collect all parameters from a vector, and insert into a tensor.
- Arguments
v (
numeric) – real or complex vector containing the parameters of the tensor.t (
MpsTensor) – input tensor.type (
char, ‘real’ or ‘complex’) – optionally specify if complex entries should be seen as 1 or 2 parameters. Defaults to ‘complex’, with complex parameters.
- Returns
t (
MpsTensor) – output tensor, filled with the parameters.
- static decompose_local_state(psi, kwargs)¶
convert a tensor into a product of local operators.
Usage
local_operators = MpoTensor.decompose_local_operator(H, kwargs).- Arguments
psi (
AbstractTensor) – tensor representing a local state on N sites.- Keyword Arguments
‘Trunc’ (
cell) – optional truncation method for the decomposition. See alsoTensor.tsvd()
- class FiniteMps(varargin)¶
Finite matrix product state.
- Properties
A (
cellofMpsTensor) – set of tensors that define a finite MPS.center (
int) – location of center gauge, such that every tensor to the left (right) ofcenteris in left (right) gauge.
Todo
Document.
- class UniformMps(varargin)¶
Implementation of infinite translation invariant MPS
The center gauge is defined to have:
\[AL_w \cdot C_w = AC_w = C_{w-1} \cdot AR_w\]- Properties
Todo
Document all methods.
- UniformMps(varargin)¶
Usage
mps = UniformMps(A)mps = UniformMps(AL, AR, C [, AC])- Arguments
- Returns
mps (
UniformMps) – gauged uniform MPS.
- static new(fun, pspaces, vspaces)¶
Create a uniform matrix product state with data using a function handle.
Usage
UniformMps.new(fun, pspaces, vspaces)- Arguments
fun (
function_handle) – function to initialize the tensor.- Repeating Arguments
pspaces (
AbstractSpace) – physical spaces for each site.vspaces (
AbstractSpace) – virtual spaces between each site. (entry i corresponds to left of site i.)
- static randnc(pspaces, vspaces)¶
Create a uniform matrix product state with random entries.
See also
- period(mps)¶
Period over which the mps is translation invariant.
- depth(mps)¶
Number of lines in a multi-line mps.
- leftvspace(mps, w)¶
Return the virtual space to the left of site w.
- pspace(mps, w)¶
Return the physical space at site w.
- rightvspace(mps, w)¶
Return the virtual space to the right of site w.
- canonicalize(mps, kwargs)¶
Compute the center-gauged form of an mps.
Usage
[mps, lambda] = canonicalize(mps, kwargs)- Arguments
mps (
UniformMps) – input mps, from which AL or AR is used as the state, and optionally C as an initial guess for the gauge.- Keyword Arguments
Tol (
numeric) – tolerance for the algorithm.MaxIter (
integer) – maximum number of iterations.Method (
char) – algorithm used for decomposition. Must be ‘polar’, ‘qr’ or ‘qrpos’.Verbosity (
Verbosity) – level of output.DiagC (
logical) – flag to indicate if C needs to be diagonalized.ComputeAC (
logical) – flag to indicate if AC needs to be computed.Order (
char, ‘lr’ or ‘rl’) – order of gauge fixing:‘lr’ uses AL as input tensors, first
leftorth, thenrightorth.‘rl’ uses AR as input tensors, first
rightorth, thenleftorth.
- diagonalizeC(mps)¶
Gauge transform an mps such that C is diagonal.
- normalize(mps)¶
Normalize an mps state.
- transfermatrix(mps1, mps2, sites, kwargs)¶
A finite matrix product operator that represents the transfer matrix of an mps.
Usage
T = transfermatrix(mps1, mps2, sites, kwargs)- Arguments
mps1 (
UniformMps) – input mps for top layer.mps2 (
UniformMps) – input mps for bottom layer, by default equal to the top.sites (
int) – optionally slice the unit cell of the mps and only define the transfer matrix for this slice.
- Keyword Arguments
Type (
char) – ‘LL’, ‘LR’, ‘RL’, ‘RR’ to determine if the top or bottom respectively are AL or AR.- Returns
T (
FiniteMpo) – transfer matrix of an mps, acting to the left.
- fixedpoint(mps, type, w)¶
compute the fixed point of the transfer matrix of an mps.
Usage
rho = fixedpoint(mps, type, w)- Arguments
mps (
UniformMps) – input state.type (
char) – specification of the type of transfer matrix: general format:sprintf(%c_%c%c, side, top, bot)where side is ‘l’ or ‘r’ to determine which fixedpoint, and top and bot are ‘L’ or ‘R’ to specify whether to use AL or AR in the transfer matrix.w (
int) – position within the mps unitcell of the fixed point.
- transfereigs(mps1, mps2, howmany, which, eigopts, kwargs)¶
Compute the eigenvalues of the transfer matrix of an mps.
Usage
[V, D] = transfereigs(mps1, mps2, howmany, which, eigopts, kwargs)- Arguments
mps1 (
UniformMps) – input mps for top layer.mps2 (
UniformMps) – input mps for bottom layer. Default value equal to mps1.howmany (
int) – number of eigenvectors and eigenvalues to compute.which (
char) – type of eigenvectors to target.
- Keyword Arguments
eigopts – see keyword arguments for
eigsolve().Verbosity (
int) – detail level for output.Type (
char) – type of transfer matrix to construct, seeUniformMps.transfermatrix().Charge (
AbstractCharge) – charge of eigenvectors to target.
- fidelity(mps1, mps2, kwargs)¶
Compute the fidelity between two uniform MPSs.
- expectation_value(mps1, O, mps2)¶
Compute the expectation value of an operator.
- local_expectation_value(mps, O, offset)¶
Compute the expectation value of a local operator.
- schmidt_values(mps, w)¶
Compute the Schmidt values and corresponding charges for an entanglement cut to the right of site
w.Usage
[svals, charges] = schmidt_values(mps, w)
- plot_entanglementspectrum(mps, d, w, ax, kwargs)¶
Plot the entanglement spectrum of a uniform MPS.
- correlation_length(mps, charge)¶
Compute the correlation length of an MPS in a given charge sector.
Usage
[xi, theta] = correlation_length(mps, charge)- Arguments
mps (
UniformMps) – input mps.charge (
AbstractCharge) – charge sector for correlation length to target.
- Returns
xi (
numeric) – correlation length in the given charge sector.theta (
numeric) – angle of the corresponding oscillation period.
- marek_gap(mps, charge, kwargs)¶
Compute the Marek gap of an MPS in a given charge sector.
Usage
[epsilon, delta, spectrum] = marek_gap(mps, charge, kwargs)- Arguments
mps (
UniformMps) – input mps.charge (
AbstractCharge) – charge sector for correlation length to target.
- Keyword Arguments
HowMany (
int) – amount of transfer matrix eigenvalues to compute.Angle (
numeric) – angle in radians around which the gap should be computed.AngleTol (
numeric) – tolerance in radians for angles to be considered equal.
- Returns
epsilon (
numeric) – inverse correlation length in the given charge sector.delta (
numeric) – refinement parameter.spectrum (
numeric) – computed partial transfer matrix spectrum.
- entanglement_entropy(mps, w)¶
Compute the entanglement entropy of a uniform MPS for a cut to the right of site
w
- renyi_entropy(mps, n, w)¶
Compute the
n-th Renyi entropy of a uniform MPS for a cut to the right of sitew
- truncate(mps, trunc)¶
Truncate a uniform MPS according to the options specified in
trunc(seeTensor.tsvd()for details on the truncation options).
- class InfQP(varargin)¶
Infinite Quasi-Particle states
Todo
Document.
- fixedpoint(qp, type, w)¶
compute the fixed point of the transfer matrix of a quasi-particle state.
Usage
rho = fixedpoint(qp, type, w)- Arguments
mps (
InfQP) – input quasi-particle state.type (
char) – specification of the type of transfer matrix: general format: sprintf(%c_%c%c, side, top, bot) where side is ‘l’ or ‘r’ to determine which fixedpoint, and top and bot are ‘L’ or ‘R’ to specify whether to use AL or AR in the transfer matrix.w (
int) – position within the mps unitcell of the fixed point.
- vectorize(qp, type)¶
Collect all parameters in a vector, weighted to reproduce the correct inner product.
- Arguments
qp (
InfQP) – input quasi-particle state.type (
char, ‘real’ or ‘complex’) – optionally specify if complex entries should be seen as 1 or 2 parameters. Defaults to ‘complex’, with complex parameters.
- Returns
v (
numeric) – real or complex vector containing the parameters of the quasi-particle state.
- devectorize(v, qp, type)¶
Collect all parameters from a vector, and insert into a quasi-particle state.
- Arguments
v (
numeric) – real or complex vector containing the parameters of the quasi-particle state.qp (
InfQP) – input quasi-particle state.type (
char, ‘real’ or ‘complex’) – optionally specify if complex entries should be seen as 1 or 2 parameters. Defaults to ‘complex’, with complex parameters.
- Returns
qp (
InfQP) – output quasi-particle state, filled with the parameters.
Operators¶
- class MpoTensor(varargin)¶
Bases:
home.docs.checkouts.readthedocs.org.user_builds.tensortrack.checkouts.latest.src.tensors.AbstractTensorMatrix product operator building block.
This object represents the MPO tensor at a single site as the sum of rank (2,2) (sparse) tensors and some scalars, which will be implicitly used as unit tensors.
4 v | 1 -<-- O --<- 3 | v 2
Todo
Document.
- static decompose_local_operator(H, kwargs)¶
Convert a tensor into a product of local operators.
Usage
local_operators = MpoTensor.decompose_local_operator(H, kwargs).- Arguments
H (
AbstractTensor) – tensor representing a local operator on N sites.- Keyword Arguments
‘Trunc’ (
cell) – optional truncation method for the decomposition. See alsoTensor.tsvd()
- class FiniteMpo(L, O, R)¶
Finite matrix product operator.
- Properties
L (
MpsTensor) – left end tensor.O (
cellofMpoTensororPepsSandwich) – bulk MPO tensors.R (
MpsTensor) – right end tensor.
Todo
Document.
- initialize_fixedpoint(mpo)¶
Initialize a dense tensor for the fixedpoint of a
FiniteMPO.
- class InfMpo(varargin)¶
Infinite translation invariant matrix product operator.
- Properties
O (
cellofMpoTensororPepsSandwich) – cell of MPO tensors in translation invariant unit cell.
Todo
Document
- class InfJMpo(varargin)¶
Bases:
src.mps.InfMpoInfinite translation invariant matrix product operator with a Jordan block structure.
Todo
Document.
- class PepsTensor(tensor)¶
Generic PEPS tensor object that has a notion of virtual and physical legs.
This object represents the PEPS tensor at a single site as a rank (1, 4) tensor, where the physical index lies in the codomain and the virtual indices lie in the domain.
5 1 | / v ^ |/ 2 ->-- O --<- 4 | ^ | 3
- Properties
var (
Tensor) – PEPS tensor data.
Todo
Document.
- class PepsSandwich(top, bot)¶
Data structure representing a pair of PEPS tensors in an overlap, which behave as an MPO tensor.
- Properties
top (
PepsTensor) – top-layer PEPS tensor, usually interpreted as the ‘ket’ in the overlap.bot (
PepsTensor) – bottom-layer PEPS tensor, usually interpreted as the ‘bra’ in the overlap.
Todo
Document.
- class UniformPeps(varargin)¶
Implementation of infinite translation invariant PEPS
- Properties
A (
cellofPepsTensor) – cell array of PEPS tensors in 2D unit cell.
Todo
Document.
- UniformPeps(varargin)¶
Usage
peps = UniformPeps(A)- Arguments
A (
cellofPepsTensor) – cell array of PEPS tensors in 2D unit cell.- Returns
peps (
UniformPeps) – infinite translation-invariant PEPS.