apply
An implementation of the Successive Randomized Compression (SRC) algorithm.
This module includes the functions used for contraction-compressions of the following types:
- MPO-MPS randomized contraction-compression.
- MPO-MPO randomized contraction-compression.
Functions#
apply #
apply(
left_tensor: Sequence[NDArray],
right_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, and
dispatch follows:
- MPO-MPS:
left_tensoris an MPO andright_tensoris an MPS. Results in an MPS. - MPO-MPO: both
left_tensorandright_tensorare MPOs. Results in an MPO.
| PARAMETER | DESCRIPTION |
|---|---|
left_tensor
|
The site arrays of the left tensor network (MPO).
TYPE:
|
right_tensor
|
The site arrays of the right tensor network (MPO or MPS).
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 combination of input tensor types is unsupported. |
ValueError
|
If the two trains differ in length, if a sub-three-site
train is not exactly two sites, or if |
ImportError
|
If |
Source code in src/src_method/apply.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 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | |