Skip to content

Commit eff92d4

Browse files
authored
type stability improvements (#46)
1 parent 547cdd3 commit eff92d4

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

ext/BlockTensorKitAdaptExt.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ function Adapt.adapt_structure(to, x::BlockTensorMap)
1010
end
1111

1212
function Adapt.adapt_structure(to, x::SparseBlockTensorMap)
13-
data′ = Dict(I => adapt(to, v) for (I, v) in x.data)
13+
ad = adapt(to)
14+
TT = Base.promote_op(ad, eltype(x))
15+
data′ = Dict{CartesianIndex{ndims(x)}, TT}(I => adapt(to, v) for (I, v) in x.data)
1416
return SparseBlockTensorMap(data′, space(x))
1517
end
1618

0 commit comments

Comments
 (0)