Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
Jutho committed Mar 30, 2024
1 parent d377d67 commit 078912f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/tensors/tensor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 19 additions & 2 deletions test/bugfixes.jl
Original file line number Diff line number Diff line change
@@ -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
end

0 comments on commit 078912f

Please sign in to comment.