|
1 | 1 | # TensorOperations |
2 | 2 | # ---------------- |
3 | 3 | function TO.tensoradd_type( |
4 | | - TC, A::BlockTensorMap, ::Index2Tuple{N₁,N₂}, ::Bool |
| 4 | + TC, A::AbstractBlockTensorMap, ::Index2Tuple{N₁,N₂}, ::Bool |
5 | 5 | ) where {N₁,N₂} |
6 | 6 | M = TK.similarstoragetype(eltype(A), TC) |
7 | | - return blocktensormaptype(spacetype(A), N₁, N₂, M) |
8 | | -end |
9 | | -function TO.tensoradd_type( |
10 | | - TC, A::SparseBlockTensorMap, ::Index2Tuple{N₁,N₂}, ::Bool |
11 | | -) where {N₁,N₂} |
12 | | - M = TK.similarstoragetype(eltype(A), TC) |
13 | | - return sparseblocktensormaptype(spacetype(A), N₁, N₂, M) |
| 7 | + return if issparse(A) |
| 8 | + sparseblocktensormaptype(spacetype(A), N₁, N₂, M) |
| 9 | + else |
| 10 | + blocktensormaptype(spacetype(A), N₁, N₂, M) |
| 11 | + end |
14 | 12 | end |
15 | 13 | function TO.tensoradd_type(TC, A::AdjointBlockTensorMap, pA::Index2Tuple, conjA::Bool) |
16 | 14 | return TO.tensoradd_type(TC, A', adjointtensorindices(A, pA), !conjA) |
|
0 commit comments