File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ using TensorKit
44using BlockTensorKit
55using Random
66using Combinatorics
7+ using Adapt
78
89Vtr = (
910 SumSpace (ℂ^ 3 ),
8485 end
8586end
8687
88+ @testset " Adapt" begin
89+ W = V1 ⊗ V2 ⊗ V3 ← V4 ⊗ V5
90+ t1 = rand (Float32, W)
91+ for T in (Float64, ComplexF64)
92+ t2 = @testinferred adapt (Vector{T}, t1)
93+ @test t2 isa BlockTensorMap
94+ @test scalartype (t2) == T
95+ @test storagetype (t2) == Vector{T}
96+ @test space (t1) == space (t2)
97+ @test norm (t1) ≈ norm (t2)
98+ end
99+ end
100+
87101@testset " Basic linear algebra" begin
88102 W = V1 ⊗ V2 ⊗ V3 ← V4 ⊗ V5
89103 for T in (Float32, ComplexF64)
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ using TensorKit
33using BlockTensorKit
44using Random
55using Combinatorics
6+ using Adapt
67
78Vtr = (
89 SumSpace (ℂ^ 3 ),
9091 end
9192end
9293
94+ @testset " Adapt" begin
95+ W = V1 ⊗ V2 ⊗ V3 ← V4 ⊗ V5
96+ t1 = sprand (Float32, W)
97+ for T in (Float64, ComplexF64)
98+ t2 = @testinferred adapt (Vector{T}, t1)
99+ @test t2 isa SparseBlockTensorMap
100+ @test scalartype (t2) == T
101+ @test storagetype (t2) == Vector{T}
102+ @test space (t1) == space (t2)
103+ @test norm (t1) ≈ norm (t2)
104+ end
105+ end
106+
107+
93108@testset " Basic linear algebra" begin
94109 W = V1 ⊗ V2 ⊗ V3 ← V4 ⊗ V5
95110 for T in (Float32, ComplexF64)
You can’t perform that action at this time.
0 commit comments