:py:mod:`quimb.tensor.tensor_2d_compress` ========================================= .. py:module:: quimb.tensor.tensor_2d_compress Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: quimb.tensor.tensor_2d_compress.tensor_network_2d_compress Attributes ~~~~~~~~~~ .. autoapisummary:: quimb.tensor.tensor_2d_compress._TN2D_COMPRESS_METHODS .. py:data:: _TN2D_COMPRESS_METHODS .. py:function:: 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. :param tn: The tensor network to compress. Every tensor should have exactly one of the site tags. Each site can have multiple tensors and output indices. :type tn: TensorNetwork :param max_bond: The maximum bond dimension to compress to. :type max_bond: int :param cutoff: A dynamic threshold for discarding singular values when compressing. :type cutoff: float, optional :param method: The compression method to use. :type method: {"direct", "dm", "zipup", "zipup-first", "fit", "projector"} :param site_tags: 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``. :type site_tags: sequence of sequence of str, optional :param canonize: Whether to perform canonicalization, pseudo or otherwise depending on the method, before compressing. Ignored for ``method='dm'`` and ``method='fit'``. :type canonize: bool, optional :param permute_arrays: 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. :type permute_arrays: bool or str, optional :param optimize: The contraction path optimizer to use. :type optimize: str, optional :param sweep_reverse: 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). :type sweep_reverse: bool, optional :param inplace: Whether to perform the compression inplace. :type inplace: bool, optional :param kwargs: Supplied to the chosen compression method. :rtype: TensorNetwork