Skip to content

Commit 4eacaa1

Browse files
committed
revert tensorcontract_type changes
1 parent 1ca2407 commit 4eacaa1

1 file changed

Lines changed: 4 additions & 19 deletions

File tree

src/tensors/tensoroperations.jl

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,39 +21,24 @@ end
2121

2222
# tensoralloc_contract
2323
# --------------------
24-
for TTB in (:AbstractTensorMap, :AbstractBlockTensorMap)
24+
for TTA in (:AbstractTensorMap, :AbstractBlockTensorMap), TTB in (:AbstractTensorMap, :AbstractBlockTensorMap)
25+
TTA == TTB == :AbstractTensorMap && continue
2526
@eval function TO.tensorcontract_type(
2627
TC,
27-
A::AbstractBlockTensorMap, ::Index2Tuple, ::Bool,
28+
A::$TTA, ::Index2Tuple, ::Bool,
2829
B::$TTB, ::Index2Tuple, ::Bool,
2930
::Index2Tuple{N₁, N₂},
3031
) where {N₁, N₂}
3132
S = TK.check_spacetype(A, B)
3233
TC′ = TK.promote_permute(TC, sectortype(S))
33-
ATT = AbstractTensorMap{scalartype(A), spacetype(A), numout(A), numin(A)}
34-
BTT = AbstractTensorMap{scalartype(B), spacetype(B), numout(B), numin(B)}
35-
# handle case with BraidingTensors, so that they assume the backing
36-
# array type of the concrete element type
37-
M = if eltype(A) == ATT
38-
TK.similarstoragetype(B, TC′)
39-
elseif eltype(B) == BTT
40-
TK.similarstoragetype(A, TC′)
41-
else
42-
TK.similarstoragetype(TK.similarstoragetype(A, TC′), TK.similarstoragetype(B, TC′))
43-
end
34+
M = TK.promote_storagetype(TK.similarstoragetype(A, TC′), TK.similarstoragetype(B, TC′))
4435
return if issparse(A) && issparse(B)
4536
sparseblocktensormaptype(S, N₁, N₂, M)
4637
else
4738
blocktensormaptype(S, N₁, N₂, M)
4839
end
4940
end
5041
end
51-
TO.tensorcontract_type(
52-
TC,
53-
A::AbstractTensorMap, pA::Index2Tuple, conjA::Bool,
54-
B::AbstractBlockTensorMap, pB::Index2Tuple, conjB::Bool,
55-
pAB::Index2Tuple{N₁, N₂},
56-
) where {N₁, N₂} = TO.tensorcontract_type(TC, B, pB, conjB, A, pA, conjA, pAB)
5742

5843
function similarblocktype(::Type{A}, ::Type{TT}) where {A, TT}
5944
return Core.Compiler.return_type(similar, Tuple{A, Type{TT}, NTuple{numind(TT), Int}})

0 commit comments

Comments
 (0)