compress
An implementation of the Successive Randomized Compression (SRC) algorithm.
This module includes the functions used for compression of the following types:
- MPO randomized compression.
- MPS randomized compression.
Functions#
compress #
compress(
tensor: Sequence[NDArray],
chi_out: int,
*,
cutoff: float = 0.0,
dtype: type = np.float64,
seed: int | None = None,
device: str = "cpu"
) -> list[NDArray]
Applies the Successive Randomized Compression (SRC) algorithm.
Tensor trains are plain lists of per-site arrays following the default
quimb index ordering; see src_method._tensor_train for the layout.
The train type is inferred from the rank of the first site tensor:
- MPS:
tensoris an MPS. Results in an MPS. - MPO:
tensoris an MPO. Results in an MPO.
| PARAMETER | DESCRIPTION |
|---|---|
tensor
|
The site arrays of the tensor network to compress (MPS or MPO).
TYPE:
|
chi_out
|
The desired maximum bond dimension of the output tensor network.
TYPE:
|
cutoff
|
Relative singular-value cutoff for adaptive bond truncation.
When positive, bonds are trimmed to their effective rank by
discarding singular values below
TYPE:
|
dtype
|
The data type for the computation.
TYPE:
|
seed
|
An optional seed for the random number generator.
TYPE:
|
device
|
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[NDArray]
|
The site arrays of the compressed tensor network (MPS or MPO). |
| RAISES | DESCRIPTION |
|---|---|
TypeError
|
If the input tensor type is unsupported. |
ValueError
|
If a sub-three-site train is not exactly two sites, or if
|
ImportError
|
If |
Source code in src/src_method/compress.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |