mdopt.optimiser package
Submodules
mdopt.optimiser.dephasing_dmrg module
This module contains the DephasingDMRG
and the EffectiveDensityOperator
classes.
This algorithm’s main feature is that it restricts the target-state search to the computational basis states domain. In particular, we use it to find the main component of a Matrix Density Product Operator (MDPO), i.e., a computational basis state contributing the largest amplitude.
In our notation, MDPO for n
sites denotes the following object:
| | | |
| | | |
----(0*)---(1*)--- ... ---(n-2*)--(n-1*)---
----(0)----(1)---- ... ---(n-2)---(n-1)----
| | | |
| | | |
An MDPO is formed by an MPS and its complex-conjugated version. The main idea is to find the main component of this object without performing the kronecker product explicitly.
- class mdopt.optimiser.dephasing_dmrg.DephasingDMRG(mps: Union[ExplicitMPS, CanonicalMPS], mps_target: Union[ExplicitMPS, CanonicalMPS], chi_max: int = 10000, cut: float32 = 1e-12, mode: str = 'SA', silent: bool = False, copy: bool = True)
Class holding the Dephasing Density Matrix Renormalisation Group algorithm with two-site updates for a finite-size system with open-boundary conditions.
- mps
MPS serving as a current approximation of the target state.
- Type:
Union[ExplicitMPS, CanonicalMPS]
- mps_target
The target MPS in the right-canonical form. This MPS is used to construct the dephased MDPO.
- Type:
Union[ExplicitMPS, CanonicalMPS]
- chi_max
The highest bond dimension of an MPS allowed.
- Type:
int
- mode
- The eigensolver mode. Available options:
LM
: Largest (in magnitude) eigenvalues.SM
: Smallest (in magnitude) eigenvalues.LA
: Largest (algebraic) eigenvalues.SA
: Smallest (algebraic) eigenvalues.
- Type:
str
- cut
The lower boundary of the spectrum, i.e., all the singular values smaller than that will be discarded.
- Type:
np.float32
- silent
Whether to show/hide the progress bar.
- Type:
bool
- run(num_iter: int = 1) None
Run the algorithm, i.e., run the
sweep
method fornum_iter
number of times.
- sweep() None
One Dephasing DMRG sweep.
A method performing one Dephasing DMRG sweep, which consists of two series of
update_bond
sweeps which go back and forth.
- update_bond(i: int) None
Updates the bond between sites
i
andi+1
.
- update_left_environment(i: int) None
Compute the
left_environment
left of sitei+1
from theleft_environment
left of sitei
.
- update_right_environment(i: int) None
Compute the
right_environment
right of sitei-1
from theright_environment
right of sitei
.
- class mdopt.optimiser.dephasing_dmrg.EffectiveDensityOperator(*args, **kwargs)
Bases:
LinearOperator
Class to store an effective two-site density operator.
To take more advantage of the
scipy.sparse.linalg
module, we make a special class for local effective density operators extending the analogy from local effective operators. It allows us to compute eigenvectors more effeciently.The diagram displaying the contraction can be found in the supplementary notes.
mdopt.optimiser.dmrg module
This module contains the DMRG
and the EffectiveOperator
classes.
The class structure is inspired by TenPy.
- class mdopt.optimiser.dmrg.DMRG(mps: Union[ExplicitMPS, CanonicalMPS], mpo: List[ndarray], chi_max: int = 10000, cut: float32 = 1e-12, mode: str = 'SA', silent: bool = False, copy: bool = True)
Class storing the DMRG methods.
Class holding the Density Matrix Renormalisation Group algorithm with two-site updates for a finite-size system with open-boundary conditions.
- mps
MPS serving as a current approximation of the target state.
- Type:
Union[ExplicitMPS, CanonicalMPS]
- mpo
The MPO of which the target state is to be computed. Each tensor in the MPO list has legs
(vL, vR, pU, pD)
, wherev
stands for “virtual”,p
– for “physical”, andL
,R
,U
,D
– for “left”, “right”, “up”, “down” accordingly.- Type:
List[np.ndarray]
- chi_max
The highest bond dimension of an MPS allowed.
- Type:
int
- cut
The lower boundary of the spectrum, i.e., all the singular values smaller than that will be discarded.
- Type:
np.float32
- mode
- The eigensolver mode. Available options:
LM
: Largest (in magnitude) eigenvalues.SM
: Smallest (in magnitude) eigenvalues.LA
: Largest (algebraic) eigenvalues.SA
: Smallest (algebraic) eigenvalues.
- Type:
str
- silent
Whether to show/hide the progress bar.
- Type:
bool
- copy
Whether to copy the input MPS or modify inplace.
- Type:
bool
- run(num_iter: int = 1) None
Run the algorithm, i.e., run the
sweep
method fornum_iter
number of iterations.
- sweep() None
One DMRG sweep.
A method performing one DMRG sweep, which consists of two series of
update_bond
sweeps which go back and forth.
- update_bond(i: int) None
Updates the bond between sites
i
andi+1
.
- update_left_environment(i: int) None
Compute the
left_environment
left of sitei+1
from theleft_environment
left of sitei
.
- update_right_environment(i: int) None
Compute the
right_environment
right of sitei-1
from theright_environment
right of sitei
.
- class mdopt.optimiser.dmrg.EffectiveOperator(*args, **kwargs)
Bases:
LinearOperator
Class to store an effective two-site operator.
In order to take more advantage of the
scipy.sparse.linalg
module, we make a special class for local effective operators. It allows us to compute eigenvectors more effeciently.Such effective operator is to be diagonalised in the
update_bond
method of theDMRG
class:---uL uR--- | i j | | vL | | vR | (L)----(mpo_l)----(mpo_r)----(R) | | | | | k l | ---dL dR---
In our convention, the legs of left/right environments (tensors
L
/R
in the cartoon) are ordered as follows:(uL/uR, vL/vR, dL/dR)
which means “(up, virtual, down)”.
mdopt.optimiser.utils module
This module contains different combinatorial optimisation utilities.
First, we define the tensors which represent logical operation. We use the following tensors: IDENTITY, COPY, XOR, SWAP. See the notes for additional information.
According to our convention, each tensor has legs (vL, vR, pU, pD), where v stands for “virtual”, p – for “physical”, and L, R, U, D stand for “left”, “right”, “up”, “down”.
- class mdopt.optimiser.utils.ConstraintString(constraints: List[ndarray], sites: List[List[int]])
Class for storing a string of logical constraints in the Matrix Product Operator format. Logical constraints are to be passed in the form of 4-dimensional MPO tensors.
- constraints
A list of logical constraints of which the string consists.
- Type:
List[np.ndarray]
- sites
Each list inside corresponds to a constraint from the constraints list, and contains the sites to which each constraint is applied. For example, [[3, 5], [2, 4, 6], …] means applying constraints[0] to sites 3 and 5, constraints[1] to sites 2, 4, 6, etc.
- Type:
List[List[int]]
- Exceptions
- ----------
- ValueError
Empty list of constraints.
- ValueError
Empty list of sites.
- ValueError
The
sites
list is longer than theconstraints
list.
- ValueError
Non-unique sites in the sites list.
- flat(sort: bool = False) List[int]
Returns a flattened list of sites.
- Parameters:
sort (bool) – Whether to sort the flattened list.
- mpo() List[ndarray]
Returns an MPO corresponding to the current
ConstraintString
instance.
- span() int
Returns the span (length) of the constraint string.