Pointwise sum, the shorter list padded with zeros.
Equations
- HexMatrixTheory.addLists (a :: as) (b :: bs) = (a + b) :: HexMatrixTheory.addLists as bs
- HexMatrixTheory.addLists [] x✝ = x✝
- HexMatrixTheory.addLists x✝ [] = x✝
Instances For
The coefficient list of the product of two coefficient lists.
Equations
- HexMatrixTheory.conv [] x✝ = []
- HexMatrixTheory.conv (a :: as) x✝ = HexMatrixTheory.addLists (List.map (fun (x : ℕ) => a * x) x✝) (0 :: HexMatrixTheory.conv as x✝)
Instances For
theorem
HexMatrixTheory.dotNat_pad
(b c : List ℕ)
(r : ℕ)
(hb : b.length = r)
:
Hex.Matrix.Packed.dotNat b (List.take r c ++ List.replicate (r - c.length) 0) = Hex.Matrix.Packed.dotNat b c
theorem
HexMatrixTheory.packRevAux_eq
(W k acc : ℕ)
(l : List ℕ)
:
Hex.Matrix.Packed.packRevAux W k acc l = acc * 2 ^ (W * k) + Hex.Matrix.Packed.packRow W (List.take k l ++ List.replicate (k - l.length) 0).reverse
theorem
HexMatrixTheory.packCol_eq
(W r : ℕ)
(c : List ℕ)
:
Hex.Matrix.Packed.packCol W r c = Hex.Matrix.Packed.packRow W (List.take r c ++ List.replicate (r - c.length) 0).reverse
theorem
HexMatrixTheory.dotNat_cut
(a b : List ℕ)
(r : ℕ)
(hb : b.length = r)
:
Hex.Matrix.Packed.dotNat (List.take r a ++ List.replicate (r - a.length) 0) b = Hex.Matrix.Packed.dotNat a b
Cutting or zero-padding the first list to the length of the second changes nothing.
theorem
HexMatrixTheory.dotInt_parts
(t c : List ℤ)
:
Hex.Matrix.Packed.dotInt t c = ↑(Hex.Matrix.Packed.dotNat (Hex.Matrix.Packed.posParts t) (Hex.Matrix.Packed.posParts c) + Hex.Matrix.Packed.dotNat (Hex.Matrix.Packed.negParts t) (Hex.Matrix.Packed.negParts c)) - ↑(Hex.Matrix.Packed.dotNat (Hex.Matrix.Packed.posParts t) (Hex.Matrix.Packed.negParts c) + Hex.Matrix.Packed.dotNat (Hex.Matrix.Packed.negParts t) (Hex.Matrix.Packed.posParts c))
A signed dot product as the four dot products of the parts.
theorem
HexMatrixTheory.dotIntPacked_eq
(W r k : ℕ)
(t c : List ℤ)
(hc : c.length = r)
(ht : ∀ x ∈ t, x.natAbs < k)
(hck : ∀ x ∈ c, x.natAbs < k)
(hW : r * (k * k) < 2 ^ W)
:
The packed signed dot product of a row (cut or padded to r) with a
column of r entries, both with absolute values below k and
r · k² < 2^W.
theorem
HexMatrixTheory.mem_columns
(m : ℕ)
(A : List (List ℤ))
(c : List ℤ)
(hc : c ∈ Hex.Matrix.Packed.columns m A)
:
∃ j < m, c = Hex.Matrix.Packed.column j A