Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 37 additions & 34 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,68 +1,71 @@
name: CI

on:
push:
branches:
- 'master'
- 'main'
- 'release-'

tags: '*'

paths-ignore:
- 'docs/**'
pull_request:
workflow_dispatch:

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

jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version:
- '1'
- 'lts'
- '1'
group:
- symmetries
- tensors
- other
- autodiff
os:
- ubuntu-latest
- macOS-latest
- windows-latest
steps:
- uses: actions/checkout@v5
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
- uses: julia-actions/cache@v2
- uses: julia-actions/julia-buildpkg@latest
- uses: julia-actions/julia-runtest@latest
env:
JULIA_NUM_THREADS: 4
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: lcov.info
uses: "QuantumKitHub/QuantumKitHubActions/.github/workflows/Tests.yml@main"
with:
group: "${{ matrix.group }}"
julia-version: "${{ matrix.version }}"
os: "${{ matrix.os }}"
nthreads: 4
timeout-minutes: 120
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

test-nightly:
needs: test
name: Julia nightly - ${{ matrix.os }} - ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
version:
- 'nightly'
group:
- symmetries
- tensors
- other
- autodiff
os:
- ubuntu-latest
- macOS-latest
- windows-latest
continue-on-error: true
steps:
- uses: actions/checkout@v5
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
- uses: julia-actions/cache@v2
- uses: julia-actions/julia-buildpkg@latest
- uses: julia-actions/julia-runtest@latest
env:
JULIA_NUM_THREADS: 4
uses: "QuantumKitHub/QuantumKitHubActions/.github/workflows/Tests.yml@main"
with:
group: "${{ matrix.group }}"
julia-version: "${{ matrix.version }}"
os: "${{ matrix.os }}"
nthreads: 4
timeout-minutes: 120
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
5 changes: 3 additions & 2 deletions .github/workflows/CompatCheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
downgrade_mode: ['alldeps']
julia-version: ['1.10', '1']
downgrade_mode: ['deps']
julia-version: ['1.10', '1.12']
Comment thread
lkdvos marked this conversation as resolved.
steps:
- uses: actions/checkout@v5
- uses: julia-actions/setup-julia@v2
Expand All @@ -31,5 +31,6 @@ jobs:
with:
mode: ${{ matrix.downgrade_mode }}
skip: Random, LinearAlgebra, Test, Combinatorics
julia_version: ${{ matrix.julia-version }}
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
8 changes: 6 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ TensorKitFiniteDifferencesExt = "FiniteDifferences"

[compat]
Aqua = "0.6, 0.7, 0.8"
ArgParse = "1.2.0"
ChainRulesCore = "1"
ChainRulesTestUtils = "1"
Combinatorics = "1"
Expand All @@ -37,9 +38,10 @@ MatrixAlgebraKit = "0.5.0"
OhMyThreads = "0.8.0"
PackageExtensionCompat = "1"
Random = "1"
SafeTestsets = "0.1"
ScopedValues = "1.3.0"
Strided = "2"
TensorKitSectors = "0.3"
TensorKitSectors = "0.3.1"
TensorOperations = "5.1"
Test = "1"
TestExtras = "0.2,0.3"
Expand All @@ -49,16 +51,18 @@ Zygote = "0.7"
julia = "1.10"

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

[targets]
test = ["Aqua", "Combinatorics", "LinearAlgebra", "TensorOperations", "Test", "TestExtras", "ChainRulesCore", "ChainRulesTestUtils", "FiniteDifferences", "Zygote"]
test = ["ArgParse", "Aqua", "Combinatorics", "LinearAlgebra", "TensorOperations", "Test", "TestExtras", "SafeTestsets", "ChainRulesCore", "ChainRulesTestUtils", "FiniteDifferences", "Zygote"]
17 changes: 9 additions & 8 deletions src/spaces/gradedspace.jl
Original file line number Diff line number Diff line change
Expand Up @@ -268,17 +268,18 @@ function type_repr(::Type{<:GradedSpace{ProductSector{T}}}) where
end

# Specific constructors for Z_N
const ZNSpace{N} = GradedSpace{ZNIrrep{N}, NTuple{N, Int}}
ZNSpace{N}(dims::NTuple{N, Int}; dual::Bool = false) where {N} = ZNSpace{N}(dims, dual)
ZNSpace{N}(dims::Vararg{Int, N}; dual::Bool = false) where {N} = ZNSpace{N}(dims, dual)
ZNSpace(dims::NTuple{N, Int}; dual::Bool = false) where {N} = ZNSpace{N}(dims, dual)
ZNSpace(dims::Vararg{Int, N}; dual::Bool = false) where {N} = ZNSpace{N}(dims, dual)
const ZNSpace{N, T} = GradedSpace{ZNIrrep{N, T}, NTuple{N, Int}}
ZNSpace{N}(dims; dual::Bool = false) where {N} = Rep[ℤ{N}](dims; dual)
ZNSpace{N, T}(dims::NTuple{N, Int}; dual::Bool = false) where {T, N} = ZNSpace{N, T}(dims, dual)
ZNSpace{N, T}(dims::Vararg{Int, N}; dual::Bool = false) where {T, N} = ZNSpace{N, T}(dims, dual)
ZNSpace(dims::NTuple{N, Int}; dual::Bool = false) where {N} = Rep[ℤ{N}](dims, dual)
ZNSpace(dims::Vararg{Int, N}; dual::Bool = false) where {N} = Rep[ℤ{N}](dims, dual)

# TODO: Do we still need all of those
# ASCII type aliases
const Z2Space = ZNSpace{2}
const Z3Space = ZNSpace{3}
const Z4Space = ZNSpace{4}
const Z2Space = ZNSpace{2, UInt8}
const Z3Space = ZNSpace{3, UInt8}
const Z4Space = ZNSpace{4, UInt8}
const U1Space = Rep[U₁]
const CU1Space = Rep[CU₁]
const SU2Space = Rep[SU₂]
Expand Down
14 changes: 9 additions & 5 deletions test/ad.jl → test/autodiff/ad.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
using Test, TestExtras
using TensorKit
using TensorKit: type_repr, SectorDict
using TensorOperations
using ChainRulesCore
using ChainRulesTestUtils
using FiniteDifferences: FiniteDifferences, central_fdm, forward_fdm
Expand Down Expand Up @@ -33,7 +37,7 @@ function ChainRulesTestUtils.test_approx(
end

# make sure that norms are computed correctly:
function FiniteDifferences.to_vec(t::TK.SectorDict)
function FiniteDifferences.to_vec(t::SectorDict)
T = scalartype(valtype(t))
vec = mapreduce(vcat, t; init = T[]) do (c, b)
return reshape(b, :) .* sqrt(dim(c))
Expand All @@ -43,7 +47,7 @@ function FiniteDifferences.to_vec(t::TK.SectorDict)
function from_vec(x_real)
x = T <: Real ? x_real : reinterpret(T, x_real)
ctr = 0
return TK.SectorDict(
return SectorDict(
c => (
n = length(b);
b′ = reshape(view(x, ctr .+ (1:n)), size(b)) ./ sqrt(dim(c));
Expand Down Expand Up @@ -187,7 +191,7 @@ spacelist = (
Vect[SU2Irrep](0 => 1, 1 // 2 => 1, 3 // 2 => 1)',
),
(
Vect[FibonacciAnyon](:I => 1, :τ => 1),
Vect[FibonacciAnyon](:I => 2, :τ => 1),
Vect[FibonacciAnyon](:I => 1, :τ => 2)',
Vect[FibonacciAnyon](:I => 2, :τ => 2)',
Vect[FibonacciAnyon](:I => 2, :τ => 3),
Expand All @@ -197,7 +201,7 @@ spacelist = (

for V in spacelist
I = sectortype(eltype(V))
Istr = TK.type_repr(I)
Istr = type_repr(I)
eltypes = isreal(sectortype(eltype(V))) ? (Float64, ComplexF64) : (ComplexF64,)
symmetricbraiding = BraidingStyle(sectortype(eltype(V))) isa SymmetricBraiding
println("---------------------------------------")
Expand Down Expand Up @@ -593,7 +597,7 @@ for V in spacelist
# TODO: I'm not sure how to properly test with spaces that might change
# with the finite-difference methods, as then the jacobian is ill-defined.

trunc = truncrank(round(Int, min(dim(domain(t)), dim(codomain(t))) ÷ 2))
trunc = truncrank(max(2, round(Int, min(dim(domain(t)), dim(codomain(t))) * (3 / 4))))
Comment thread
lkdvos marked this conversation as resolved.
USVᴴ_trunc = svd_trunc(t; trunc)
ΔUSVᴴ_trunc = rand_tangent.(USVᴴ_trunc)
remove_svdgauge_dependence!(
Expand Down
1 change: 1 addition & 0 deletions test/braidingtensor.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# TODO: Make into proper tests and integrate in testset
# note: this is not part of the testsuite!

import TensorKit: BraidingTensor

Expand Down
83 changes: 0 additions & 83 deletions test/bugfixes.jl

This file was deleted.

4 changes: 4 additions & 0 deletions test/other/aqua.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
using TensorKit
using Aqua

Aqua.test_all(TensorKit)
Loading