diff --git a/src/tensors/tensor.jl b/src/tensors/tensor.jl index e9953fc1..d0538949 100644 --- a/src/tensors/tensor.jl +++ b/src/tensors/tensor.jl @@ -746,7 +746,8 @@ function Base.convert(T::Type{TensorMap{S,N₁,N₂,I,A,F₁,F₂}}, if typeof(t) == T return t else - data = Dict{I,storagetype(T)}(c => convert(storagetype(T), b) for (c, b) in blocks(t)) + data = Dict{I,storagetype(T)}(c => convert(storagetype(T), b) + for (c, b) in blocks(t)) return TensorMap(data, codomain(t), domain(t)) end end diff --git a/test/bugfixes.jl b/test/bugfixes.jl index 2cb9462c..d395235f 100644 --- a/test/bugfixes.jl +++ b/test/bugfixes.jl @@ -1,8 +1,25 @@ @timedtestset "Bugfixes" verbose = true begin @testset "BugfixConvert" begin - v = TensorMap(randn,ComplexF64,(Vect[(Irrep[U₁] ⊠ Irrep[SU₂] ⊠ FermionParity)]((-3, 1/2, 1)=>3, (-5, 1/2, 1)=>10, (-7, 1/2, 1)=>13, (-9, 1/2, 1)=>9, (-11, 1/2, 1)=>1, (-5, 3/2, 1)=>3, (-7, 3/2, 1)=>3, (-9, 3/2, 1)=>1) ⊗ Vect[(Irrep[U₁] ⊠ Irrep[SU₂] ⊠ FermionParity)]((1, 1/2, 1)=>1)') ← Vect[(Irrep[U₁] ⊠ Irrep[SU₂] ⊠ FermionParity)]((-3, 1/2, 1)=>3, (-5, 1/2, 1)=>10, (-7, 1/2, 1)=>13, (-9, 1/2, 1)=>9, (-11, 1/2, 1)=>1, (-5, 3/2, 1)=>3, (-7, 3/2, 1)=>3, (-9, 3/2, 1)=>1)) + v = TensorMap(randn, ComplexF64, + (Vect[(Irrep[U₁] ⊠ Irrep[SU₂] ⊠ FermionParity)]((-3, 1 / 2, 1) => 3, + (-5, 1 / 2, 1) => 10, + (-7, 1 / 2, 1) => 13, + (-9, 1 / 2, 1) => 9, + (-11, 1 / 2, 1) => 1, + (-5, 3 / 2, 1) => 3, + (-7, 3 / 2, 1) => 3, + (-9, 3 / 2, 1) => 1) ⊗ + Vect[(Irrep[U₁] ⊠ Irrep[SU₂] ⊠ FermionParity)]((1, 1 / 2, 1) => 1)') ← + Vect[(Irrep[U₁] ⊠ Irrep[SU₂] ⊠ FermionParity)]((-3, 1 / 2, 1) => 3, + (-5, 1 / 2, 1) => 10, + (-7, 1 / 2, 1) => 13, + (-9, 1 / 2, 1) => 9, + (-11, 1 / 2, 1) => 1, + (-5, 3 / 2, 1) => 3, + (-7, 3 / 2, 1) => 3, + (-9, 3 / 2, 1) => 1)) w = convert(typeof(real(v)), v) @test w == v @test scalartype(w) == Float64 end -end \ No newline at end of file +end