Skip to content

Commit ccfaaa1

Browse files
committed
Fix promote_storagetype in planar preprocessor
1 parent 97ffd07 commit ccfaaa1

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

‎src/planar/preprocessors.jl‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,11 @@ function _construct_braidingtensors!(ex, preargs, indexmap, non_braiding) # ex i
197197
end
198198
if foundV1 && foundV2
199199
s = gensym(:τ)
200-
storageex = Expr(:call, GlobalRef(TensorKit, :promote_storagetype), non_braiding...)
200+
scalarex = Expr(
201+
:call, :promote_type,
202+
map(t -> Expr(:call, GlobalRef(TensorKit, :scalartype), t), non_braiding)...
203+
)
204+
storageex = Expr(:call, GlobalRef(TensorKit, :promote_storagetype), scalarex, non_braiding...)
201205
braidingex = Expr(:call, GlobalRef(TensorKit, :braidingtensortype), V1, V2, storageex)
202206
constructex = Expr(:call, braidingex, V1, V2)
203207
push!(preargs, Expr(:(=), s, constructex))

‎src/tensors/abstracttensor.jl‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ Optionally, a scalartype `T` for the destination can be supplied that might diff
132132
@inline promote_storagetype(A::AbstractTensorMap) = storagetype(A)
133133
@inline promote_storagetype(A::AbstractTensorMap, B::AbstractTensorMap, Cs::AbstractTensorMap...) =
134134
promote_storagetype(storagetype(A), storagetype(B), map(storagetype, Cs)...)
135+
@inline promote_storagetype(::Type{T}, A::AbstractTensorMap) where {T <: Number} = similarstoragetype(A, T)
135136
@inline promote_storagetype(::Type{T}, A::AbstractTensorMap, B::AbstractTensorMap, Cs::AbstractTensorMap...) where {T <: Number} =
136137
promote_storagetype(similarstoragetype(A, T), similarstoragetype(B, T), map(Base.Fix2(similarstoragetype, T), Cs)...)
137138

0 commit comments

Comments
 (0)