Commit a7d2bbb
MatrixAlgebraKit decompositions (#230)
This PR is part of a large set of changes that alters the backend from `TensorKit.MatrixAlgebra` to `MatrixAlgebraKit` for the factorizations.
Concretely, this is achieved through a new submodule `TensorKit.Factorizations` that implements most of the `MatrixAlgebraKit` interface, along with some overloads and reimplementations to be somewhat backwards compatible.
## New features
- `foreachblock(f, t::AbstractTensorMap...)` is a new function that is meant to provide a uniform interface to iterate through the blocks of a collection of tensors. The main purpose is to centralize this concept to easily add multithreading over the blocks. In order to break up this PR the actual multithreading implementation is left for a follow-up PR.
- Truncated eigenvalue decompositions through `eig_trunc` and `eigh_trunc`
- The factorizations can now swap out their backends to select alternate algorithms or implementations.
- `ominus` and its unicode variant can now be used to obtain the orthogonal complement of a space, ie if `W = oplus(V1, V2)`, `V2 = ominus(W, V1)`.
## Breaking changes
- The `OrthogonalFactorization` structs have been removed, but their constructors are deprecated to obtain equivalent `MatrixAlgebraKit` algorithm structs.
- The factorization functions `leftorth`, `rightorth`, `tsvd`, `eig`, `eigh` have been deprecated in favor of the MatrixAlgebraKit variants.
- The truncation strategies are now directly inherited from `MatrixAlgebraKit`. This means `truncdim` is replaced by `truncrank`, `trunctol` is replaced by `truncbelow`, and there are deprecation warnings for the old functions.
- The `left_orth` and `right_orth` functions will now always output tensors with a single space connecting them, which was not the case for `Polar` decompositions previously. To retrieve the old behavior with `isposdef` `R` factors (equal domain and codomain instead of isomorphic), the functions `left_polar` and `right_polar` can be used.
- The `left_orth` and `right_orth` functions will now always have a connecting space with `isdual=false`. This is different from the previous behavior where some `N,1` or `1,N` tensors kept the `isdual` flag on the connecting leg.
- There is no more direct call to both permute and factorize in one go. This is mainly because this is incompatible with the distinction between `permute` and `braid`.
---------
Co-authored-by: Katharine Hyatt <[email protected]>
Co-authored-by: Katharine Hyatt <[email protected]>
Co-authored-by: Jutho <[email protected]>1 parent ec78a85 commit a7d2bbb
File tree
35 files changed
+2587
-2485
lines changed- docs
- src/lib
- ext/TensorKitChainRulesCoreExt
- src
- auxiliary
- factorizations
- spaces
- tensors
- test
35 files changed
+2587
-2485
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
| 13 | + | |
11 | 14 | | |
12 | 15 | | |
13 | 16 | | |
| |||
30 | 33 | | |
31 | 34 | | |
32 | 35 | | |
| 36 | + | |
| 37 | + | |
33 | 38 | | |
34 | 39 | | |
| 40 | + | |
35 | 41 | | |
36 | 42 | | |
37 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | | - | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
4 | 10 | | |
5 | 11 | | |
6 | 12 | | |
| |||
15 | 21 | | |
16 | 22 | | |
17 | 23 | | |
18 | | - | |
| 24 | + | |
| 25 | + | |
19 | 26 | | |
20 | 27 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| 93 | + | |
93 | 94 | | |
94 | 95 | | |
95 | 96 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
221 | 223 | | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
| 224 | + | |
233 | 225 | | |
234 | | - | |
235 | | - | |
236 | | - | |
| 226 | + | |
| 227 | + | |
237 | 228 | | |
| 229 | + | |
| 230 | + | |
238 | 231 | | |
239 | | - | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | | - | |
19 | 19 | | |
20 | 20 | | |
0 commit comments