Skip to content

Commit

Permalink
reinstate converter
Browse files Browse the repository at this point in the history
  • Loading branch information
lkdvos committed Dec 3, 2024
1 parent 433319c commit f2fe462
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/tensors/blocktensor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,17 @@ function Base.promote_rule(
return BlockTensorMap{TT}
end

function Base.convert(::Type{BlockTensorMap}, t::AbstractTensorMap)
S = spacetype(t)
data = fill(t, ntuple(Returns(1), numind(t)))
tdst = BlockTensorMap(
data,
convert(ProductSumSpace{S,numout(t)}, codomain(t)),
convert(ProductSumSpace{S,numin(t)}, domain(t)),
)
return tdst
end

# Utility
# -------
Base.haskey(t::BlockTensorMap, I::CartesianIndex) = checkbounds(Bool, t.data, I)
Expand Down

0 comments on commit f2fe462

Please sign in to comment.