Basis¶
Tensor Product Bases of Bounded Total Degree¶
Abstract Base Class¶

class
psdr.
PolynomialTensorBasis
(degree, X=None, dim=None)[source]¶ Generic tensor product basis of fixed total degree
This class constructs a tensor product basis of dimension \(n\) of fixed given degree \(p\) given a basis for polynomials in one variable. Namely, this basis is composed of elements:
\[\psi_j(\mathbf x) := \prod_{i=1}^n \phi_{[\boldsymbol \alpha_j]_i}(x_i) \quad \sum_{i=1}^n [\boldsymbol \alpha_j]_i \le p; \quad \phi_i \in \mathcal{P}_{i}(\mathbb{R})\]Parameters:  dim (int) – The input dimension of the space
 degree (int) – The total degree of polynomials
 polyvander (function) – Function providing the scalar Vandermonde matrix (i.e., numpy.polynomial.polynomial.polyvander)
 polyder (function) – Function providing the derivatives of scalar polynomials (i.e., numpy.polynomial.polynomial.polyder)

DDV
(X)[source]¶ Columnwise second derivative of the Vandermonde matrix
Given points \(\mathbf x_i \in \mathbb{R}^n\), this creates the Vandermondelike matrix whose entries correspond to the derivatives of each of basis elements; i.e.,
\[[\mathbf{V}]_{i,j} = \left. \frac{\partial^2}{\partial x_k\partial x_\ell} \psi_j(\mathbf{x}) \right_{\mathbf{x} = \mathbf{x}_i}.\]Parameters: X (arraylike (M, n)) – Points at which to evaluate the basis at where X[i]
is one such point in \(\mathbf{R}^m\).Returns: Vpp – Second derivative of Vandermonde matrix where Vpp[i,j,:,:]
is the Hessian ofV[i,j]
.Return type: np.array (M, N, n, n)

DV
(X)[source]¶ Columnwise derivative of the Vandermonde matrix
Given points \(\mathbf x_i \in \mathbb{R}^n\), this creates the Vandermondelike matrix whose entries correspond to the derivatives of each of basis elements; i.e.,
\[[\mathbf{V}]_{i,j} = \left. \frac{\partial}{\partial x_k} \psi_j(\mathbf{x}) \right_{\mathbf{x} = \mathbf{x}_i}.\]Parameters: X (arraylike (M, n)) – Points at which to evaluate the basis at where X[i]
is one such point in \(\mathbf{R}^n\).Returns: Vp – Derivative of Vandermonde matrix where Vp[i,j,:]
is the gradient ofV[i,j]
.Return type: np.array (M, N, n)

V
(X=None)[source]¶ Builds the Vandermonde matrix associated with this basis
Given points \(\mathbf x_i \in \mathbb{R}^n\), this creates the Vandermonde matrix
\[[\mathbf{V}]_{i,j} = \phi_j(\mathbf x_i)\]where \(\phi_j\) is a multivariate polynomial as defined in the class definition.
Parameters: X (arraylike (M, n)) – Points at which to evaluate the basis at where X[i]
is one such point in \(\mathbf{R}^n\).Returns: V – Vandermonde matrix Return type: np.array

VC
(X, c)[source]¶ Evaluate the product of the Vandermonde matrix and a vector
This evaluates the product \(\mathbf{V}\mathbf{c}\) where \(\mathbf{V}\) is the Vandermonde matrix defined in
V
. This is done without explicitly constructing the Vandermonde matrix to save memory.Parameters:  X (arraylike (M,n)) – Points at which to evaluate the basis at where
X[i]
is one such point in \(\mathbf{R}^n\).  c (arraylike) – The vector to take the inner product with.
Returns: Vc – Product of Vandermonde matrix and \(\mathbf c\)
Return type: np.array (M,)
 X (arraylike (M,n)) – Points at which to evaluate the basis at where
Specific Bases¶

class
psdr.
MonomialTensorBasis
(*args, **kwargs)[source]¶ A tensor product basis of bounded total degree built from the monomials

class
psdr.
LegendreTensorBasis
(*args, **kwargs)[source]¶ A tensor product basis of bounded total degree built from the Legendre polynomials

class
psdr.
ChebyshevTensorBasis
(*args, **kwargs)[source]¶ A tensor product basis of bounded total degree built from the Chebyshev polynomials