Skip to main content

Module tensorize

Module tensorize 

Source
Expand description

Quantized tensorization: an n₁×…×n_D grid → a d-way tensor with tiny mode sizes (mostly 2).

Each axis of length p is written in mixed radix, p = f₁·f₂·…·f_L, and every digit becomes one tensor mode. With p = 2^L this is the classic binary QTT (“quantics”) tensorization. The digit order across axes is a choice:

  • DigitOrder::RowMajor — all digits of axis 0 (most significant first), then axis 1, …: the tensor index is the row-major linear index.
  • DigitOrder::Morton — digits interleaved coarse-to-fine, aligned at the least significant digit (Z-order for powers of two). Neighbouring cells share long index prefixes along every axis.

Lengths that are not 7-smooth are padded. PadPolicy::MixedRadix pads only to the next 7-smooth length (factors 2,3,5,7 become modes of that size; odd factors are placed most significant), PadPolicy::Pow2 pads to the next power of two (pure binary QTT). Padding is mirror reflection, so the padded field stays continuous at the seam; the padded cells are coded (they cost bits) but are cropped on decode and never enter error metrics.

Structs§

Layout
The tensorization of one grid.

Enums§

DigitOrder
How digits of different axes are ordered in the tensor.
PadPolicy
How non-power-of-two lengths are handled.

Functions§

padded_len
Axis length after padding under pad, and its digits (most significant first).