TransportMaps.Maps.Functionals.LinearSpanTensorizedParametricFunctionalBase
¶
Module Contents¶
Classes¶
A DecreasingCoordinateSemilattice is a semilattice \((\mathcal{S}\,\le)\) that is closed under meets, |
|
A vertex that is |
|
Parametric function \(f_{\bf a} = \sum_{{\bf i} \in \mathcal{I}} {\bf a}_{\bf i} \Phi_{\bf i}\) |
|
Parametric function \(f_{\bf a} = \sum_{{\bf i} \in \mathcal{I}} {\bf a}_{\bf i} \Phi_{\bf i}\) |
- class TransportMaps.Maps.Functionals.LinearSpanTensorizedParametricFunctionalBase.LinearSpanSemilattice(*args, **kwargs)[source]¶
Bases:
semilattices.DecreasingCoordinateSemilattice
A DecreasingCoordinateSemilattice is a semilattice \((\mathcal{S}\,\le)\) that is closed under meets, that is it is decreasing: \(x \le y \implies x \in \mathcal{S}\). A decreasing semilattice is often called ‘downward-closed, or ‘admissible’ when the semilattice is interpreted as a multiindex set parameterizing quadrature or interpolation problems
- Parameters:
dims (int) – semilattice dimension (maximum number of children per vertex)
VertexConstructor (class) – type of vertices in the semilattice. It must extend
SparseCoordinateVertex
- class TransportMaps.Maps.Functionals.LinearSpanTensorizedParametricFunctionalBase.LinearSpanVertex(*args, **kwargs)[source]¶
Bases:
semilattices.SparseCoordinateVertex
A vertex that is
CoordinateVertex
andSparseVertex
.
- class TransportMaps.Maps.Functionals.LinearSpanTensorizedParametricFunctionalBase.LinearSpanTensorizedParametricFunctional(basis_list, q=None, p=1.0, w=None, SemilatticeConstructor=LinearSpanSemilattice, semilattice=None, spantype=None, order_list=None, multi_idxs=None, full_basis_list=None)[source]¶
Bases:
TransportMaps.Maps.Functionals.TensorizedParametricFunctionalBase.TensorizedParametricFunctional
Parametric function \(f_{\bf a} = \sum_{{\bf i} \in \mathcal{I}} {\bf a}_{\bf i} \Phi_{\bf i}\)
The set of multi-indices \(\mathcal{I}\) is generated using the module
semilattices
. Given a dimension \(d\), anorm
\(q\), an order \(p\geq 0\) and weights \(\{w_i \geq 1\}_{i=1}^d\),\[\mathcal{I} := \left\{ {\bf i} \middle\vert \left\Vert{\bf i}\right\Vert_{\ell^p_W} = \left( \sum_{j=1}^d w_j \left\vert {\bf i}_j \right\vert^p \right)^{1/p} <= q \right\}\]For example, \(p=1\) and \(w_i=1\) for all \(i\) results in isotropic total order sets (
spantype==total
in version<3.0
). For \(p=\inf\) and \(w_i=1\) for all \(i\) one gets isotropic full order sets (spantype==full
in version<3.0
).- Parameters:
basis_list (list) – list of \(d\)
OrthogonalBasis
q (float) – norm of the \(\ell^p\) spherical sector enclosing all multi-indices.
p (float) – the order \(p\) of the \(\ell^p\) norm.
w (
semilattices.SpaceWeightDict
) – Weightings for the \(\ell^p\) norm. Each dictionary key corresponds to a dimension \(i\) and each corresponding value is the weight \(w_i\). Weights must be>1
. Missing values are considered1
.SemilatticeConstructor (
class
) – constructor for the semilattice. It must be a sub-class ofLinearSpanSemilattice
.extra_label_keys (iterable of strings) – extra labels to be used to sort vertices in the semilattice.
extra_data_keys (iterable of strings) – extra keys referring to data contained in each vertex of the semilattice
semilattice (
semilattice
) – user provided semilattice to be used for handling of the degrees of freedom.spantype (str) – Span type. ‘total’ total order, ‘full’ full order, ‘midx’ multi-indeces specified. Deprecated since version
3.0
.order_list (
list
ofint
) – list of orders \(\{N_i\}_{i=0}^d\). Deprecated since version3.0
.multi_idxs (list) – list of tuples containing the active multi-indices
full_basis_list (list) – full list of
Basis
.basis_list
is a subset offull_basis_list
. This may be used to automatically increase the input dimension of the approximation.
- property semilattice[source]¶
The semilattice representing the degrees of freedom of the parametrization.
- property n_coeffs[source]¶
Get the number \(N\) of coefficients \({\bf a}\)
- Returns:
(
int
) – number of coefficients
- property directional_orders[source]¶
Get the maximum orders of the univariate part of the representation.
- get_directional_orders()[source]¶
Get the maximum orders of the univariate part of the representation.
Deprecated since version use: property
directional_orders()
- __setstate__(state)[source]¶
Defined to preserve compatibility with stored files where multi_idx is an attribute and not a property.
- precomp_Vandermonde_evaluate(x, precomp=None)[source]¶
Precompute the multi-variate Vandermonde matrices for the evaluation of \(f_{\bf a}\) at
x
.Enriches the
precomp
dictionary if necessary.
- evaluate(x, precomp=None, idxs_slice=slice(None), cache=None)[source]¶
Evaluate \(f_{\bf a}\) at
x
.- Parameters:
x (
ndarray
[\(m,d\)]) – evaluation pointsprecomp (
dict
) – dictionary of precomputed valuesidxs_slice (slice) – if precomputed values are present, this parameter indicates at which of the points to evaluate. The number of indices represented by
idxs_slice
must matchx.shape[0]
.cache (
dict
) – cache
- Returns:
(
ndarray
[\(m,1\)]) – function evaluations
- precomp_Vandermonde_grad_x(x, precomp=None)[source]¶
Precompute the multi-variate Vandermonde matrices for the evaluation of \(\nabla_{\bf x} f_{\bf a}\) at
x
- grad_x(x, precomp=None, idxs_slice=slice(None), cache=None)[source]¶
Evaluate \(\nabla_{\bf x} f_{\bf a}\) at
x
.- Parameters:
x (
ndarray
[\(m,d\)]) – evaluation pointsprecomp (
dict
) – dictionary of precomputed valuesidxs_slice (slice) – if precomputed values are present, this parameter indicates at which of the points to evaluate. The number of indices represented by
idxs_slice
must matchx.shape[0]
.cache (
dict
) – cache
- Returns:
- (
ndarray
[\(m,1,d\)]) – \(\nabla_{\bf x} f_{\bf a}({\bf x})\)
- (
- grad_a_grad_x(x, precomp=None, idxs_slice=slice(None), cache=None)[source]¶
Evaluate \(\nabla_{\bf a} \nabla_{\bf x} f_{\bf a}\) at
x
.- Parameters:
x (
ndarray
[\(m,d\)]) – evaluation pointsprecomp (
dict
) – dictionary of precomputed valuesidxs_slice (slice) – if precomputed values are present, this parameter indicates at which of the points to evaluate. The number of indices represented by
idxs_slice
must matchx.shape[0]
.cache (
dict
) – cache
- Returns:
- (
ndarray
[\(m,1,N,d\)]) – \(\nabla_{\bf a} \nabla_{\bf x} f_{\bf a}({\bf x})\)
- (
- precomp_Vandermonde_hess_x(x, precomp=None)[source]¶
Precompute the multi-variate Vandermonde matrices for the evaluation of \(\nabla^2_{\bf x} f_{\bf a}\) at
x
Enriches the
precomp
dictionary if necessary.
- hess_x(x, precomp=None, idxs_slice=slice(None), cache=None)[source]¶
Evaluate \(\nabla^2_{\bf x} f_{\bf a}\) at
x
.- Parameters:
x (
ndarray
[\(m,d\)]) – evaluation pointsprecomp (
dict
) – dictionary of precomputed valuesidxs_slice (slice) – if precomputed values are present, this parameter indicates at which of the points to evaluate. The number of indices represented by
idxs_slice
must matchx.shape[0]
.cache (
dict
) – cache
- Returns:
- (
ndarray
[\(m,1,d,d\)]) – \(\nabla^2_{\bf x} f_{\bf a}({\bf x})\)
- (
- grad_a_hess_x(x, precomp=None, idxs_slice=slice(None), cache=None)[source]¶
Evaluate \(\nabla_{\bf a} \nabla^2_{\bf x} f_{\bf a}\) at
x
.- Parameters:
x (
ndarray
[\(m,d\)]) – evaluation pointsprecomp (
dict
) – dictionary of precomputed valuesidxs_slice (slice) – if precomputed values are present, this parameter indicates at which of the points to evaluate. The number of indices represented by
idxs_slice
must matchx.shape[0]
.cache (
dict
) – cache
- Returns:
- (
ndarray
[\(m,1,N,d,d\)]) – \(\nabla_{\bf a} \nabla^2_{\bf x} f_{\bf a}({\bf x})\)
- (
- grad_a(x, precomp=None, idxs_slice=slice(None), cache=None)[source]¶
Evaluate \(\nabla_{\bf a} f_{\bf a}\) at
x
.- Parameters:
x (
ndarray
[\(m,d\)]) – evaluation pointsprecomp (
dict
) – dictionary of precomputed valuesidxs_slice (slice) – if precomputed values are present, this parameter indicates at which of the points to evaluate. The number of indices represented by
idxs_slice
must matchx.shape[0]
.cache (
dict
) – cache
- Returns:
- (
ndarray
[\(m,1,N\)]) – \(\nabla_{\bf a} f_{\bf a}({\bf x})\)
- (
- grad_a_t(x, precomp=None, idxs_slice=slice(None), cache=None)[source]¶
Evaluate \(\left(\nabla_{\bf a} f_{\bf a}\right)^T\) at
x
.- Parameters:
x (
ndarray
[\(m,d\)]) – evaluation pointsprecomp (
dict
) – dictionary of precomputed valuesidxs_slice (slice) – if precomputed values are present, this parameter indicates at which of the points to evaluate. The number of indices represented by
idxs_slice
must matchx.shape[0]
.cache (
dict
) – cache
- Returns:
- (
ndarray
[\(m,1,N\)]) – \(\left(\nabla_{\bf a} f_{\bf a}({\bf x}\right)^T)\)
- (
- precomp_VVT_evaluate(x, precomp=None)[source]¶
Precompute the product \(VV^T\) of the multi-variate Vandermonde matrices for the evaluation of \(f_{\bf a}\) at
x
.Enriches the
precomp
dictionary if necessary.
- grad_a_squared(x, precomp=None, idxs_slice=slice(None), cache=None)[source]¶
Evaluate \(\left(\nabla_{\bf a} f_{\bf a}\right)\left(\nabla_{\bf a} f_{\bf a}\right)^T\) at
x
.- Parameters:
x (
ndarray
[\(m,d\)]) – evaluation pointsprecomp (
dict
) – dictionary of precomputed valuesidxs_slice (slice) – if precomputed values are present, this parameter indicates at which of the points to evaluate. The number of indices represented by
idxs_slice
must matchx.shape[0]
.cache (
dict
) – cache
- Returns:
- (
ndarray
[\(m,1,N,N\)]) – \(\left(\nabla_{\bf a} f_{\bf a}\right)\left(\nabla_{\bf a} f_{\bf a}\right)^T\)
- (
- hess_a(x, precomp=None, idxs_slice=slice(None), *arg, **kwargs)[source]¶
Evaluate \(\nabla^2_{\bf a} f_{\bf a}\) at
x
.- Parameters:
- Returns:
- (
ndarray
[\(m,1,N,N\)]) – \(\nabla^2_{\bf a} f_{\bf a}({\bf x})\)
- (
- precomp_Vandermonde_partial_xd(x, precomp=None)[source]¶
Precompute multi-variate Vandermonde matrix for the evaluation of \(\partial_{x_d} f_{\bf a}\) at
x
.Enriches the
precomp
dictionary if necessary.
- partial_xd(x, precomp=None, idxs_slice=slice(None), cache=None)[source]¶
Evaluate \(\partial_{x_d} f_{\bf a}\) at
x
.- Parameters:
x (
ndarray
[\(m,d\)]) – evaluation pointsprecomp (
dict
) – dictionary of precomputed valuesidxs_slice (slice) – if precomputed values are present, this parameter indicates at which of the points to evaluate. The number of indices represented by
idxs_slice
must matchx.shape[0]
.cache (
dict
) – cache
- Returns:
- (
ndarray
[\(m,1\)]) – \(\partial_{x_d} f_{\bf a}({\bf x})\)
- (
- precomp_Vandermonde_grad_x_partial_xd(x, precomp=None)[source]¶
Precompute multi-variate Vandermonde matrices for the evaluation of \(\nabla_{\bf x}\partial_{x_d} f_{\bf a}\) at
x
.Enriches the
precomp
dictionary if necessary.
- grad_x_partial_xd(x, precomp=None, idxs_slice=slice(None), cache=None)[source]¶
Evaluate \(\nabla_{\bf x}\partial_{x_d} f_{\bf a}\) at
x
.- Parameters:
x (
ndarray
[\(m,d\)]) – evaluation pointsprecomp (
dict
) – dictionary of precomputed valuesidxs_slice (slice) – if precomputed values are present, this parameter indicates at which of the points to evaluate. The number of indices represented by
idxs_slice
must matchx.shape[0]
.cache (
dict
) – cache
- Returns:
- (
ndarray
[\(m,1,d\)]) – \(\nabla_{\bf x}\partial_{x_d} f_{\bf a}({\bf x})\)
- (
- grad_a_grad_x_partial_xd(x, precomp=None, idxs_slice=slice(None), cache=None)[source]¶
Evaluate \(\nabla_{\bf a}\nabla_{\bf x}\partial_{x_d} f_{\bf a}\) at
x
.- Parameters:
x (
ndarray
[\(m,d\)]) – evaluation pointsprecomp (
dict
) – dictionary of precomputed valuesidxs_slice (slice) – if precomputed values are present, this parameter indicates at which of the points to evaluate. The number of indices represented by
idxs_slice
must matchx.shape[0]
.cache (
dict
) – cache
- Returns:
- (
ndarray
[\(m,1,N,d\)]) – \(\nabla_{\bf a}\nabla_{\bf x}\partial_{x_d} f_{\bf a}({\bf x})\)
- (
- precomp_Vandermonde_hess_x_partial_xd(x, precomp=None)[source]¶
Precompute Vandermonde matrices for the evaluation of \(\nabla^2_{\bf x}\partial_{x_d} f_{\bf a}\) at
x
.Enriches the
precomp
dictionary if necessary.
- hess_x_partial_xd(x, precomp=None, idxs_slice=slice(None), *args, **kwargs)[source]¶
Evaluate \(\nabla^2_{\bf x}\partial_{x_d} f_{\bf a}\) at
x
.- Parameters:
- Returns:
- (
ndarray
[\(m,1,d,d\)]) – \(\nabla^2_{\bf x}\partial_{x_d} f_{\bf a}({\bf x})\)
- (
- grad_a_hess_x_partial_xd(x, precomp=None, idxs_slice=slice(None), *args, **kwars)[source]¶
Evaluate \(\nabla_{\bf a}\nabla^2_{\bf x}\partial_{x_d} f_{\bf a}\) at
x
.- Parameters:
- Returns:
- (
ndarray
[\(m,1,N,d,d\)]) – \(\nabla_{\bf a}\nabla^2_{\bf x}\partial_{x_d} f_{\bf a}({\bf x})\)
- (
- precomp_Vandermonde_partial2_xd(x, precomp=None)[source]¶
Precompute multi-variate Vandermonde matrix for the evaluation of \(\partial^2_{x_d} f_{\bf a}\) at
x
.Enriches the
precomp
dictionary if necessary.
- partial2_xd(x, precomp=None, idxs_slice=slice(None))[source]¶
Evaluate \(\partial^2_{x_d} f_{\bf a}\) at
x
.- Parameters:
- Returns:
- (
ndarray
[\(m,1\)]) – \(\partial^2_{x_d} f_{\bf a}({\bf x})\)
- (
- grad_a_partial_xd(x, precomp=None, idxs_slice=slice(None), cache=None)[source]¶
Evaluate \(\nabla_{\bf a}\partial_{x_d} f_{\bf a}\) at
x
.- Parameters:
x (
ndarray
[\(m,d\)]) – evaluation pointsprecomp (
dict
) – dictionary of precomputed valuesidxs_slice (slice) – if precomputed values are present, this parameter indicates at which of the points to evaluate. The number of indices represented by
idxs_slice
must matchx.shape[0]
.cache (
dict
) – cache
- Returns:
- (
ndarray
[\(m,1,N\)]) – \(\nabla_{\bf a}\partial_{x_d} f_{\bf a}({\bf x})\)
- (
- class TransportMaps.Maps.Functionals.LinearSpanTensorizedParametricFunctionalBase.LinearSpanApproximation(*args, **kwargs)[source]¶
Bases:
LinearSpanTensorizedParametricFunctional
Parametric function \(f_{\bf a} = \sum_{{\bf i} \in \mathcal{I}} {\bf a}_{\bf i} \Phi_{\bf i}\)
The set of multi-indices \(\mathcal{I}\) is generated using the module
semilattices
. Given a dimension \(d\), anorm
\(q\), an order \(p\geq 0\) and weights \(\{w_i \geq 1\}_{i=1}^d\),\[\mathcal{I} := \left\{ {\bf i} \middle\vert \left\Vert{\bf i}\right\Vert_{\ell^p_W} = \left( \sum_{j=1}^d w_j \left\vert {\bf i}_j \right\vert^p \right)^{1/p} <= q \right\}\]For example, \(p=1\) and \(w_i=1\) for all \(i\) results in isotropic total order sets (
spantype==total
in version<3.0
). For \(p=\inf\) and \(w_i=1\) for all \(i\) one gets isotropic full order sets (spantype==full
in version<3.0
).- Parameters:
basis_list (list) – list of \(d\)
OrthogonalBasis
q (float) – norm of the \(\ell^p\) spherical sector enclosing all multi-indices.
p (float) – the order \(p\) of the \(\ell^p\) norm.
w (
semilattices.SpaceWeightDict
) – Weightings for the \(\ell^p\) norm. Each dictionary key corresponds to a dimension \(i\) and each corresponding value is the weight \(w_i\). Weights must be>1
. Missing values are considered1
.SemilatticeConstructor (
class
) – constructor for the semilattice. It must be a sub-class ofLinearSpanSemilattice
.extra_label_keys (iterable of strings) – extra labels to be used to sort vertices in the semilattice.
extra_data_keys (iterable of strings) – extra keys referring to data contained in each vertex of the semilattice
semilattice (
semilattice
) – user provided semilattice to be used for handling of the degrees of freedom.spantype (str) – Span type. ‘total’ total order, ‘full’ full order, ‘midx’ multi-indeces specified. Deprecated since version
3.0
.order_list (
list
ofint
) – list of orders \(\{N_i\}_{i=0}^d\). Deprecated since version3.0
.multi_idxs (list) – list of tuples containing the active multi-indices
full_basis_list (list) – full list of
Basis
.basis_list
is a subset offull_basis_list
. This may be used to automatically increase the input dimension of the approximation.