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 byt3svd()and the elementwise-multiply (t3m) backends so a scalar likemax_tt_ranks=4works the same everywhere.- Parameters:
length (int)
- Return type:
t3toolbox.backend.common.typ.Tuple