Documentation

Complexity.Algorithms.MatrixMultiplication.Schonhage.SplitDigits

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 #

Main results #

Binary level mask and the two compressed offsets.

  • mask : ℕ

    Inner-level mask.

  • outer : ℕ

    Base-three outer offset.

  • inner : ℕ

    Base-four inner offset.

Instances For

    Remove one base-seven digit, recursively interpreting the remaining higher levels.

    Instances For

      Component fits depend only on the input depth, even for an unbounded argument.

      A fixed number of digits, so that zero digits at the end are retained.

      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.