@@ -119,19 +119,26 @@ diagspacelist = (
119119 if BraidingStyle (I) isa SymmetricBraiding
120120 @timedtestset " Permutations" begin
121121 t = DiagonalTensorMap (randn (ComplexF64, reduceddim (V)), V)
122+ t_tm = convert (TensorMap, t)
123+
124+ # preserving diagonal
122125 t1 = @constinferred permute (t, $ (((2 ,), (1 ,))))
123- if BraidingStyle (sectortype (V)) isa Bosonic
124- @test t1 ≈ transpose (t)
125- end
126- @test convert (TensorMap, t1) == permute (convert (TensorMap, t), (((2 ,), (1 ,))))
126+ @test t1 isa DiagonalTensorMap
127+ @test convert (TensorMap, t1) == permute (t_tm, (((2 ,), (1 ,))))
128+ t1′ = @constinferred transpose (t)
129+ @test t1′ isa DiagonalTensorMap
130+ @test convert (TensorMap, t1′) == transpose (t_tm)
131+ BraidingStyle (I) isa Bosonic && @test t1 ≈ t1′
132+
133+ # not preserving diagonal
127134 t2 = @constinferred permute (t, $ (((1 , 2 ), ())))
128- @test convert (TensorMap, t2) == permute (convert (TensorMap, t) , (((1 , 2 ), ())))
135+ @test convert (TensorMap, t2) == permute (t_tm , (((1 , 2 ), ())))
129136 t3 = @constinferred permute (t, $ (((2 , 1 ), ())))
130- @test convert (TensorMap, t3) == permute (convert (TensorMap, t) , (((2 , 1 ), ())))
137+ @test convert (TensorMap, t3) == permute (t_tm , (((2 , 1 ), ())))
131138 t4 = @constinferred permute (t, $ (((), (1 , 2 ))))
132- @test convert (TensorMap, t4) == permute (convert (TensorMap, t) , (((), (1 , 2 ))))
139+ @test convert (TensorMap, t4) == permute (t_tm , (((), (1 , 2 ))))
133140 t5 = @constinferred permute (t, $ (((), (2 , 1 ))))
134- @test convert (TensorMap, t5) == permute (convert (TensorMap, t) , (((), (2 , 1 ))))
141+ @test convert (TensorMap, t5) == permute (t_tm , (((), (2 , 1 ))))
135142 end
136143 end
137144 @timedtestset " Trace, Multiplication and inverse" begin
0 commit comments