@@ -4,8 +4,8 @@ println("
44----------------------------
55" )
66
7+ using . TestSetup
78using Test, TestExtras
8- using Adapt
99using MPSKit
1010using MPSKit: GeometryStyle, FiniteChainStyle, InfiniteChainStyle, OperatorStyle, HamiltonianStyle
1111using TensorKit
239239 h4 = H4 * H4
240240 @test real (expectation_value (ψ2, H4)) >= 0
241241end
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