Documentation

CompPoly.Data.Vector.Basic

Definitions and lemmas for Vector #

def Vector.induction₂_temp {α : Type u_2} {β : Type u_3} {motive : {n : } → Vector α nVector β nSort u_1} (v_empty : motive #v[] #v[]) (v_insert : {n : } → (hd : α) → (tl : Vector α n) → (hd' : β) → (tl' : Vector β n) → motive tl tl'motive (tl.insertIdx 0 hd ) (tl'.insertIdx 0 hd' )) {m : } (v : Vector α m) (v' : Vector β m) :
motive v v'
Equations
    Instances For
      def Vector.nil {α : Type u_1} :
      Vector α 0

      The empty vector.

      Equations
        Instances For
          def Vector.cons {α : Type u_1} {n : } (hd : α) (tl : Vector α n) :
          Vector α (n + 1)

          Construct a vector by prepending an element to the front of a vector, using insertIdx at 0.

          Equations
            Instances For
              @[simp]
              theorem Vector.head_cons {α : Type u_1} {n : } (hd : α) (tl : Vector α n) :
              (cons hd tl).head = hd
              theorem Vector.cons_get_eq {α : Type u_1} {n : } (hd : α) (tl : Vector α n) (i : Fin (n + 1)) :
              (cons hd tl).get i = if hi : (i == 0) = true then hd else tl.get i - 1,
              @[simp]
              theorem Vector.cons_empty_tail_eq_nil {α : Type u_1} (hd : α) (tl : Vector α 0) :
              cons hd tl = #v[hd]
              @[simp]
              theorem Vector.tail_cons {α : Type u_1} {n : } (hd : α) (tl : Vector α n) :
              (cons hd tl).tail = tl
              @[simp]
              theorem Vector.cons_toList_eq_List_cons {α : Type u_1} {n : } (hd : α) (tl : Vector α n) :
              (cons hd tl).toList = hd :: tl.toList
              theorem Vector.foldl_eq_toList_foldl {α : Type u_1} {β : Type u_2} {n : } (f : βαβ) (init : β) (v : Vector α n) :
              foldl f init v = List.foldl f init v.toList
              theorem Vector.foldl_succ {α : Type u_1} {β : Type u_2} {n : } [NeZero n] (f : βαβ) (init : β) (v : Vector α n) :
              foldl f init v = foldl f (f init v.head) v.tail
              theorem Vector.zipWith_cons {α : Type u_1} {β : Type u_2} {γ : Type u_3} {n : } (f : αβγ) (a : α) (b : Vector α n) (c : β) (d : Vector β n) :
              zipWith f (cons a b) (cons c d) = cons (f a c) (zipWith f b d)
              def Vector.dotProduct {R : Type u_1} {n : } [Zero R] [Add R] [Mul R] (a b : Vector R n) :
              R

              Inner product between two vectors of the same size. Should be faster than _root_.dotProduct due to efficient operations on Vectors.

              Equations
                Instances For

                  Inner product between two vectors of the same size. Should be faster than _root_.dotProduct due to efficient operations on Vectors.

                  Equations
                    Instances For
                      @[simp]
                      theorem Vector.dotProduct_cons {R : Type u_1} {n : } [AddCommMonoid R] [Mul R] (a : R) (b : Vector R n) (c : R) (d : Vector R n) :
                      (cons a b).dotProduct (cons c d) = a * c + b.dotProduct d
                      def Vector.Matrix (α : Type u_2) (m n : ) :
                      Type u_2

                      A matrix represented as iterated vectors in row-major order. m is the number of rows, and n is the number of columns

                      Equations
                        Instances For
                          def Vector.Matrix.mulVec {α : Type u_2} [Zero α] [Add α] [Mul α] {numRows numCols : } (M : Vector (Vector α numCols) numRows) (x : Vector α numCols) :
                          Vector α numRows

                          Matrix-vector multiplication over α. M is given as a vector of row-vectors.

                          Equations
                            Instances For
                              def Vector.Matrix.ofFlatten {α : Type u_2} {m n : } (v : Vector α (m * n)) :
                              Matrix α m n

                              Convert a flat row-major vector of length m*n into an m × n row-major matrix represented as Vector (Vector α n) m.

                              Equations
                                Instances For
                                  def Vector.Matrix.toFinMatrix {α : Type u_2} {m n : } (matrix : Matrix α m n) :
                                  _root_.Matrix (Fin m) (Fin n) α

                                  Convert to a Fin-indexed matrix (the definition in Mathlib): Fin m → Fin n → α

                                  Equations
                                    Instances For
                                      def Vector.Matrix.ofFinMatrix {α : Type u_2} {m n : } (matrix : _root_.Matrix (Fin m) (Fin n) α) :
                                      Matrix α m n

                                      Convert from a Fin-indexed matrix (the definition in Mathlib): Fin m → Fin n → α

                                      Equations
                                        Instances For
                                          def Vector.Matrix.transpose {α : Type u_2} {m n : } (matrix : Matrix α m n) :
                                          Matrix α n m

                                          Transpose a matrix by swapping rows and columns.

                                          Equations
                                            Instances For
                                              @[simp]
                                              theorem dotProduct_cons {R : Type u_1} [AddCommMonoid R] [Mul R] {n : } (a : R) (b : Vector R n) (c : R) (d : Vector R n) :
                                              theorem Vector.dotProduct_eq_root_dotProduct {R : Type u_1} [AddCommMonoid R] [Mul R] {n : } (a b : Vector R n) :