quimb.tensor.tensor_2d_compress

Attributes

Functions

possibly_permute_(tn, permute_arrays)

tensor_network_ag_compress(tn, max_bond[, cutoff, ...])

Compress an arbitrary geometry tensor network, with potentially multiple

tensor_network_2d_compress(tn[, max_bond, cutoff, ...])

Compress a 2D-like tensor network using the specified method.

Module Contents

quimb.tensor.tensor_2d_compress.possibly_permute_(tn, permute_arrays)
quimb.tensor.tensor_2d_compress.tensor_network_ag_compress(tn, max_bond, cutoff=1e-10, method='local-early', site_tags=None, canonize=True, optimize='auto-hq', equalize_norms=False, inplace=False, **kwargs)

Compress an arbitrary geometry tensor network, with potentially multiple tensors per site.

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 ({'local-early', 'local-late', 'projector', 'superorthogonal', 'l2bp'}, optional) –

    The compression method to use:

  • site_tags (sequence of str, optional) – The tags to use to group the tensors from tn. If not given, uses tn.site_tags. The tensor network built will have one tensor per site.

  • canonize (bool, optional) – Whether to perform canonicalization, pseudo or otherwise depending on the method, before compressing.

  • optimize (str, optional) – The contraction path optimizer to use.

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

quimb.tensor.tensor_2d_compress._TN2D_COMPRESS_METHODS
quimb.tensor.tensor_2d_compress.tensor_network_2d_compress(tn, max_bond=None, cutoff=1e-10, method='local-early', site_tags=None, canonize=True, permute_arrays=True, optimize='auto-hq', equalize_norms=False, compress_opts=None, inplace=False, **kwargs)

Compress a 2D-like 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", "zipup-first", "fit", "projector"}) – The compression method to use.

  • site_tags (sequence of sequence of str, optional) – The tags to use to group and order the tensors from tn. If not given, uses tn.site_tags. The tensor network built will have one tensor per site, in the order given by site_tags.

  • canonize (bool, optional) – Whether to perform canonicalization, pseudo or otherwise depending on the method, before compressing. Ignored for method='dm' and method='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).

  • inplace (bool, optional) – Whether to perform the compression inplace.

  • kwargs – Supplied to the chosen compression method.

Return type:

TensorNetwork