normalize_max_ranks#

t3toolbox.backend.ranks.normalize_max_ranks(spec, length)#
def normalize_max_ranks(
        spec,            # None | int | Sequence[int or None]
        length: int,     # d for Tucker ranks, d+1 for TT ranks
) -> typ.Tuple:          # length-`length` tuple of (int or None); None entry = no cap at that position

Normalize a max-rank specification to a per-position tuple.

None -> no cap anywhere; a scalar caps every position uniformly; a sequence is per-position (length-checked). Shared by t3svd() and the elementwise-multiply (t3m) backends so a scalar like max_tt_ranks=4 works the same everywhere.

Parameters:

length (int)

Return type:

t3toolbox.backend.common.typ.Tuple