MultivariateBases

MultivariateBases.jl is a standardized API for multivariate polynomial bases based on the MultivariatePolynomials API.

Basis elements

Monomial basis

MultivariateBases.ScaledMonomial — Type
struct ScaledMonomial <: AbstractMonomialBasis end

Scaled monomial basis (see [Section 3.1.5, BPT12]) with the monomials of the vector monomials. Given a monomial $x^\alpha = x_1^{\alpha_1} \cdots x_n^{\alpha_n}$ of degree $d = \sum_{i=1}^n \alpha_i$, the corresponding polynomial of the basis is

\[{d \choose \alpha}^{\frac{1}{2}} x^{\alpha} \quad \text{ where } \quad {d \choose \alpha} = \frac{d!}{\alpha_1! \alpha_2! \cdots \alpha_n!}.\]

For instance, create a polynomial with the basis $[xy^2, xy]$ creates the polynomial $\sqrt{3} a xy^2 + \sqrt{2} b xy$ where a and b are new JuMP decision variables. Constraining the polynomial $axy^2 + bxy$ to be zero with the scaled monomial basis constrains a/√3 and b/√2 to be zero.

This basis is orthonormal under the scalar product:

\[\langle f, g \rangle = \int_{\mathcal{C}^n} f(z) \overline{g(z)} d\nu_n\]

where $\nu_n$ is the Gaussian measure on $\mathcal{C}^n$ with the density $\pi^{-n} \exp(-\lVert z \rVert^2)$. See [Section 4; B07] for more details.

[BPT12] Blekherman, G.; Parrilo, P. A. & Thomas, R. R. Semidefinite Optimization and Convex Algebraic Geometry. Society for Industrial and Applied Mathematics (2012).

[B07] Barvinok, Alexander. Integration and optimization of multivariate polynomials by restriction onto a random subspace. Foundations of Computational Mathematics 7.2 (2007): 229-244.

source

Orthogonal basis

MultivariateBases.AbstractMultipleOrthogonal — Type
abstract type AbstractMultipleOrthogonal <: AbstractMonomialIndexed end

Polynomial basis such that $\langle p_i(x), p_j(x) \rangle = 0$ if $i \neq j$ where

\[\langle p(x), q(x) \rangle = \int p(x)q(x) w(x) dx\]

where the weight is a product of weight functions $w(x) = w_1(x_1)w_2(x_2) \cdots w_n(x_n)$ in each variable. The polynomial of the basis are product of univariate polynomials: $p(x) = p_1(x_1)p_2(x_2) \cdots p_n(x_n)$. where the univariate polynomials of variable x_i form an univariate orthogonal basis for the weight function w_i(x_i). Therefore, they satisfy the recurrence relation

\[d_k p_k(x_i) = (a_k x_i + b_k) p_{k-1}(x_i) + c_k p_{k-2}(x_i)\]

where reccurence_first_coef gives a_k, reccurence_second_coef gives b_k, reccurence_third_coef gives c_k and reccurence_deno_coef gives d_k.

source
MultivariateBases.univariate_orthogonal_basis — Function
univariate_orthogonal_basis(
    B::Type{<:AbstractMultipleOrthogonal},
    variable::MP.AbstractVariable,
    degree::Integer,
)

Return the vector of univariate polynomials of the basis B up to degree with variable variable.

source
MultivariateBases.reccurence_first_coef — Function
reccurence_first_coef(B::Type{<:AbstractMultipleOrthogonal}, degree::Integer)

Return a_{degree} in recurrence equation

\[d_k p_k(x_i) = (a_k x_i + b_k) p_{k-1}(x_i) + c_k p_{k-2}(x_i)\]

source
MultivariateBases.reccurence_second_coef — Function
reccurence_second_coef(B::Type{<:AbstractMultipleOrthogonal}, degree::Integer)

Return b_{degree} in recurrence equation

\[d_k p_k(x_i) = (a_k x_i + b_k) p_{k-1}(x_i) + c_k p_{k-2}(x_i)\]

source
MultivariateBases.reccurence_third_coef — Function
reccurence_third_coef(B::Type{<:AbstractMultipleOrthogonal}, degree::Integer)

Return c_{degree} in recurrence equation

\[d_k p_k(x_i) = (a_k x_i + b_k) p_{k-1}(x_i) + c_k p_{k-2}(x_i)\]

source
MultivariateBases.reccurence_deno_coef — Function
reccurence_deno_coef(B::Type{<:AbstractMultipleOrthogonal}, degree::Integer)

Return d_{degree} in recurrence equation

\[d_k p_k(x_i) = (a_k x_i + b_k) p_{k-1}(x_i) + c_k p_{k-2}(x_i)\]

source
MultivariateBases.ProbabilistsHermite — Type
struct ProbabilistsHermiteBasis{P} <: AbstractHermiteBasis{P}
    polynomials::Vector{P}
end

Orthogonal polynomial with respect to the univariate weight function $w(x) = \exp(-x^2/2)$ over the interval $[-\infty, \infty]$.

source
MultivariateBases.PhysicistsHermite — Type
struct PhysicistsHermite{P} <: AbstractHermite{P}
    polynomials::Vector{P}
end

Orthogonal polynomial with respect to the univariate weight function $w(x) = \exp(-x^2)$ over the interval $[-\infty, \infty]$.

source
MultivariateBases.Laguerre — Type
struct LaguerreBasis <: AbstractMultipleOrthogonal end

Orthogonal polynomial with respect to the univariate weight function $w(x) = \exp(-x)$ over the interval $[0, \infty]$.

source
MultivariateBases.AbstractGegenbauer — Type
struct AbstractGegenbauer <: AbstractMultipleOrthogonal end

Orthogonal polynomial with respect to the univariate weight function $w(x) = (1 - x^2)^{\alpha - 1/2}$ over the interval $[-1, 1]$.

source
MultivariateBases.Legendre — Type
struct Legendre <: AbstractGegenbauer end

Orthogonal polynomial with respect to the univariate weight function $w(x) = 1$ over the interval $[-1, 1]$.

source
MultivariateBases.ChebyshevFirstKind — Type
struct ChebyshevFirstKind <: AbstractChebyshev end

Orthogonal polynomial with respect to the univariate weight function $w(x) = \frac{1}{\sqrt{1 - x^2}}$ over the interval $[-1, 1]$.

source
MultivariateBases.ChebyshevSecondKind — Type
struct ChebyshevSecondKind <: AbstractChebyshevBasis end

Orthogonal polynomial with respect to the univariate weight function $w(x) = \sqrt{1 - x^2}$ over the interval $[-1, 1]$.

source
MultivariateBases.Trigonometric — Type
struct Trigonometric <: AbstractMonomialIndexed end

Univariate trigonometric basis is

a0 + a1 cos(ωt) + a2 sin(ωt) + a3 cos(2ωt) + a4 sin(2ωt)
source

Additional basis

Quotient basis

MultivariateBases.QuotientBasis — Type
struct QuotientBasis{T,I,B<:SA.AbstractBasis{T,I},M<:AbstractMatrix} <:
    SA.ExplicitBasis{T,I}
    basis::B
    matrix::M
end

Basis of the quotient of the span of basis by the kernel of matrix. The coefficients of a polynomial p in this basis are matrix * a where a is the vector of coefficients of p in basis. In particular, p is zero in the quotient if and only if matrix * a is zero. The adjoint map sends the coefficients c in this basis to the coefficients transpose(matrix) * c in basis.

To represent the quotient of the span V of basis modulo an ideal J, the only requirement on matrix is that its kernel is J ∩ V, i.e., matrix * a is zero if and only if the polynomial with coefficients a belongs to J. Recombining the rows of matrix with an invertible matrix does not change its kernel so it represents the same quotient, only its coordinates change. If the rows of matrix are linearly independent, the length of the basis is the dimension of the quotient. Two typical choices are:

  • If a Gröbner basis of J is known, matrix[i, j] is the coefficient of the ith standard monomial in the remainder of the jth element of basis modulo the Gröbner basis. For instance, modulo x^2 + 1, the basis [1, x, x^2, x^3] gives matrix = [1 0 -1 0; 0 1 0 -1].
  • Otherwise, J can be replaced by its truncation J_d where d is the maximal degree of basis. J_d is the row space of the Macaulay matrix of degree d, i.e., the span of m * h for each generator h of J and monomial m such that the degree of m * h is at most d. The rows of matrix can be the reduced row echelon form of a basis of the linear equations defining J_d ∩ V. Then matrix * a gives the coefficients of the truncated normal form: the unique polynomial supported on the pivot monomials that is congruent to p modulo J_d. Note that J_d ∩ V may be strictly contained in J ∩ V if a combination of generators has a degree smaller than the generators that are combined (a degree fall).
source

Macaulay matrix

MultivariateBases.LazyMatrix — Type
mutable struct LazyMatrix{T,P,V,B}
    polynomials::V
    row_shifts::B
    shift_statuses::Vector{Vector{ShiftStatus}}
    column_basis::B
end

Macaulay matrix of the polynomials polynomials in the variables MP.variables(column_basis). The rows are the polynomials shift * polynomials[j] for each shift in row_shifts and j such that shift_statuses[i][j] is INCLUDED or NOT_REDUNDANT where i is the index of shift in row_shifts. The columns are indexed by the monomials of column_basis. The rows can be added with expand! and the matrix can be built with SparseArrays.sparse.

source
MultivariateBases.macaulay — Function
macaulay(polynomials, maxdegree, variables = MP.variables(polynomials); kws...)

Return the LazyMatrix of the Macaulay matrix of degree maxdegree of polynomials in the variables variables. The keyword arguments are passed to expand!.

source
MultivariateBases.expand! — Function
expand!(M::LazyMatrix, shifts_selector::AbstractShiftsSelector; sparse_columns::Bool = true)

Add the row shifts selected by shifts_selector. If sparse_columns is false then all monomials of degree up to the maximal degree of the columns will be added to the columns. Otherwise, only the columns that correspond to the monomial of one of the shifted polynomials will be added. Return the number of rows added.

source
MultivariateBases.ColumnDegrees — Type
struct ColumnDegrees{V} <: AbstractShiftsSelector
    degrees::V
end

Select the shifts such that the maxdegree of the shifted polynomial is in degrees.

source
MultivariateBases.TargetColumns — Type
struct TargetColumns{M} <: AbstractShiftsSelector
    targets::Vector{M}
end

Select the shifts such that one of the monomials of the shifted polynomial is in targets.

source
MultivariateBases.LeadingTargetColumns — Type
struct LeadingTargetColumns{M} <: AbstractShiftsSelector
    targets::Vector{M}
end

Select the shifts such that the leading monomial of the shifted polynomial is in targets.

source
MultivariateBases.ShiftStatus — Type
@enum(ShiftStatus, NOT_INCLUDED, INCLUDED, NOT_REDUNDANT, REDUNDANT)
  • NOT_INCLUDED : Not included yet in the rows of the Macaulay matrix
  • INCLUDED : Already included in the rows of the Macaulay matrix but redundancy unknown
  • NOT_REDUNDANT : Already included in the rows of the Macaulay matrix and no redundancy with the other rows included
  • REDUNDANT : Redundant with another row already included in the Macaulay matrix
source
MultivariateBases.is_saturated — Function
is_saturated(M::LazyMatrix, col::MP.AbstractMonomialLike)

Return true if all possible shift of a polynomial such that col is one of the shifted monomial have been included.

source
MultivariateBases.is_forever_trivial — Function
is_forever_trivial(M::LazyMatrix, col::MP.AbstractMonomialLike)

Return true if there does not exists any shift (even outside of M.row_shifts) that such that the shift of any of the polynomial has col as one of its monomial.

source