diff --git a/Project.toml b/Project.toml index 51adadf9d..28cab4bf4 100644 --- a/Project.toml +++ b/Project.toml @@ -36,7 +36,7 @@ MPSKitAdaptExt = "Adapt" [compat] Accessors = "0.1" Adapt = "4" -BlockTensorKit = "0.3.11" +BlockTensorKit = "0.3.14" Compat = "3.47, 4.10" DocStringExtensions = "0.9.3" HalfIntegers = "1.6.0" @@ -49,7 +49,7 @@ OptimKit = "0.3.1, 0.4" Printf = "1" Random = "1" RecipesBase = "1.1" -TensorKit = "0.16.5" +TensorKit = "0.17" TensorKitManifolds = "0.7, 0.8" TensorOperations = "5.5.1" TimerOutputs = "0.5.29" diff --git a/src/MPSKit.jl b/src/MPSKit.jl index f30eb869f..f4d2fc6f8 100644 --- a/src/MPSKit.jl +++ b/src/MPSKit.jl @@ -59,7 +59,7 @@ using Compat: @compat # Imports # ------- using TensorKit -using TensorKit: BraidingTensor +using TensorKit: BraidingTensor, promote_storagetype using TensorKit: TupleTools as TT using MatrixAlgebraKit using MatrixAlgebraKit: TruncationStrategy diff --git a/src/operators/abstractmpo.jl b/src/operators/abstractmpo.jl index 54ecf0358..41e5ea576 100644 --- a/src/operators/abstractmpo.jl +++ b/src/operators/abstractmpo.jl @@ -130,9 +130,10 @@ function _fuse_mpo_mpo(O1::MPOTensor, O2::MPOTensor, Fₗ, Fᵣ) return if O1 isa BraidingTensor && O2 isa BraidingTensor # shouldn't happen T = promote_type(scalartype(O1), scalartype(O2)) + A = promote_storagetype(T, O1, O2) V = fuse(left_virtualspace(O2) ⊗ left_virtualspace(O1)) ⊗ physicalspace(O1) ← physicalspace(O2) ⊗ fuse(right_virtualspace(O2) ⊗ right_virtualspace(O1)) - return BraidingTensor{T}(V) + return BraidingTensor{T, spacetype(V), A}(V) elseif O1 isa BraidingTensor @plansor O′[-1 -2; -3 -4] := Fₗ[-1; 1 2] * O2[1 3; -3 5] * τ[2 -2; 3 4] * conj(Fᵣ[-4; 5 4]) @@ -159,9 +160,10 @@ function fuse_mul_mpo(O1, O2) end function fuse_mul_mpo(O1::BraidingTensor, O2::BraidingTensor) T = promote_type(scalartype(O1), scalartype(O2)) + A = promote_storagetype(T, O1, O2) V = fuse(left_virtualspace(O2) ⊗ left_virtualspace(O1)) ⊗ physicalspace(O1) ← physicalspace(O2) ⊗ fuse(right_virtualspace(O2) ⊗ right_virtualspace(O1)) - return BraidingTensor{T}(V) + return BraidingTensor{T, spacetype(V), A}(V) end function fuse_mul_mpo( O1::AbstractBlockTensorMap{T₁, S, 2, 2}, O2::AbstractBlockTensorMap{T₂, S, 2, 2} @@ -198,7 +200,7 @@ function add_physical_charge(O::BraidingTensor, charge::Sector) auxspace = Vect[typeof(charge)](charge => 1)' V = left_virtualspace(O) ⊗ fuse(physicalspace(O), auxspace) ← fuse(physicalspace(O), auxspace) ⊗ right_virtualspace(O) - return BraidingTensor{scalartype(O)}(V) + return BraidingTensor{scalartype(O), spacetype(O), storagetype(O)}(V) end function add_physical_charge(O::AbstractBlockTensorMap{<:Any, <:Any, 2, 2}, charge::Sector) sectortype(O) == typeof(charge) || throw(SectorMismatch()) diff --git a/src/operators/jordanmpotensor.jl b/src/operators/jordanmpotensor.jl index 8131f90fb..e4f77d8d7 100644 --- a/src/operators/jordanmpotensor.jl +++ b/src/operators/jordanmpotensor.jl @@ -60,7 +60,7 @@ end const JordanMPOTensorMap{T, S, A <: DenseVector{T}} = JordanMPOTensor{ T, S, - Union{TensorMap{T, S, 2, 2, A}, BraidingTensor{T, S}}, + Union{TensorMap{T, S, 2, 2, A}, BraidingTensor{T, S, A}}, TensorMap{T, S, 2, 1, A}, TensorMap{T, S, 1, 2, A}, TensorMap{T, S, 1, 1, A}, @@ -124,7 +124,7 @@ end function jordanmpotensortype(::Type{S}, ::Type{E}) where {S <: VectorSpace, E} TA = tensormaptype(S, 2, 2, E) T = scalartype(TA) - Tτ = BraidingTensor{T, S} + Tτ = BraidingTensor{T, S, storagetype(TA)} TB = tensormaptype(S, 2, 1, E) TC = tensormaptype(S, 1, 2, E) TD = tensormaptype(S, 1, 1, E) @@ -172,7 +172,7 @@ BlockTensorKit.issparse(W::JordanMPOTensor) = true # Converters # ---------- function BlockTensorKit.SparseBlockTensorMap(W::JordanMPOTensor) - τ = BraidingTensor{scalartype(W)}(eachspace(W)[1]) + τ = BraidingTensor{scalartype(W), spacetype(W), storagetype(W)}(eachspace(W)[1]) W′ = SparseBlockTensorMap{AbstractTensorMap{scalartype(W), spacetype(W), 2, 2}}( undef_blocks, space(W) ) @@ -232,7 +232,7 @@ end j = I[4] if (size(W, 4) > 1 && i == 1 && j == 1) || (size(W, 1) > 1 && i == size(W, 1) && j == size(W, 4)) - return BraidingTensor{scalartype(W)}(eachspace(W)[1]) + return BraidingTensor{scalartype(W), spacetype(W), storagetype(W)}(eachspace(W)[1]) elseif i == 1 && j == size(W, 4) return insertrightunit(insertleftunit(only(W.D), 1), 3) elseif i == 1 diff --git a/src/operators/mpohamiltonian.jl b/src/operators/mpohamiltonian.jl index daf7eb6a5..a2e39848f 100644 --- a/src/operators/mpohamiltonian.jl +++ b/src/operators/mpohamiltonian.jl @@ -140,7 +140,7 @@ function FiniteMPOHamiltonian{O}(W_mats::Vector{<:Matrix}) where {O <: JordanMPO if v isa MPOTensor W[I] = v elseif !iszero(v) - τ = BraidingTensor{T}(eachspace(W)[I]) + τ = BraidingTensor{T, spacetype(W), storagetype(W)}(eachspace(W)[I]) W[I] = isone(v) ? τ : τ * v end end @@ -261,7 +261,7 @@ function InfiniteMPOHamiltonian{O}(W_mats::Vector{<:Matrix}) where {O <: MPOTens if v isa MPOTensor W[I] = v elseif !iszero(v) - τ = BraidingTensor{T}(eachspace(W)[I]) + τ = BraidingTensor{T, spacetype(W), storagetype(W)}(eachspace(W)[I]) W[I] = isone(v) ? τ : τ * v end end @@ -477,7 +477,7 @@ function FiniteMPOHamiltonian(lattice::AbstractArray{<:VectorSpace}, local_opera key_R = key_R′ == 0 ? length(virtualsumspaces[site + 1]) : key_R′ O[key_L, 1, 1, key_R] += if o isa Number iszero(o) && continue - τ = BraidingTensor{scalartype(TW)}(eachspace(O)[key_L, 1, 1, key_R]) + τ = BraidingTensor{scalartype(TW), spacetype(TW), storagetype(TW)}(eachspace(O)[key_L, 1, 1, key_R]) isone(o) ? τ : τ * o else o @@ -600,7 +600,7 @@ function InfiniteMPOHamiltonian(lattice′::AbstractArray{<:VectorSpace}, local_ key_R = key_R′ == 0 ? length(virtualspaces[site]) : key_R′ O[key_L, 1, 1, key_R] += if o isa Number iszero(o) && continue - τ = BraidingTensor{scalartype(TW)}(eachspace(O)[key_L, 1, 1, key_R]) + τ = BraidingTensor{scalartype(TW), spacetype(TW), storagetype(TW)}(eachspace(O)[key_L, 1, 1, key_R]) isone(o) ? τ : τ * o else o diff --git a/test/Project.toml b/test/Project.toml index da4cf3f70..562dd4339 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -24,7 +24,7 @@ MPSKit = {path = ".."} [compat] Aqua = "0.8.9" -CUDA = "5.9" +CUDA = "6" Combinatorics = "1" ParallelTestRunner = "2" Plots = "1.40" @@ -32,4 +32,4 @@ Pkg = "1" TensorKitTensors = "0.2" Test = "1" TestExtras = "0.3" -cuTENSOR = "2.3" +cuTENSOR = "6" diff --git a/test/runtests.jl b/test/runtests.jl index 81d497c5e..b2b237cb7 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -16,7 +16,7 @@ is_buildkite && filter!(startswith("gpu") ∘ first, testsuite) # only run CUDA/cuTENSOR if available using CUDA, cuTENSOR -(CUDA.functional() && cuTENSOR.has_cutensor()) || +(CUDA.functional() && cuTENSOR.functional()) || filter!(!(startswith("gpu/cuda") ∘ first), testsuite) # parse arguments