Skip to content

UniTensor::truncate_(bond, x): x is a bond dimension for dense tensors but a sector index for symmetric ones #1182

Description

@manuschneider

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    suggestionSuggestion for current codebase

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions