Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/planar/preprocessors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,11 @@ function _construct_braidingtensors!(ex, preargs, indexmap, non_braiding) # ex i
end
if foundV1 && foundV2
s = gensym(:蟿)
storageex = Expr(:call, GlobalRef(TensorKit, :promote_storagetype), non_braiding...)
scalarex = Expr(
:call, :promote_type,
map(t -> Expr(:call, GlobalRef(TensorKit, :scalartype), t), non_braiding)...
)
storageex = Expr(:call, GlobalRef(TensorKit, :promote_storagetype), scalarex, non_braiding...)
braidingex = Expr(:call, GlobalRef(TensorKit, :braidingtensortype), V1, V2, storageex)
constructex = Expr(:call, braidingex, V1, V2)
push!(preargs, Expr(:(=), s, constructex))
Expand Down
5 changes: 3 additions & 2 deletions src/tensors/abstracttensor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ Optionally, a scalartype `T` for the destination can be supplied that might diff
@inline promote_storagetype(A::AbstractTensorMap) = storagetype(A)
@inline promote_storagetype(A::AbstractTensorMap, B::AbstractTensorMap, Cs::AbstractTensorMap...) =
promote_storagetype(storagetype(A), storagetype(B), map(storagetype, Cs)...)
@inline promote_storagetype(::Type{T}, A::AbstractTensorMap, B::AbstractTensorMap, Cs::AbstractTensorMap...) where {T <: Number} =
promote_storagetype(similarstoragetype(A, T), similarstoragetype(B, T), map(Base.Fix2(similarstoragetype, T), Cs)...)
@inline promote_storagetype(::Type{T}, A::AbstractTensorMap, Bs::AbstractTensorMap...) where {T <: Number} =
promote_storagetype(similarstoragetype(A, T), map(Base.Fix2(similarstoragetype, T), Bs)...)

@inline function promote_storagetype(
::Type{A}, ::Type{B}, Cs::Type{<:AbstractTensorMap}...
Expand All @@ -148,6 +148,7 @@ end

# promotion system in the same spirit as base/promotion.jl
promote_storagetype(::Type{Base.Bottom}, ::Type{Base.Bottom}) = Base.Bottom
promote_storagetype(::Type{T}) where {T} = T
promote_storagetype(::Type{T}, ::Type{T}) where {T} = T
promote_storagetype(::Type{T}, ::Type{Base.Bottom}) where {T} = T
promote_storagetype(::Type{Base.Bottom}, ::Type{T}) where {T} = T
Expand Down
Loading