Skip to content

Commit def9a5e

Browse files
committed
Merge branch 'main' of https://github.com/Jutho/TensorKit.jl into bd/multifusion
2 parents 50e408d + bbeb8e5 commit def9a5e

File tree

97 files changed

+6032
-5233
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+6032
-5233
lines changed

.JuliaFormatter.toml

Lines changed: 0 additions & 1 deletion
This file was deleted.

.github/workflows/CI.yml

Lines changed: 37 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,71 @@
11
name: CI
2+
23
on:
34
push:
45
branches:
5-
- 'master'
66
- 'main'
77
- 'release-'
8+
89
tags: '*'
10+
11+
paths-ignore:
12+
- 'docs/**'
913
pull_request:
1014
workflow_dispatch:
1115

1216
concurrency:
1317
group: ${{ github.workflow }}-${{ github.ref }}
14-
cancel-in-progress: true
18+
# Cancel intermediate builds: only if it is a pull request build.
19+
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
1520

1621
jobs:
1722
test:
18-
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
19-
runs-on: ${{ matrix.os }}
2023
strategy:
2124
fail-fast: false
2225
matrix:
2326
version:
24-
- '1'
2527
- 'lts'
28+
- '1'
29+
group:
30+
- symmetries
31+
- tensors
32+
- other
33+
- autodiff
2634
os:
2735
- ubuntu-latest
2836
- macOS-latest
2937
- windows-latest
30-
steps:
31-
- uses: actions/checkout@v5
32-
- uses: julia-actions/setup-julia@v2
33-
with:
34-
version: ${{ matrix.version }}
35-
- uses: julia-actions/cache@v2
36-
- uses: julia-actions/julia-buildpkg@latest
37-
- uses: julia-actions/julia-runtest@latest
38-
env:
39-
JULIA_NUM_THREADS: 4
40-
- uses: julia-actions/julia-processcoverage@v1
41-
- uses: codecov/codecov-action@v5
42-
env:
43-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
44-
with:
45-
files: lcov.info
38+
uses: "QuantumKitHub/QuantumKitHubActions/.github/workflows/Tests.yml@main"
39+
with:
40+
group: "${{ matrix.group }}"
41+
julia-version: "${{ matrix.version }}"
42+
os: "${{ matrix.os }}"
43+
nthreads: 4
44+
timeout-minutes: 120
45+
secrets:
46+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
47+
4648
test-nightly:
4749
needs: test
48-
name: Julia nightly - ${{ matrix.os }} - ${{ matrix.arch }}
49-
runs-on: ${{ matrix.os }}
5050
strategy:
5151
matrix:
5252
version:
5353
- 'nightly'
54+
group:
55+
- symmetries
56+
- tensors
57+
- other
58+
- autodiff
5459
os:
5560
- ubuntu-latest
5661
- macOS-latest
5762
- windows-latest
58-
continue-on-error: true
59-
steps:
60-
- uses: actions/checkout@v5
61-
- uses: julia-actions/setup-julia@v2
62-
with:
63-
version: ${{ matrix.version }}
64-
- uses: julia-actions/cache@v2
65-
- uses: julia-actions/julia-buildpkg@latest
66-
- uses: julia-actions/julia-runtest@latest
67-
env:
68-
JULIA_NUM_THREADS: 4
63+
uses: "QuantumKitHub/QuantumKitHubActions/.github/workflows/Tests.yml@main"
64+
with:
65+
group: "${{ matrix.group }}"
66+
julia-version: "${{ matrix.version }}"
67+
os: "${{ matrix.os }}"
68+
nthreads: 4
69+
timeout-minutes: 120
70+
secrets:
71+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/CompatCheck.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ jobs:
2020
runs-on: ubuntu-latest
2121
strategy:
2222
matrix:
23-
downgrade_mode: ['alldeps']
24-
julia-version: ['1.10', '1']
23+
downgrade_mode: ['deps']
24+
# TODO: this should be ['1.10', '1'] but that is currently broken:
25+
# https://github.com/julia-actions/julia-downgrade-compat/issues/25
26+
julia-version: ['1.10', '1.12']
2527
steps:
2628
- uses: actions/checkout@v5
2729
- uses: julia-actions/setup-julia@v2
@@ -31,5 +33,6 @@ jobs:
3133
with:
3234
mode: ${{ matrix.downgrade_mode }}
3335
skip: Random, LinearAlgebra, Test, Combinatorics
36+
julia_version: ${{ matrix.julia-version }}
3437
- uses: julia-actions/julia-buildpkg@v1
3538
- uses: julia-actions/julia-runtest@v1

.github/workflows/CompatHelper.yml

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,44 @@
11
name: CompatHelper
2-
32
on:
43
schedule:
54
- cron: 0 0 * * *
65
workflow_dispatch:
7-
6+
permissions:
7+
contents: write
8+
pull-requests: write
89
jobs:
910
CompatHelper:
1011
runs-on: ubuntu-latest
1112
steps:
12-
- name: Pkg.add("CompatHelper")
13-
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
14-
- name: CompatHelper.main()
13+
- name: Check if Julia is already available in the PATH
14+
id: julia_in_path
15+
run: which julia
16+
continue-on-error: true
17+
- name: Install Julia, but only if it is not already available in the PATH
18+
uses: julia-actions/setup-julia@v2
19+
with:
20+
version: '1'
21+
arch: ${{ runner.arch }}
22+
if: steps.julia_in_path.outcome != 'success'
23+
- name: "Add the General registry via Git"
24+
run: |
25+
import Pkg
26+
ENV["JULIA_PKG_SERVER"] = ""
27+
Pkg.Registry.add("General")
28+
shell: julia --color=yes {0}
29+
- name: "Install CompatHelper"
30+
run: |
31+
import Pkg
32+
name = "CompatHelper"
33+
uuid = "aa819f21-2bde-4658-8897-bab36330d9b7"
34+
version = "3"
35+
Pkg.add(; name, uuid, version)
36+
shell: julia --color=yes {0}
37+
- name: "Run CompatHelper"
38+
run: |
39+
import CompatHelper
40+
CompatHelper.main()
41+
shell: julia --color=yes {0}
1542
env:
1643
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1744
COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }}
18-
run: julia -e 'using CompatHelper; CompatHelper.main()'

.github/workflows/Documentation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
workflow_dispatch:
1212

1313
jobs:
14-
build:
14+
Documentation:
1515
runs-on: ${{ matrix.os }}
1616
strategy:
1717
matrix:

.github/workflows/FormatCheck.yml

Lines changed: 11 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,15 @@
1-
name: FormatCheck
1+
name: 'Format'
22

33
on:
4-
push:
5-
branches:
6-
- 'main'
7-
- 'master'
8-
- 'release-'
9-
tags: '*'
10-
pull_request:
4+
pull_request_target:
5+
paths: ['**/*.jl']
6+
types: [opened, synchronize, reopened, ready_for_review]
117

12-
jobs:
13-
build:
14-
runs-on: ${{ matrix.os }}
15-
strategy:
16-
matrix:
17-
version:
18-
- '1' # automatically expands to the latest stable 1.x release of Julia
19-
os:
20-
- ubuntu-latest
21-
steps:
22-
- uses: julia-actions/setup-julia@latest
23-
with:
24-
version: ${{ matrix.version }}
8+
permissions:
9+
contents: read
10+
actions: write
11+
pull-requests: write
2512

26-
- uses: actions/checkout@v5
27-
- name: Install JuliaFormatter and format
28-
# This will use the latest version by default but you can set the version like so:
29-
#
30-
# julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter", version="0.13.0"))'
31-
run: |
32-
julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter", version="1"))'
33-
julia -e 'using JuliaFormatter; format(".", verbose=true)'
34-
- name: Format check
35-
run: |
36-
julia -e '
37-
out = Cmd(`git diff --name-only`) |> read |> String
38-
if out == ""
39-
exit(0)
40-
else
41-
@error "Some files have not been formatted !!!"
42-
write(stdout, out)
43-
exit(1)
44-
end'
13+
jobs:
14+
formatcheck:
15+
uses: "QuantumKitHub/QuantumKitHubActions/.github/workflows/FormatCheck.yml@main"

.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
repos:
2+
- repo: https://github.com/fredrikekre/runic-pre-commit
3+
rev: v2.0.1
4+
hooks:
5+
- id: runic

CITATION.cff

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ authors:
88
given-names: "Jutho"
99
orcid: "https://orcid.org/0000-0002-0858-291X"
1010
title: "TensorKit.jl"
11-
version: "0.14.11"
11+
version: "0.15.0"
1212
doi: "10.5281/zenodo.8421339"
13-
date-released: "2025-07-18"
13+
date-released: "2025-10-03"
1414
url: "https://github.com/QuantumKitHub/TensorKit.jl"
1515
preferred-citation:
1616
type: article

Changelog.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,30 @@ Features that are planned to be implemented before the release of v1.0.0, in no
1515

1616
# Changelog
1717

18+
## v0.15
19+
20+
### MatrixAlgebraKit backend for factorizations
21+
22+
This version introduces [MatrixAlgebraKit](https://github.com/QuantumKitHub/MatrixAlgebraKit.jl) as the new backend for tensor factorizations, replacing the previous internal `TensorKit.MatrixAlgebra` implementation. See [#230](https://github.com/QuantumKitHub/TensorKit.jl/pull/230) for details.
23+
24+
#### Added
25+
- `foreachblock(f, t::AbstractTensorMap...)` - uniform interface to iterate through tensor blocks (prepares for future multithreading support)
26+
- `eig_trunc` and `eigh_trunc` - truncated eigenvalue decompositions
27+
- `ominus` (and unicode ``) - compute orthogonal complement of a space
28+
- Backend selection for factorizations - swap algorithms or implementations
29+
30+
#### Changed
31+
- Factorization functions `leftorth`, `rightorth`, `tsvd`, `eig`, `eigh` deprecated in favor of MatrixAlgebraKit variants (`left_orth`, `right_orth`, `svd_compact`, `eig_full`, `eigh_full`)
32+
- Truncation strategies now use MatrixAlgebraKit names: `truncrank` (replaces `truncdim`) and `trunctol` (replaces `truncbelow`)
33+
- `left_orth` and `right_orth` now always output tensors with a single connecting space
34+
- `left_orth` and `right_orth` now always have connecting space with `isdual=false`
35+
- code formatter is now [Runic.jl](https://github.com/fredrikekre/Runic.jl)
36+
37+
#### Removed
38+
- `OrthogonalFactorization` structs (constructors deprecated to return equivalent MatrixAlgebraKit algorithm structs)
39+
- Direct permute-and-factorize operations (incompatible with `permute` vs `braid` distinction)
40+
- `Polar` decomposition behavior for `left_orth`/`right_orth` (use `left_polar`/`right_polar` instead for `isposdef` R factors)
41+
1842
## v0.14
1943

2044
### Use `DiagonalTensorMap` for singular values and eigenvalues
@@ -95,4 +119,4 @@ where all blocks and subblocks are various views into this object. This entails
95119
simplifications for the outwards-facing interface, as now the `TensorMap` type requires less
96120
parameters, and the fusion-tree structure is more clearly considered as an implementation
97121
detail that can be left hidden to the user. Various other improvements and documentation
98-
work was also carried out.
122+
work was also carried out.

Project.toml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
name = "TensorKit"
22
uuid = "07d1fe3e-3e46-537d-9eac-e9e13d0d4cec"
33
authors = ["Jutho Haegeman"]
4-
version = "0.14.11"
4+
version = "0.15.3"
55

66
[deps]
77
LRUCache = "8ac3fa9e-de4c-5943-b1dc-09c6b5f20637"
88
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
9+
MatrixAlgebraKit = "6c742aac-3347-4629-af66-fc926824e5e4"
10+
OhMyThreads = "67456a42-1dca-4109-a031-0a68de7e3ad5"
911
PackageExtensionCompat = "65ce6f38-6b18-4e1d-a461-8949797d7930"
12+
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
1013
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
14+
ScopedValues = "7e506255-f358-4e82-b7e4-beb19740aa63"
1115
Strided = "5e0ebb24-38b0-5f93-81fe-25c709ecae67"
1216
TensorKitSectors = "13a9c161-d5da-41f0-bcbd-e1a08ae0647f"
1317
TensorOperations = "6aa20fa7-93e2-5fca-9bc0-fbd0db3c71a2"
@@ -24,16 +28,22 @@ TensorKitFiniteDifferencesExt = "FiniteDifferences"
2428

2529
[compat]
2630
Aqua = "0.6, 0.7, 0.8"
31+
ArgParse = "1.2.0"
2732
ChainRulesCore = "1"
2833
ChainRulesTestUtils = "1"
2934
Combinatorics = "1"
3035
FiniteDifferences = "0.12"
3136
LRUCache = "1.0.2"
3237
LinearAlgebra = "1"
38+
MatrixAlgebraKit = "0.5.0"
39+
OhMyThreads = "0.8.0"
3340
PackageExtensionCompat = "1"
41+
Printf = "1"
3442
Random = "1"
43+
SafeTestsets = "0.1"
44+
ScopedValues = "1.3.0"
3545
Strided = "2"
36-
TensorKitSectors = "0.3"
46+
TensorKitSectors = "=0.3.0, 0.3.2"
3747
TensorOperations = "5.1"
3848
Test = "1"
3949
TestExtras = "0.2,0.3"
@@ -43,16 +53,18 @@ Zygote = "0.7"
4353
julia = "1.10"
4454

4555
[extras]
56+
ArgParse = "c7e460c6-2fb9-53a9-8c5b-16f535851c63"
4657
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
4758
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
4859
ChainRulesTestUtils = "cdddcdb0-9152-4a09-a978-84456f9df70a"
4960
Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"
5061
FiniteDifferences = "26cc04aa-876d-5657-8c51-4c34ba976000"
5162
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
63+
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
5264
TensorOperations = "6aa20fa7-93e2-5fca-9bc0-fbd0db3c71a2"
5365
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
5466
TestExtras = "5ed8adda-3752-4e41-b88a-e8b09835ee3a"
5567
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
5668

5769
[targets]
58-
test = ["Aqua", "Combinatorics", "LinearAlgebra", "TensorOperations", "Test", "TestExtras", "ChainRulesCore", "ChainRulesTestUtils", "FiniteDifferences", "Zygote"]
70+
test = ["ArgParse", "Aqua", "Combinatorics", "LinearAlgebra", "TensorOperations", "Test", "TestExtras", "SafeTestsets", "ChainRulesCore", "ChainRulesTestUtils", "FiniteDifferences", "Zygote"]

0 commit comments

Comments
 (0)