Basis

Rountines for defining the index set associated with multivariate polynomials.

class equadratures.basis.Basis(basis_type, orders=None, level=None, growth_rule=None, q=None)[source]

Basis class constructor.

Parameters
  • basis_type (str) – The type of index set to be used. Options include: univariate, total-order, tensor-grid, sparse-grid, hyperbolic-basis [1] and euclidean-degree [2]; all basis are isotropic.

  • orders (list, optional) – List of integers corresponding to the highest polynomial order in each direction.

  • growth_rule (str, optional) – The type of growth rule associated with sparse grids. Options include: linear and exponential. This input is only required when using a sparse grid.

  • q (float, optional) – The q parameter is used to control the number of basis terms used in a hyperbolic basis (see [1]). Varies between 0.0 to 1.0. A value of 1.0 yields a total order basis.

Examples

>>> # Total order basis
>>> mybasis = eq.Basis('total-order', orders=[3,3,3])
>>> # Euclidean degree basis
>>> mybasis2 = eq.Basis('euclidean-degree', orders=[2,2])
>>> # Sparse grid basis
>>> mybasis3 = eq.Basis('sparse-grid', growth_rule='linear', level=3)

References

  1. Blatman, G., Sudret, B., (2011) Adaptive Sparse Polynomial Chaos Expansion Based on Least Angle Regression. Journal of Computational Physics, 230(6), 2345-2367.

  2. Trefethen, L., (2017) Multivariate Polynomial Approximation in the Hypercube. Proceedings of the American Mathematical Society, 145(11), 4837-4844. Pre-print.

get_basis()[source]

Gets the index set elements for the Basis object.

Returns

Elements associated with the multi-index set. For total-order, tensor-grid, hyperbolic-basis, hyperbolic-basis and euclidean-degree these correspond to the multi-index set elements within the set. For a sparse-grid the output will comprise of three arguments: (i) list of tensor grid orders (anisotropic), (ii) the positive and negative weights, and (iii) the individual sparse grid multi-index elements.

Return type

numpy.ndarray

Raises

ValueError – invalid value for basis_type!

get_cardinality()[source]

Returns the number of elements of an index set.

Returns

The number of multi-index elements of the basis.

Return type

int

get_elements()[source]

Returns the elements of an index set.

Returns

The multi-index elements of the basis.

Return type

numpy.ndarray

plot_index_set(ax=None, uncertainty=True, output_variances=None, number_of_points=200, show=True)[source]

Plot the index set. See plot_index_set() for full description.

prune(number_of_elements_to_delete)[source]

Prunes down the number of elements in an index set.

Parameters

number_of_elements_to_delete (int) – The number of multi-indices the user would like to delete.

Raises

ValueError – In Basis() –> prune(): Number of elements to be deleted must be greater than the total number of elements

set_orders(orders)[source]

Sets the highest order in each direction of the basis.

Parameters

orders (list) – The highest polynomial order along each dimension.

Raises

ValueError – Basis __init__: invalid value for basis_type!

sort()[source]

Routine that sorts a multi-index in ascending order based on the total orders. The constructor by default calls this function.