Skip to content

Commit 5b2ad4a

Browse files
committed
Also fix eltype in similar call
1 parent 9b02e03 commit 5b2ad4a

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/tensors/abstractblocktensor/abstractarray.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,9 @@ end
197197
return @inbounds get(parent(t), key, default)
198198
end
199199

200-
Base.copy(t::AbstractBlockTensorMap) = copy!(similar(t), t)
200+
function Base.copy(t::AbstractBlockTensorMap)
201+
return copy!(similar(t, Base.promote_op(copy, eltype(t)), space(t)), t)
202+
end
201203
function Base.copy!(tdst::AbstractBlockTensorMap, tsrc::AbstractBlockTensorMap)
202204
space(tdst) == space(tsrc) || throw(SpaceMismatch("$(space(tdst))$(space(tsrc))"))
203205
@inbounds for (key, value) in nonzero_pairs(tsrc)

0 commit comments

Comments
 (0)