|
52 | 52 |
|
53 | 53 | function TO.tensoradd_type(TC, A::AbstractTensorMap, ::Index2Tuple{N₁,N₂}, |
54 | 54 | ::Bool) where {N₁,N₂} |
55 | | - sst = sectorscalartype(sectortype(A)) |
56 | | - Tnew = sst <: Real ? TC : VectorInterface.promote_add(TC, scalartype(A), sst) |
57 | | - M = similarstoragetype(A, Tnew) |
| 55 | + I = sectortype(A) |
| 56 | + M = similarstoragetype(A, sectorscalartype(I) <: Real ? TC : complex(TC)) |
58 | 57 | return tensormaptype(spacetype(A), N₁, N₂, M) |
59 | 58 | end |
60 | 59 |
|
@@ -115,14 +114,11 @@ function TO.tensorcontract_type(TC, |
115 | 114 | A::AbstractTensorMap, ::Index2Tuple, ::Bool, |
116 | 115 | B::AbstractTensorMap, ::Index2Tuple, ::Bool, |
117 | 116 | ::Index2Tuple{N₁,N₂}) where {N₁,N₂} |
118 | | - sst(x) = sectorscalartype(sectortype(x)) |
119 | | - Tnew = (sst(A) <: Real && sst(B) <: Real) ? TC : |
120 | | - TO.promote_contract(TC, scalartype(A), sst(A), |
121 | | - scalartype(B), sst(B)) |
122 | | - M = similarstoragetype(A, Tnew) |
123 | | - M == similarstoragetype(B, Tnew) || |
124 | | - throw(ArgumentError("incompatible storage types:\n$(M) ≠ $(similarstoragetype(B, Tnew))")) |
125 | 117 | spacetype(A) == spacetype(B) || throw(SpaceMismatch("incompatible space types")) |
| 118 | + I = sectortype(A) |
| 119 | + M = similarstoragetype(A, sectorscalartype(I) <: Real ? TC : complex(TC)) |
| 120 | + MB = similarstoragetype(B, sectorscalartype(I) <: Real ? TC : complex(TC)) |
| 121 | + M == MB || throw(ArgumentError("incompatible storage types:\n$(M) ≠ $(MB)")) |
126 | 122 | return tensormaptype(spacetype(A), N₁, N₂, M) |
127 | 123 | end |
128 | 124 |
|
|
0 commit comments