The same virtual call does two different things depending on the tensor type:
ut_dense.truncate_(0, 3) # slice leg 0 to dimension 3
ut_sym.truncate_(0, 3) # delete sector #3 of leg 0, with its ENTIRE degeneracy
DenseUniTensor::truncate_ slices the leg to its first dim entries.
BlockUniTensor/BlockFermionicUniTensor name the same parameter q_index
and call _rm_qnum(q_index), erasing every block containing that sector — the
cut size is degs[q_index], unrelated to the passed number. The Doxygen and
the Python keyword (dim=) document only the dense meaning; nothing warns.
Nothing internal calls truncate_ (the SVD-truncate routines don't use it),
so this is purely user-facing.
Proposal:
Move the symmetric behavior to an explicitly named method, e.g. rm_qsector_(bond, qidx).
Symmetric truncate_(bond, dim) then either implements true dimension truncation (shrink the sector at the cut, drop the rest — overlaps with the resize_bond proposal in #415) or throws pointing to rm_qsector_.
Related: #1029, #415, #1051.
The same virtual call does two different things depending on the tensor type:
DenseUniTensor::truncate_ slices the leg to its first dim entries.
BlockUniTensor/BlockFermionicUniTensor name the same parameter q_index
and call _rm_qnum(q_index), erasing every block containing that sector — the
cut size is degs[q_index], unrelated to the passed number. The Doxygen and
the Python keyword (dim=) document only the dense meaning; nothing warns.
Nothing internal calls truncate_ (the SVD-truncate routines don't use it),
so this is purely user-facing.
Proposal:
Move the symmetric behavior to an explicitly named method, e.g. rm_qsector_(bond, qidx).
Symmetric truncate_(bond, dim) then either implements true dimension truncation (shrink the sector at the cut, drop the rest — overlaps with the resize_bond proposal in #415) or throws pointing to rm_qsector_.
Related: #1029, #415, #1051.