Skip to content

Commit 3ec800f

Browse files
committed
Revert "Adapt extension (#384)"
This reverts commit 2db4cb1.
1 parent 2db4cb1 commit 3ec800f

7 files changed

Lines changed: 12 additions & 132 deletions

File tree

Project.toml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,8 @@ TensorKitManifolds = "11fa318c-39cb-4a83-b1ed-cdc7ba1e3684"
2323
TensorOperations = "6aa20fa7-93e2-5fca-9bc0-fbd0db3c71a2"
2424
VectorInterface = "409d34a3-91d5-4945-b6ec-7529ddf182d8"
2525

26-
[weakdeps]
27-
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
28-
29-
[extensions]
30-
MPSKitAdaptExt = "Adapt"
31-
3226
[compat]
3327
Accessors = "0.1"
34-
Adapt = "4"
3528
Aqua = "0.8.9"
3629
BlockTensorKit = "0.3.4"
3730
Combinatorics = "1"
@@ -60,7 +53,6 @@ VectorInterface = "0.2, 0.3, 0.4, 0.5"
6053
julia = "1.10"
6154

6255
[extras]
63-
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
6456
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
6557
Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"
6658
ParallelTestRunner = "d3525ed8-44d0-4b2c-a655-542cee43accc"
@@ -71,4 +63,4 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
7163
TestExtras = "5ed8adda-3752-4e41-b88a-e8b09835ee3a"
7264

7365
[targets]
74-
test = ["Aqua", "Adapt", "Pkg", "Test", "TestExtras", "Plots", "Combinatorics", "ParallelTestRunner", "TensorKitTensors"]
66+
test = ["Aqua", "Pkg", "Test", "TestExtras", "Plots", "Combinatorics", "ParallelTestRunner", "TensorKitTensors"]

ext/MPSKitAdaptExt.jl

Lines changed: 0 additions & 57 deletions
This file was deleted.

src/operators/jordanmpotensor.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,12 @@ function JordanMPOTensor(W::SparseBlockTensorMap{TT, E, S, 2, 2}) where {TT, E,
121121
)
122122
end
123123

124-
function jordanmpotensortype(::Type{S}, ::Type{TorA}) where {S <: VectorSpace, TorA}
125-
TA = Union{tensormaptype(S, 2, 2, TorA), BraidingTensor{scalartype(TorA), S}}
126-
TB = tensormaptype(S, 2, 1, TorA)
127-
TC = tensormaptype(S, 1, 2, TorA)
128-
TD = tensormaptype(S, 1, 1, TorA)
129-
return JordanMPOTensor{scalartype(TorA), S, TA, TB, TC, TD}
124+
function jordanmpotensortype(::Type{S}, ::Type{E}) where {S <: VectorSpace, E <: Number}
125+
TA = Union{tensormaptype(S, 2, 2, E), BraidingTensor{E, S}}
126+
TB = tensormaptype(S, 2, 1, E)
127+
TC = tensormaptype(S, 1, 2, E)
128+
TD = tensormaptype(S, 1, 1, E)
129+
return JordanMPOTensor{E, S, TA, TB, TC, TD}
130130
end
131131
function jordanmpotensortype(::Type{O}) where {O <: MPOTensor}
132132
return jordanmpotensortype(spacetype(O), scalartype(O))

src/states/abstractmps.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ TensorKit.spacetype(ψ::AbstractMPS) = spacetype(typeof(ψ))
199199
TensorKit.spacetype(ψtype::Type{<:AbstractMPS}) = spacetype(site_type(ψtype))
200200
TensorKit.sectortype::AbstractMPS) = sectortype(typeof(ψ))
201201
TensorKit.sectortype(ψtype::Type{<:AbstractMPS}) = sectortype(site_type(ψtype))
202-
TensorKit.storagetype(ψtype::Type{<:AbstractMPS}) = storagetype(site_type(ψtype))
203202

204203
"""
205204
left_virtualspace(ψ::AbstractMPS, [pos=1:length(ψ)])

src/states/finitemps.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,9 @@ end
376376

377377
site_type(::Type{<:FiniteMPS{A}}) where {A} = A
378378
bond_type(::Type{<:FiniteMPS{<:Any, B}}) where {B} = B
379+
function TensorKit.storagetype(::Union{MPS, Type{MPS}}) where {A, MPS <: FiniteMPS{A}}
380+
return storagetype(A)
381+
end
379382

380383
function left_virtualspace::FiniteMPS, n::Integer)
381384
checkbounds(ψ, n)

test/operators/mpo.jl

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ println("
44
--------------------
55
")
66

7+
using .TestSetup
78
using Test, TestExtras
8-
using Adapt
99
using MPSKit
1010
using MPSKit: GeometryStyle, FiniteChainStyle, InfiniteChainStyle, OperatorStyle, MPOStyle
1111
using TensorKit
@@ -83,7 +83,6 @@ using TensorKit: ℙ
8383
end
8484
end
8585

86-
8786
@testset "InfiniteMPO" begin
8887
P =^2
8988
T = Float64
@@ -99,26 +98,3 @@ end
9998
@test OperatorStyle(typeof(H)) == MPOStyle()
10099
@test OperatorStyle(H) == MPOStyle()
101100
end
102-
103-
@testset "Adapt" for V in (ℂ^2, U1Space(-1 => 1, 0 => 1, 1 => 1))
104-
L = 3
105-
o = rand(Float32, V^L V^L)
106-
mpo1 = FiniteMPO(o)
107-
for T in (Float64, ComplexF64)
108-
mpo2 = @testinferred adapt(Vector{T}, mpo1)
109-
@test mpo2 isa FiniteMPO
110-
@test scalartype(mpo2) == T
111-
@test storagetype(mpo2) == Vector{T}
112-
@test convert(TensorMap, mpo2) o
113-
end
114-
115-
mpo3 = InfiniteMPO(mpo1[2:2])
116-
for T in (Float64, ComplexF64)
117-
mpo4 = @testinferred adapt(Vector{T}, mpo3)
118-
@test mpo4 isa InfiniteMPO
119-
@test scalartype(mpo4) == T
120-
@test storagetype(mpo4) == Vector{T}
121-
@test dot(mpo3, mpo4) 1 atol = 1.0e-4
122-
end
123-
124-
end

test/operators/mpohamiltonian.jl

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ println("
44
----------------------------
55
")
66

7+
using .TestSetup
78
using Test, TestExtras
8-
using Adapt
99
using MPSKit
1010
using MPSKit: GeometryStyle, FiniteChainStyle, InfiniteChainStyle, OperatorStyle, HamiltonianStyle
1111
using TensorKit
@@ -239,36 +239,3 @@ end
239239
h4 = H4 * H4
240240
@test real(expectation_value(ψ2, H4)) >= 0
241241
end
242-
243-
@testset "Adapt" for V in (ℂ^2, U1Space(-1 => 1, 0 => 1, 1 => 1))
244-
h = rand(Float32, V^2 V^2)
245-
h += h'
246-
247-
L = 4
248-
H1 = FiniteMPOHamiltonian(
249-
fill(V, L),
250-
((i, i + 1) => h for i in 1:(L - 1))...,
251-
((i, i + 2) => h for i in 1:(L - 2))...,
252-
((i, i + 3) => h for i in 1:(L - 3))...,
253-
)
254-
mps1 = FiniteMPS(physicalspace(H1), oneunit(V))
255-
256-
for T in (Float64, ComplexF64)
257-
H2 = @testinferred adapt(Vector{T}, H1)
258-
@test H2 isa FiniteMPOHamiltonian
259-
@test scalartype(H2) == T
260-
@test storagetype(H2) == Vector{T}
261-
@test expectation_value(mps1, H1) expectation_value(mps1, H2)
262-
end
263-
264-
H3 = InfiniteMPOHamiltonian(fill(V, L), (1, 2) => h, (1, 3) => h, (1, 4) => h)
265-
mps2 = InfiniteMPS(physicalspace(H3), [oneunit(V)])
266-
for T in (Float64, ComplexF64)
267-
H4 = @testinferred adapt(Vector{T}, H3)
268-
@test H4 isa InfiniteMPOHamiltonian
269-
@test scalartype(H4) == T
270-
@test storagetype(H4) == Vector{T}
271-
@test expectation_value(mps2, H3) expectation_value(mps2, H4)
272-
end
273-
274-
end

0 commit comments

Comments
 (0)