quimb.tensor.tensor_arbgeom_compress

Generic methods for compressing arbitrary geometry tensor networks, where the tensor network can locally have arbitrary structure and outer indices.

  • [x] projector

  • [x] l2bp

  • [x] local early

  • [x] local late

  • [x] superorthogonal

Attributes

Functions

tensor_network_ag_compress_projector(tn[, max_bond, ...])

Compress an arbtrary geometry tensor network, with potentially multiple

tensor_network_ag_compress_local_early(tn[, max_bond, ...])

Compress an arbtrary geometry tensor network, with potentially multiple

tensor_network_ag_compress_local_late(tn[, max_bond, ...])

Compress an arbtrary geometry tensor network, with potentially multiple

tensor_network_ag_compress_superorthogonal(tn[, ...])

Compress an arbtrary geometry tensor network, with potentially multiple

tensor_network_ag_compress_l2bp(tn[, max_bond, ...])

Compress an arbitrary geometry tensor network, with potentially multiple

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

Compress an arbitrary geometry tensor network, with potentially multiple

Module Contents

quimb.tensor.tensor_arbgeom_compress.tensor_network_ag_compress_projector(tn, max_bond=None, cutoff=1e-10, site_tags=None, canonize=True, canonize_opts=None, lazy=False, optimize='auto-hq', equalize_norms=False, inplace=False, **compress_opts)[source]

Compress an arbtrary geometry tensor network, with potentially multiple tensors per site, using locally computed projectors.

Very loosely, this is like a generalization HOTRG.

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 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 pseudo canonicalize the initial tensor network.

  • canonize_opts – Supplied to gauge_all().

  • lazy (bool, optional) – Whether to leave the computed projectors uncontracted, default: False.

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

  • compress_opts – Supplied to tensor_split().

Return type:

TensorNetwork

quimb.tensor.tensor_arbgeom_compress.tensor_network_ag_compress_local_early(tn, max_bond=None, cutoff=1e-10, site_tags=None, canonize=True, tree_gauge_distance=None, canonize_distance=None, canonize_after_distance=None, mode='auto', optimize='auto-hq', equalize_norms=False, inplace=False, **compress_opts)[source]

Compress an arbtrary geometry tensor network, with potentially multiple tensors per site, using explicit contraction followed by immediate (‘early’) compression. In other words, contractions are interleaved with compressions.

Very loosely, this is like a generalization of the ‘zip-up’ algorithm in 1D, but for arbitrary geometry.

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 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 locally gauge before each compression, defaults to True.

  • tree_gauge_distance (int, optional) – The distance to locally gauge to before each compression. Defaults to 3.

  • canonize_distance (int, optional) – The distance to canonize to before each compression, by default this is set by tree_gauge_distance.

  • canonize_after_distance (int, optional) – The distance to canonize to after each compression, by default this is set by tree_gauge_distance, depending on mode.

  • mode ({'auto', 'basic', 'virtual-tree', ...}, optional) – The mode to use for the local gauging. If ‘auto’ will default to virtual tree gauging, or basic if tree_gauge_distance is 0.

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

  • compress_opts – Supplied to compress_between().

Return type:

TensorNetwork

quimb.tensor.tensor_arbgeom_compress.tensor_network_ag_compress_local_late(tn, max_bond=None, cutoff=1e-10, site_tags=None, canonize=True, tree_gauge_distance=None, canonize_distance=None, canonize_after_distance=None, mode='auto', optimize='auto-hq', equalize_norms=False, inplace=False, **compress_opts)[source]

Compress an arbtrary geometry tensor network, with potentially multiple tensors per site, by explicitly contracting all sites first and then (‘late’) locally compressing. In other words, all contractions happen, then all compressions happen.

Very loosely, this is like a generalization of the ‘direct’ algorithm in 1D, but for arbitrary geometry.

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 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 locally gauge before each compression, defaults to True.

  • tree_gauge_distance (int, optional) – The distance to locally gauge to before each compression. Defaults to 3.

  • canonize_distance (int, optional) – The distance to canonize to before each compression, by default this is set by tree_gauge_distance.

  • canonize_after_distance (int, optional) – The distance to canonize to after each compression, by default this is set by tree_gauge_distance, depending on mode.

  • mode ({'auto', 'basic', 'virtual-tree', ...}, optional) – The mode to use for the local gauging. If ‘auto’ will default to virtual tree gauging, or basic if tree_gauge_distance is 0.

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

  • compress_opts – Supplied to compress_between().

Return type:

TensorNetwork

quimb.tensor.tensor_arbgeom_compress.tensor_network_ag_compress_superorthogonal(tn, max_bond=None, cutoff=1e-10, site_tags=None, canonize=True, optimize='auto-hq', equalize_norms=False, inplace=False, **compress_opts)[source]

Compress an arbtrary geometry tensor network, with potentially multiple tensors per site, using the ‘superorthogonal’ / ‘Vidal’ / quasi-canonical / ‘simple update’ gauge for compression. This is the same gauge as used in L2BP, but the intermediate tensor network is explicitly constructed.

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 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 locally gauge before each compression, defaults to True.

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

  • compress_opts – Supplied to compress_all_simple().

Return type:

TensorNetwork

quimb.tensor.tensor_arbgeom_compress.tensor_network_ag_compress_l2bp(tn, max_bond=None, cutoff=1e-10, site_tags=None, canonize=True, damping=0.0, local_convergence=True, update='sequential', optimize='auto-hq', equalize_norms=False, inplace=False, **compress_opts)[source]

Compress an arbitrary geometry tensor network, with potentially multiple tensors per site, using lazy 2-norm belief propagation.

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 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 locally gauge before each compression, defaults to True.

  • damping (float, optional) – How much to dampen message updates, to help convergence, defaults to 0.

  • local_convergence (bool, optional) – Whether to use local convergence criteria, defaults to True.

  • update ({'parallel', 'sequential'}, optional) – Whether to update all messages in parallel or sequentially, defaults to ‘parallel’.

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

  • compress_opts – Supplied to compress_l2bp().

Return type:

TensorNetwork

quimb.tensor.tensor_arbgeom_compress._TNAG_COMPRESS_METHODS
quimb.tensor.tensor_arbgeom_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)[source]

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.