@@ -4,10 +4,12 @@ function TO.tensoradd_type(
44 TC, A:: AbstractBlockTensorMap , :: Index2Tuple{N₁,N₂} , :: Bool
55) where {N₁,N₂}
66 TA = eltype (A)
7+ I = sectortype (A)
8+ Tnew = sectorscalartype (I) <: Real ? TC : complex (TC)
79 if TA isa Union
8- M = Union{TK. similarstoragetype (TA. a, TC ),TK. similarstoragetype (TA. b, TC )}
10+ M = Union{TK. similarstoragetype (TA. a, Tnew ),TK. similarstoragetype (TA. b, Tnew )}
911 else
10- M = TK. similarstoragetype (TA, TC )
12+ M = TK. similarstoragetype (TA, Tnew )
1113 end
1214 return if issparse (A)
1315 sparseblocktensormaptype (spacetype (A), N₁, N₂, M)
@@ -33,7 +35,10 @@ function TO.tensorcontract_type(
3335) where {N₁,N₂}
3436 spacetype (A) == spacetype (B) ||
3537 throw (SpaceMismatch (" incompatible space types: $(spacetype (A)) ≠ $(spacetype (B)) " ))
36- M = promote_storagetype (TC, eltype (A), eltype (B))
38+
39+ I = sectortype (A)
40+ Tnew = sectorscalartype (I) <: Real ? TC : complex (TC)
41+ M = promote_storagetype (Tnew, eltype (A), eltype (B))
3742 return if issparse (A) && issparse (B)
3843 sparseblocktensormaptype (spacetype (A), N₁, N₂, M)
3944 else
@@ -52,7 +57,10 @@ function TO.tensorcontract_type(
5257) where {N₁,N₂}
5358 spacetype (A) == spacetype (B) ||
5459 throw (SpaceMismatch (" incompatible space types: $(spacetype (A)) ≠ $(spacetype (B)) " ))
55- M = promote_storagetype (TC, typeof (A), eltype (B))
60+
61+ I = sectortype (A)
62+ Tnew = sectorscalartype (I) <: Real ? TC : complex (TC)
63+ M = promote_storagetype (Tnew, typeof (A), eltype (B))
5664 return if issparse (A) && issparse (B)
5765 sparseblocktensormaptype (spacetype (A), N₁, N₂, M)
5866 else
@@ -71,7 +79,10 @@ function TO.tensorcontract_type(
7179) where {N₁,N₂}
7280 spacetype (A) == spacetype (B) ||
7381 throw (SpaceMismatch (" incompatible space types: $(spacetype (A)) ≠ $(spacetype (B)) " ))
74- M = promote_storagetype (TC, eltype (A), typeof (B))
82+
83+ I = sectortype (A)
84+ Tnew = sectorscalartype (I) <: Real ? TC : complex (TC)
85+ M = promote_storagetype (Tnew, eltype (A), typeof (B))
7586 return if issparse (A) && issparse (B)
7687 sparseblocktensormaptype (spacetype (A), N₁, N₂, M)
7788 else
0 commit comments