quimb.tensor.tensor_1d_compress¶
Generic methods for compressing 1Dlike tensor networks, where the tensor network can locally have arbitrary structure and outer indices.
[x] the direct method
[x] the density matrix method
[x] the zipup method
[x] the zipup first method
[x] the 1site variational fit method, including sums of tensor networks
[x] the 2site variational fit method, including sums of tensor networks
[x] the local projector method (CTMRG and HOTRG style)
[x] the autofit method (via non1d specific ALS or autodiff)
Attributes¶
Functions¶

Check that 



Compress a 1Dlike tensor network using the 'direct' or 'naive' method, 

Compress any 1Dlike tensor network using the 'density matrix' method 

Compress a 1Dlike tensor network using the 'zipup' algorithm due to 

Compress this 1Dlike tensor network using the 'zipup first' algorithm, 

Core sweep of the 1site 1D fit algorithm. 

Core sweep of the 2site 1D fit algorithm. 

Compress any 1Dlike (can have multiple tensors per site) tensor network 

Compress any 1Dlike (can have multiple tensors per site) tensor network 

Compress a 1Dlike tensor network using the specified method. 

Apply an MPO to an MPS lazily, i.e. nothing is contracted, but the new 

Apply an MPO to an MPS using the boundary compression method, that is, 

Gate this MPS with an MPO, using the density matrix compression method. 

Apply an MPO to an MPS using the 'zipup' algorithm due to 

Apply an MPO to an MPS by first using the zipup method with a larger 

Gate an MPS with an MPO using the variational fitting or DMRGstyle 

Fit a MPS to a MPO applied to an MPS using geometry generic versions 

Apply an MPO to an MPS using local projectors, in the style of CTMRG 
Module Contents¶
 quimb.tensor.tensor_1d_compress.enforce_1d_like(tn, site_tags=None, fix_bonds=True, inplace=False)[source]¶
Check that
tn
is 1Dlike with OBC, i.e. 1) that each tensor has exactly one of the givensite_tags
. If not, raise a ValueError. 2) That there are no hyper indices. And 3) that there are only bonds within sites or between nearest neighbor sites. This issue can be optionally automatically fixed by inserting a string of identity tensors. Parameters:
tn (TensorNetwork) – The tensor network to check.
site_tags (sequence of str, optional) – The tags to use to group and order the tensors from
tn
. If not given, usestn.site_tags
.fix_bonds (bool, optional) – Whether to fix the bond structure by inserting identity tensors.
inplace (bool, optional) – Whether to perform the fix inplace or not.
 Raises:
ValueError – If the tensor network is not 1Dlike.
 quimb.tensor.tensor_1d_compress.tensor_network_1d_compress_direct(tn, max_bond=None, cutoff=1e10, site_tags=None, normalize=False, canonize=True, cutoff_mode='rsum2', permute_arrays=True, optimize='autohq', sweep_reverse=False, equalize_norms=False, inplace=False, **compress_opts)[source]¶
Compress a 1Dlike tensor network using the ‘direct’ or ‘naive’ method, that is, explicitly contracting sitewise to form a MPSlike TN, canonicalizing in one direction, then compressing in the other. This has the same scaling as the density matrix (dm) method, but a larger prefactor. It can still be faster for small bond dimensions however, and is potentially higher precision since it works in the space of singular values directly rather than singular values squared. It is not quite optimal in terms of error due to the compounding errors of the SVDs.
 Parameters:
tn (TensorNetwork) – The tensor network to compress. Every tensor should have exactly one of the site tags. Each site can have multiple tensors and output indices.
max_bond (int) – The maximum bond dimension to compress to.
cutoff (float, optional) – A dynamic threshold for discarding singular values when compressing.
site_tags (sequence of str, optional) – The tags to use to group and order the tensors from
tn
. If not given, usestn.site_tags
. The tensor network built will have one tensor per site, in the order given bysite_tags
.normalize (bool, optional) – Whether to normalize the final tensor network, making use of the fact that the output tensor network is in right canonical form.
canonize (bool, optional) – Whether to canonicalize the network in one direction before compressing in the other.
cutoff_mode ({"rsum2", "rel", ...}, optional) – The mode to use when truncating the singular values of the decomposed tensors. See
tensor_split()
.permute_arrays (bool or str, optional) – Whether to permute the array indices of the final tensor network into canonical order. If
True
will use the default order, otherwise if a string this specifies a custom order.optimize (str, optional) – The contraction path optimizer to use.
sweep_reverse (bool, optional) – Whether to sweep in the reverse direction, resulting in a left canonical form instead of right canonical.
equalize_norms (bool, optional) – Whether to renormalize the tensors during the compression procedure. If
True
the gathered exponent will be redistributed equally among the tensors. If a float, all tensors will be renormalized to this value, and the gathered exponent is tracked intn.exponent
of the returned tensor network.inplace (bool, optional) – Whether to perform the compression inplace or not.
compress_opts – Supplied to
tensor_split()
.
 Returns:
The compressed tensor network, with canonical center at
site_tags[0]
(‘right canonical’ form) orsite_tags[1]
(‘left canonical’ form) ifsweep_reverse
. Return type:
 quimb.tensor.tensor_1d_compress.tensor_network_1d_compress_dm(tn, max_bond=None, cutoff=1e10, site_tags=None, normalize=False, cutoff_mode='rsum1', permute_arrays=True, optimize='autohq', sweep_reverse=False, canonize=True, equalize_norms=False, inplace=False, **compress_opts)[source]¶
Compress any 1Dlike tensor network using the ‘density matrix’ method (https://tensornetwork.org/mps/algorithms/denmat_mpo_mps/).
While this has the same scaling as the direct method, in practice it can often be faster, especially at large bond dimensions. Potentially there are some situations where the direct method is more stable with regard to precision, since the density matrix method works in the ‘squared’ picture.
 Parameters:
tn (TensorNetwork) – The tensor network to compress. Every tensor should have exactly one of the site tags. Each site can have multiple tensors and output indices.
max_bond (int) – The maximum bond dimension to compress to.
cutoff (float, optional) – The truncation error to use when compressing the double layer tensor network.
site_tags (sequence of str, optional) – The tags to use to group and order the tensors from
tn
. If not given, usestn.site_tags
. The tensor network built will have one tensor per site, in the order given bysite_tags
.normalize (bool, optional) – Whether to normalize the final tensor network, making use of the fact that the output tensor network is in right canonical form.
cutoff_mode ({"rsum1", "rel", ...}, optional) – The mode to use when truncating the singular values of the decomposed tensors. See
tensor_split()
. Note for the density matrix method the default ‘rsum1’ mode acts like ‘rsum2’ for the direct method due to truncating in the squared space.permute_arrays (bool or str, optional) – Whether to permute the array indices of the final tensor network into canonical order. If
True
will use the default order, otherwise if a string this specifies a custom order.optimize (str, optional) – The contraction path optimizer to use.
sweep_reverse (bool, optional) – Whether to sweep in the reverse direction, resulting in a left canonical form instead of right canonical.
canonize (bool, optional) – Dummy argument to match the signature of other compression methods.
equalize_norms (bool or float, optional) – Whether to equalize the norms of the tensors after compression. If an explicit value is give, then the norms will be set to that value, and the overall scaling factor will be accumulated into .exponent.
inplace (bool, optional) – Whether to perform the compression inplace or not.
compress_opts – Supplied to
tensor_split()
.
 Returns:
The compressed tensor network, with canonical center at
site_tags[0]
(‘right canonical’ form) orsite_tags[1]
(‘left canonical’ form) ifsweep_reverse
. Return type:
 quimb.tensor.tensor_1d_compress.tensor_network_1d_compress_zipup(tn, max_bond=None, cutoff=1e10, site_tags=None, canonize=True, normalize=False, cutoff_mode='rsum2', permute_arrays=True, optimize='autohq', sweep_reverse=False, equalize_norms=False, inplace=False, **compress_opts)[source]¶
Compress a 1Dlike tensor network using the ‘zipup’ algorithm due to ‘Minimally Entangled Typical Thermal State Algorithms’, E.M. Stoudenmire & Steven R. White (https://arxiv.org/abs/1002.1305). The returned tensor network will have one tensor per site, in the order given by
site_tags
, with canonical center atsite_tags[0]
(‘right’ canonical form).The zipup algorithm scales better than the direct and density matrix methods when multiple tensors are present at each site (such as MPOMPS multiplication), but is less accurate due to the compressions taking place in an only pseudocanonical gauge. It generally also only makes sense in the fixed bond dimension case, as opposed to relying on a specific cutoff only.
 Parameters:
tn (TensorNetwork) – The tensor network to compress. Every tensor should have exactly one of the site tags. Each site can have multiple tensors and output indices.
max_bond (int) – The maximum bond dimension to compress to.
cutoff (float, optional) – A dynamic threshold for discarding singular values when compressing.
site_tags (sequence of str, optional) – The tags to use to group and order the tensors from
tn
. If not given, usestn.site_tags
. The tensor network built will have one tensor per site, in the order given bysite_tags
.canonize (bool, optional) – Whether to pseudo canonicalize the initial tensor network.
normalize (bool, optional) – Whether to normalize the final tensor network, making use of the fact that the output tensor network is in right canonical form.
cutoff_mode ({"rsum2", "rel", ...}, optional) – The mode to use when truncating the singular values of the decomposed tensors. See
tensor_split()
.permute_arrays (bool or str, optional) – Whether to permute the array indices of the final tensor network into canonical order. If
True
will use the default order, otherwise if a string this specifies a custom order.optimize (str, optional) – The contraction path optimizer to use.
sweep_reverse (bool, optional) – Whether to sweep in the reverse direction, resulting in a left canonical form instead of right canonical.
equalize_norms (bool or float, optional) – Whether to equalize the norms of the tensors after compression. If an explicit value is give, then the norms will be set to that value, and the overall scaling factor will be accumulated into .exponent.
inplace (bool, optional) – Whether to perform the compression inplace or not.
compress_opts – Supplied to
tensor_split()
.
 Returns:
The compressed tensor network, with canonical center at
site_tags[0]
(‘right canonical’ form) orsite_tags[1]
(‘left canonical’ form) ifsweep_reverse
. Return type:
 quimb.tensor.tensor_1d_compress.tensor_network_1d_compress_zipup_first(tn, max_bond=None, max_bond_zipup=None, cutoff=1e10, cutoff_zipup=None, site_tags=None, canonize=True, normalize=False, cutoff_mode='rsum2', permute_arrays=True, optimize='autohq', sweep_reverse=False, equalize_norms=False, inplace=False, **compress_opts)[source]¶
Compress this 1Dlike tensor network using the ‘zipup first’ algorithm, that is, first compressing the tensor network to a larger bond dimension using the ‘zipup’ algorithm, then compressing to the desired bond dimension using a direct sweep.
Depending on the value of
max_bond
andmax_bond_zipup
, this can be scale better than the direct and density matrix methods, but reach close to the same accuracy. As with the ‘zipup’ method, there is no advantage unless there are multiple tensors per site, and it generally only makes sense in the fixed bond dimension case, as opposed to relying on a specific cutoff only. Parameters:
tn (TensorNetwork) – The tensor network to compress. Every tensor should have exactly one of the site tags. Each site can have multiple tensors and output indices.
max_bond (int) – The final maximum bond dimension to compress to.
max_bond_zipup (int, optional) – The intermediate maximum bond dimension to compress to using the ‘zipup’ algorithm. If not given and max_bond is, this is set as twice the target bond dimension,
2 * max_bond
.cutoff (float, optional) – A dynamic threshold for discarding singular values when compressing.
cutoff_zipup (float, optional) – A dynamic threshold for discarding singular values when compressing to the intermediate bond dimension using the ‘zipup’ algorithm. If not given, this is set to the same as
cutoff
if a maximum bond is given, elsecutoff / 10
.site_tags (sequence of str, optional) – The tags to use to group and order the tensors from
tn
. If not given, usestn.site_tags
. The tensor network built will have one tensor per site, in the order given bysite_tags
.canonize (bool, optional) – Whether to pseudo canonicalize the initial tensor network.
normalize (bool, optional) – Whether to normalize the final tensor network, making use of the fact that the output tensor network is in right canonical form.
cutoff_mode ({"rsum2", "rel", ...}, optional) – The mode to use when truncating the singular values of the decomposed tensors. See
tensor_split()
.permute_arrays (bool or str, optional) – Whether to permute the array indices of the final tensor network into canonical order. If
True
will use the default order, otherwise if a string this specifies a custom order.optimize (str, optional) – The contraction path optimizer to use.
sweep_reverse (bool, optional) – Whether to sweep in the reverse direction, resulting in a left canonical form instead of right canonical.
equalize_norms (bool or float, optional) – Whether to equalize the norms of the tensors after compression. If an explicit value is give, then the norms will be set to that value, and the overall scaling factor will be accumulated into .exponent.
inplace (bool, optional) – Whether to perform the compression inplace or not.
compress_opts – Supplied to
tensor_split()
.
 Returns:
The compressed tensor network, with canonical center at
site_tags[0]
(‘right canonical’ form) orsite_tags[1]
(‘left canonical’ form) ifsweep_reverse
. Return type:
 quimb.tensor.tensor_1d_compress._tn1d_fit_sum_sweep_1site(tn_fit, tn_overlaps, site_tags, max_bond=None, cutoff=0.0, envs=None, prepare=True, reverse=False, compute_tdiff=True, optimize='autohq')[source]¶
Core sweep of the 1site 1D fit algorithm.
 quimb.tensor.tensor_1d_compress._tn1d_fit_sum_sweep_2site(tn_fit, tn_overlaps, site_tags, max_bond=None, cutoff=1e10, envs=None, prepare=True, reverse=False, optimize='autohq', compute_tdiff=True, **compress_opts)[source]¶
Core sweep of the 2site 1D fit algorithm.
 quimb.tensor.tensor_1d_compress.tensor_network_1d_compress_fit(tns, max_bond=None, cutoff=None, tn_fit=None, bsz='auto', initial_bond_dim=8, max_iterations=10, tol=0.0, site_tags=None, cutoff_mode='rsum2', sweep_sequence='RL', normalize=False, permute_arrays=True, optimize='autohq', canonize=True, sweep_reverse=False, equalize_norms=False, inplace_fit=False, inplace=False, progbar=False, **compress_opts)[source]¶
Compress any 1Dlike (can have multiple tensors per site) tensor network or sum of tensor networks to an exactly 1D (one tensor per site) tensor network of bond dimension max_bond using the 1site or 2site variational fitting (or ‘DMRGstyle’) method. The tensor network(s) can have arbitrary inner and outer structure.
This method has the lowest scaling of the standard 1D compression methods and can also provide the most accurate compression, but the actual speed and accuracy depend on the number of iterations required and initial guess, making it a more ‘handson’ method.
It’s also the only method to support fitting to a sum of tensor networks directly, rather than having to forming the explicitly summed TN first.
 Parameters:
tns (TensorNetwork or Sequence[TensorNetwork]) – The tensor network or tensor networks to compress. Each tensor network should have the same outer index structure, and within each tensor network every tensor should have exactly one of the site tags.
max_bond (int) – The maximum bond dimension to compress to. If not given, this is set as the maximum bond dimension of the initial guess tensor network, if any, else infinite for
bsz=2
.cutoff (float, optional) – A dynamic threshold for discarding singular values when compressing. This is only relevant for the 2site sweeping algorithm (
bsz=2
), where it defaults to 1e10.tn_fit (TensorNetwork, dict, or str, optional) – An initial guess for the compressed tensor network. It should matching outer indices and site tags with
tn
. If a dict, this is assumed to be options to supply to tensor_network_1d_compress to construct the initial guess, inheriting various defaults like initial_bond_dim. If a string, e.g."zipup"
, this is shorthand for that compression method with default settings. If not given, a random 1D tensor network will be used.bsz ({"auto", 1, 2}, optional) – The size of the block to optimize while sweeping. If
"auto"
, this will be inferred from the value ofmax_bond
andcutoff
.initial_bond_dim (int, optional) – The initial bond dimension to use when creating the initial guess. This is only relevant if
tn_fit
is not given. For each sweep the allowed bond dimension is doubled, up tomax_bond
. For 1site this occurs via explicit bond expansion, while for 2site it occurs during the 2site tensor decomposition.max_iterations (int, optional) – The maximum number of variational sweeps to perform.
tol (float, optional) – The convergence tolerance, in terms of local tensor distance normalized. If zero, there will be exactly
max_iterations
sweeps.site_tags (sequence of str, optional) – The tags to use to group and order the tensors from
tn
. If not given, usestn.site_tags
. The tensor network built will have one tensor per site, in the order given bysite_tags
.cutoff_mode ({"rsum2", "rel", ...}, optional) – The mode to use when truncating the singular values of the decomposed tensors. See
tensor_split()
, if using the 2site sweeping algorithm.sweep_sequence (str, optional) – The sequence of sweeps to perform, e.g.
"LR"
means first sweep left to right, then right to left. The sequence is cycled.normalize (bool, optional) – Whether to normalize the final tensor network, making use of the fact that the output tensor network is in left or right canonical form.
permute_arrays (bool or str, optional) – Whether to permute the array indices of the final tensor network into canonical order. If
True
will use the default order, otherwise if a string this specifies a custom order.optimize (str, optional) – The contraction path optimizer to use.
canonize (bool, optional) – Dummy argument to match the signature of other compression methods.
sweep_reverse (bool, optional) – Whether to sweep in the reverse direction, swapping whether the final tensor network is in right or left canonical form, which also depends on the last sweep direction.
equalize_norms (bool or float, optional) – Whether to equalize the norms of the tensors after compression. If an explicit value is give, then the norms will be set to that value, and the overall scaling factor will be accumulated into .exponent.
inplace_fit (bool, optional) – Whether to perform the compression inplace on the initial guess tensor network,
tn_fit
, if supplied.inplace (bool, optional) – Whether to perform the compression inplace on the target tensor network supplied, or
tns[0]
if a sequence to sum is supplied.progbar (bool, optional) – Whether to show a progress bar. Note the progress bar shows the maximum change of any single tensor norm, not the global change in norm or truncation error.
compress_opts – Supplied to
tensor_split()
, if using the 2site sweeping algorithm.
 Returns:
The compressed tensor network. Depending on
sweep_reverse
and the last sweep direction, the canonical center will be at either L:site_tags[0]
or R:site_tags[1]
, or the opposite ifsweep_reverse
. Return type:
 quimb.tensor.tensor_1d_compress.tensor_network_1d_compress_fit_guess(tn, guess, max_bond=None, cutoff=1e10, cutoff_fit=0.0, bsz=1, max_iterations=8, canonize=True, **kwargs)[source]¶
Compress any 1Dlike (can have multiple tensors per site) tensor network to an exactly 1D (one tensor per site) tensor network of bond dimension max_bond using by default 1site variational fitting (or ‘DMRGstyle’) method starting with a nonrandom guess tensor network, e.g. from the cheap zipup or projector methods.
 quimb.tensor.tensor_1d_compress.tensor_network_1d_compress_fit_zipup¶
 quimb.tensor.tensor_1d_compress.tensor_network_1d_compress_fit_projector¶
 quimb.tensor.tensor_1d_compress._TN1D_COMPRESS_METHODS¶
 quimb.tensor.tensor_1d_compress.tensor_network_1d_compress(tn, max_bond=None, cutoff=1e10, method='dm', site_tags=None, canonize=True, permute_arrays=True, optimize='autohq', sweep_reverse=False, equalize_norms=False, compress_opts=None, inplace=False, **kwargs)[source]¶
Compress a 1Dlike tensor network using the specified method.
 Parameters:
tn (TensorNetwork) – The tensor network to compress. Every tensor should have exactly one of the site tags. Each site can have multiple tensors and output indices.
max_bond (int) – The maximum bond dimension to compress to.
cutoff (float, optional) – A dynamic threshold for discarding singular values when compressing.
method ({"direct", "dm", "zipup", "zipupfirst", "fit", "projector", ...}) – The compression method to use.
site_tags (sequence of str, optional) – The tags to use to group and order the tensors from
tn
. If not given, usestn.site_tags
. The tensor network built will have one tensor per site, in the order given bysite_tags
.canonize (bool, optional) – Whether to perform canonicalization, pseudo or otherwise depending on the method, before compressing. Ignored for
method='dm'
andmethod='fit'
.permute_arrays (bool or str, optional) – Whether to permute the array indices of the final tensor network into canonical order. If
True
will use the default order, otherwise if a string this specifies a custom order.optimize (str, optional) – The contraction path optimizer to use.
sweep_reverse (bool, optional) – Whether to sweep in the reverse direction, resulting in a left canonical form instead of right canonical (for the fit method, this also depends on the last sweep direction).
equalize_norms (bool or float, optional) – Whether to equalize the norms of the tensors after compression. If an explicit value is give, then the norms will be set to that value, and the overall scaling factor will be accumulated into .exponent.
inplace (bool, optional) – Whether to perform the compression inplace.
kwargs – Supplied to the chosen compression method.
 Return type:
 quimb.tensor.tensor_1d_compress.mps_gate_with_mpo_lazy(mps, mpo, inplace=False)[source]¶
Apply an MPO to an MPS lazily, i.e. nothing is contracted, but the new TN object has the same outer indices as the original MPS.
 quimb.tensor.tensor_1d_compress.mps_gate_with_mpo_direct(mps, mpo, max_bond=None, cutoff=1e10, inplace=False, **compress_opts)[source]¶
Apply an MPO to an MPS using the boundary compression method, that is, explicitly contracting sitewise to form a MPSlike TN, canonicalizing in one direction, then compressing in the other. This has the same scaling as the density matrix (dm) method, but a larger prefactor. It can still be faster for small bond dimensions however, and is potentially higher precision since it works in the space of singular values directly rather than singular values squared. It is not quite optimal in terms of error due to the compounding errors of the SVDs.
 Parameters:
mps (MatrixProductState) – The MPS to gate.
mpo (MatrixProductOperator) – The MPO to gate with.
max_bond (int) – The maximum bond dimension to compress to.
cutoff (float, optional) – A dynamic threshold for discarding singular values when compressing.
compress_opts – Supplied to
tensor_split()
.
 quimb.tensor.tensor_1d_compress.mps_gate_with_mpo_dm(mps, mpo, max_bond=None, cutoff=1e10, inplace=False, **compress_opts)[source]¶
Gate this MPS with an MPO, using the density matrix compression method.
 Parameters:
mps (MatrixProductState) – The MPS to gate.
mpo (MatrixProductOperator) – The MPO to gate with.
max_bond (int, optional) – The maximum bond dimension to keep when compressing the double layer tensor network, if any.
cutoff (float, optional) – The truncation error to use when compressing the double layer tensor network, if any.
compress_opts – Supplied to
tensor_split()
.
 quimb.tensor.tensor_1d_compress.mps_gate_with_mpo_zipup(mps, mpo, max_bond=None, cutoff=1e10, canonize=True, optimize='autohq', **compress_opts)[source]¶
Apply an MPO to an MPS using the ‘zipup’ algorithm due to ‘Minimally Entangled Typical Thermal State Algorithms’, E.M. Stoudenmire & Steven R. White (https://arxiv.org/abs/1002.1305).
 Parameters:
mps (MatrixProductState) – The MPS to gate.
mpo (MatrixProductOperator) – The MPO to gate with.
max_bond (int) – The maximum bond dimension to compress to.
cutoff (float, optional) – A dynamic threshold for discarding singular values when compressing.
site_tags (sequence of str, optional) – The tags to use to group and order the tensors from
tn
. If not given, usestn.site_tags
. The tensor network built will have one tensor per site, in the order given bysite_tags
.canonize (bool, optional) – Whether to pseudo canonicalize the initial tensor network.
normalize (bool, optional) – Whether to normalize the final tensor network, making use of the fact that the output tensor network is in right canonical form.
permute_arrays (bool or str, optional) – Whether to permute the array indices of the final tensor network into canonical order. If
True
will use the default order, otherwise if a string this specifies a custom order.optimize (str, optional) – The contraction path optimizer to use.
compress_opts – Supplied to
tensor_split()
.
 Returns:
The compressed MPS, in right canonical form.
 Return type:
 quimb.tensor.tensor_1d_compress.mps_gate_with_mpo_zipup_first(mps, mpo, max_bond=None, max_bond_zipup=None, cutoff=1e10, cutoff_zipup=None, canonize=True, optimize='autohq', **compress_opts)[source]¶
Apply an MPO to an MPS by first using the zipup method with a larger bond dimension, then doing a regular compression sweep to the target final bond dimension. This avoids forming an intermediate MPS with bond dimension
mps.max_bond() * mpo.max_bond()
. Parameters:
mps (MatrixProductState) – The MPS to gate.
mpo (MatrixProductOperator) – The MPO to gate with.
max_bond (int) – The target final bond dimension.
max_bond_zipup (int, optional) – The maximum bond dimension to use when zipup compressing the double layer tensor network. If not given, defaults to
2 * max_bond
. Needs to be smaller thanmpo.max_bond()
for any savings.cutoff (float, optional) – The truncation error to use when performing the final regular compression sweep.
cutoff_zipup (float, optional) – The truncation error to use when performing the zipup compression.
canonize (bool, optional) – Whether to pseudo canonicalize the initial tensor network.
optimize (str, optional) – The contraction path optimizer to use.
compress_opts – Supplied to
tensor_split()
(both the zipup and final sweep).
 Returns:
The compressed MPS, in right canonical form.
 Return type:
 quimb.tensor.tensor_1d_compress.mps_gate_with_mpo_fit(mps, mpo, max_bond, **kwargs)[source]¶
Gate an MPS with an MPO using the variational fitting or DMRGstyle method.
 Parameters:
mps (MatrixProductState) – The MPS to gate.
mpo (MatrixProductOperator) – The MPO to gate with.
max_bond (int) – The maximum bond dimension to compress to.
 Returns:
The gated MPS.
 Return type:
 quimb.tensor.tensor_1d_compress.mps_gate_with_mpo_autofit(self, mpo, max_bond, cutoff=0.0, init_guess=None, **fit_opts)[source]¶
Fit a MPS to a MPO applied to an MPS using geometry generic versions of either ALS or autodiff. This is usually much less efficient that using the 1D specific methods.
Some nice alternatives to the default fit_opts:
method=”autodiff”
method=”als”, solver=”lstsq”
 quimb.tensor.tensor_1d_compress.mps_gate_with_mpo_projector(self, mpo, max_bond, cutoff=1e10, canonize=True, canonize_opts=None, inplace=False, **compress_opts)[source]¶
Apply an MPO to an MPS using local projectors, in the style of CTMRG or HOTRG, without using information beyond the neighboring 4 tensors.