@@ -188,3 +188,30 @@ for f! in (
188188 @eval MAK.$ f! (:: AbstractBlockTensorMap , x, :: DiagonalAlgorithm ) =
189189 error (" Blocktensors are incompatible with diagonal algorithm" )
190190end
191+
192+ function TensorKit. Factorizations. truncate_domain! (tdst:: AbstractBlockTensorMap , tsrc:: AbstractBlockTensorMap , inds)
193+ TensorKit. foreachblock (tdst, tsrc) do c, (dst_block, src_block)
194+ I = get (inds, c, nothing )
195+ dst_dense = copy_dense! (similar_dense (dst_block), dst_block)
196+ src_dense = copy_dense! (similar_dense (src_block), src_block)
197+ @assert ! isnothing (I)
198+ @views dst_dense .= src_dense[:, I]
199+ # deal with the case where the output is not in-place
200+ dst_dense === dst_block || copyto! (dst_block, dst_dense)
201+ return nothing
202+ end
203+ return tdst
204+ end
205+ function TensorKit. Factorizations. truncate_codomain! (tdst:: AbstractBlockTensorMap , tsrc:: AbstractBlockTensorMap , inds)
206+ TensorKit. foreachblock (tdst, tsrc) do c, (dst_block, src_block)
207+ I = get (inds, c, nothing )
208+ dst_dense = copy_dense! (similar_dense (dst_block), dst_block)
209+ src_dense = copy_dense! (similar_dense (src_block), src_block)
210+ @assert ! isnothing (I)
211+ @views dst_dense .= src_dense[I, :]
212+ # deal with the case where the output is not in-place
213+ dst_dense === dst_block || copyto! (dst_block, dst_dense)
214+ return nothing
215+ end
216+ return tdst
217+ end
0 commit comments