Documentation

CompPoly.LinearAlgebra.PolynomialMatrix.Operations

Polynomial-Matrix Operations #

Reusable executable operations for polynomial rows and row-major polynomial matrices. The multiplication and reduction entry points take explicit univariate operation contexts so concrete fields can supply fast polynomial arithmetic.

def CompPoly.PolynomialMatrix.truncateX {F : Type u_1} [Zero F] [BEq F] [LawfulBEq F] (order : ) (p : CPolynomial F) :

Keep the coefficients of degree < order.

Instances For
    theorem CompPoly.PolynomialMatrix.truncateX_coeff {F : Type u_1} [Semiring F] [BEq F] [LawfulBEq F] (order : ) (p : CPolynomial F) (i : ) :
    (truncateX order p).coeff i = if i < order then p.coeff i else 0

    Coefficients of an X-adic truncation.

    Polynomial-matrix low-product backend. The full multiplication context is kept beside the low-product operation because recursive PM-basis still needs ordinary basis composition.

    Instances For

      Low-product backend obtained by truncating a full univariate product.

      Instances For

        Low-product backend backed directly by a raw low-product implementation.

        Instances For
          def CompPoly.PolynomialMatrix.ofFn {F : Type u_1} [Zero F] (rows width : ) (entry : CPolynomial F) :

          Build a row-major polynomial matrix from an indexed entry function.

          Instances For
            def CompPoly.PolynomialMatrix.zero {F : Type u_1} [Zero F] (rows width : ) :

            The zero matrix of a fixed shape.

            Instances For

              The polynomial identity matrix of size n.

              Instances For

                Matrix transpose, using zero defaults for ragged input rows.

                Instances For

                  Dot product of two polynomial rows using an explicit univariate multiplication context.

                  Instances For

                    Row-by-matrix product using an explicit univariate multiplication context.

                    Instances For

                      Matrix product using an explicit univariate multiplication context.

                      Instances For

                        Matrix product backed by canonical univariate multiplication.

                        Instances For

                          Pointwise matrix addition, using zero defaults for ragged inputs.

                          Instances For

                            Pointwise matrix subtraction, using zero defaults for ragged inputs.

                            Instances For
                              def CompPoly.PolynomialMatrix.block {F : Type u_1} [Zero F] (M : PolynomialMatrix F) (rowStart rowCount colStart colCount : ) :

                              Extract a rectangular block with zero defaults for out-of-range entries.

                              Instances For
                                def CompPoly.PolynomialMatrix.joinSquareBlocks {F : Type u_1} [Zero F] (half : ) (C₁₁ C₁₂ C₂₁ C₂₂ : PolynomialMatrix F) :

                                Join four equally sized square blocks into one square matrix.

                                Instances For

                                  Fuel-bounded doubling loop for the smallest power of two at least target.

                                  Instances For

                                    Smallest power of two at least target, with 1 returned for 0.

                                    Instances For

                                      Runtime dimension controlling rectangular polynomial-matrix multiplication.

                                      Instances For

                                        Pad a matrix to an n × n square using the zero-default block extractor.

                                        Instances For

                                          Trim a matrix to a rectangular output shape.

                                          Instances For

                                            Slice count natural-number entries, using zero defaults out of bounds.

                                            Instances For

                                              Pointwise maximum of two natural-number arrays.

                                              Instances For

                                                Number of coefficients needed to represent a polynomial exactly.

                                                Instances For

                                                  Number of low coefficients sufficient for one product term exactly.

                                                  Instances For

                                                    Per-entry coefficient cap for one row-by-matrix product entry.

                                                    Instances For

                                                      Truncate one row with independent output-column orders.

                                                      Instances For

                                                        Truncate a matrix with independent output-column orders.

                                                        Instances For

                                                          Multiply and retain only coefficients of degree < order.

                                                          Instances For
                                                            def CompPoly.PolynomialMatrix.mulLowXWith {F : Type u_1} [Semiring F] [BEq F] [LawfulBEq F] (lowCtx : MulLowContext F) (order : ) (p q : CPolynomial F) :

                                                            Low-product entry point for the first order coefficients.

                                                            Instances For
                                                              def CompPoly.PolynomialMatrix.divXTrunc {F : Type u_1} [Zero F] [BEq F] [LawfulBEq F] (shift order : ) (p : CPolynomial F) :

                                                              Divide by X^shift and keep order coefficients.

                                                              Instances For

                                                                Reduce by a monic modulus when one is present. A zero modulus is treated as an absent modulus and leaves the input unchanged.

                                                                Instances For

                                                                  Reduce a row by independent diagonal moduli. The output width is the number of supplied moduli.

                                                                  Instances For

                                                                    Reduce every matrix row by independent diagonal moduli.

                                                                    Instances For

                                                                      Row-by-matrix product followed by diagonal modular reduction.

                                                                      Instances For

                                                                        Row-by-matrix product with independent output-column truncation. Column j keeps coefficients of degree < orders[j]; this is the residual-window primitive used by recursive PM-basis.

                                                                        Instances For

                                                                          Matrix product with independent output-column truncation.

                                                                          Instances For

                                                                            Fuel-bounded Strassen-style matrix product with independent output-column truncation orders.

                                                                            Instances For
                                                                              def CompPoly.PolynomialMatrix.mulTruncColumnStrassenWith {F : Type u_1} [Ring F] [BEq F] [LawfulBEq F] (lowCtx : MulLowContext F) (leafCutoff : ) (orders : Array ) (A B : PolynomialMatrix F) :

                                                                              Strassen-style matrix product with independent output-column truncation orders and conservative default fuel.

                                                                              Instances For

                                                                                Row-by-matrix product with per-output-entry degree caps inferred from input degree profiles. This reconstructs the exact row product while routing every term through low-product multiplication.

                                                                                Instances For

                                                                                  Matrix product reconstructed from inferred per-entry degree caps. Recursive composition uses this only as its small-leaf and fuel-exhausted fallback.

                                                                                  Instances For

                                                                                    Fuel-bounded Strassen-style matrix product.

                                                                                    Small inputs and exhausted fuel use the bounded row-column product. Larger rectangular or odd-sized inputs are padded to square power-of-two shape, routed through the recursive block product, and trimmed back to the requested output shape.

                                                                                    Instances For
                                                                                      def CompPoly.PolynomialMatrix.mulStrassenWith {F : Type u_1} [Ring F] [BEq F] [LawfulBEq F] (lowCtx : MulLowContext F) (leafCutoff : ) (A B : PolynomialMatrix F) :

                                                                                      Strassen-style matrix product with a conservative default fuel.

                                                                                      Instances For

                                                                                        Executable modular-equation row predicate.

                                                                                        Instances For

                                                                                          Shifted row-degree profile for all rows.

                                                                                          Instances For
                                                                                            structure CompPoly.PolynomialMatrix.RowChoice (F : Type u_2) [Zero F] :
                                                                                            Type u_2

                                                                                            Candidate row selected by least-shifted-degree scanning.

                                                                                            Instances For
                                                                                              def CompPoly.PolynomialMatrix.betterRowChoice {F : Type u_1} [Zero F] (candidate current : RowChoice F) :

                                                                                              Tie-breaking order for least-shifted-degree row selection.

                                                                                              Instances For

                                                                                                One left-to-right scan step for least-shifted-degree row selection.

                                                                                                Instances For

                                                                                                  Scan row indices for the best least-shifted-degree candidate.

                                                                                                  Instances For

                                                                                                    Select a nonzero row of least shifted degree.

                                                                                                    Instances For