Splitting flat tensor digits into band indices #
Outer digits 0,1,2 contribute to a base-three offset. Inner digits 3,4,5,6
contribute to a base-four offset and set the corresponding binary mask bit. All positions
are least significant first, in the encoder's existing numbering.
Main definitions #
BandDigits.parts: the three indices computed by the native digit loop.BandDigits.sevenDigits: exactlyLdigits, retaining leading zeros.
Main results #
BandDigits.parts_bounds: component bounds derived from the original depth.BandDigits.parts_lists: the compressed digit-list interpretation of all three indices.
@[instance_reducible]
def Cslib.Algorithms.MatrixMultiplication.Schonhage.BandDigits.instDecidableEqParts.decEq (x✝ x✝¹ : Parts) :
Instances For
def Cslib.Algorithms.MatrixMultiplication.Schonhage.BandDigits.instReprParts.repr :
Parts → ℕ → Std.Format
Instances For
@[instance_reducible]
Remove one base-seven digit, recursively interpreting the remaining higher levels.
Instances For
These are exactly the digits in Mathlib's finite-function numbering.
theorem Cslib.Algorithms.MatrixMultiplication.Schonhage.BandDigits.parts_lists (L a : ℕ) :
(parts L a).mask = Nat.ofDigits 2 (List.map (fun (d : ℕ) => if d < 3 then 0 else 1) (sevenDigits L a)) ∧ (parts L a).outer = Nat.ofDigits 3 (List.filter (fun (d : ℕ) => decide (d < 3)) (sevenDigits L a)) ∧ (parts L a).inner = Nat.ofDigits 4 (List.map (fun (d : ℕ) => d - 3) (List.filter (fun (d : ℕ) => decide ¬d < 3) (sevenDigits L a)))
The native indices are precisely the binary mask and the two compressed digit lists.