TransportMaps.Maps.ComponentwiseMapBase

Module Contents

Classes

ComponentwiseMap

Map \(T({\bf x}) := [T_1({\bf x}_{{\bf j}_1}), \ldots, T_{d_y}({\bf x}_{{\bf j}_{d_y}})]^\top\), where \(T_i({\bf x}_{{\bf j}_i}):\mathbb{R}^{\text{dim}({\bf j}_i)}\rightarrow\mathbb{R}\).

class TransportMaps.Maps.ComponentwiseMapBase.ComponentwiseMap(**kwargs)[source]

Bases: TransportMaps.Maps.MapBase.Map

Map \(T({\bf x}) := [T_1({\bf x}_{{\bf j}_1}), \ldots, T_{d_y}({\bf x}_{{\bf j}_{d_y}})]^\top\), where \(T_i({\bf x}_{{\bf j}_i}):\mathbb{R}^{\text{dim}({\bf j}_i)}\rightarrow\mathbb{R}\).

get_ncalls_tree(indent='')[source]
get_nevals_tree(indent='')[source]
get_teval_tree(indent='')[source]
update_ncalls_tree(obj)[source]
update_nevals_tree(obj)[source]
update_teval_tree(obj)[source]
reset_counters()[source]
precomp_evaluate(x, precomp=None, precomp_type='uni')[source]

Precompute necessary structures for the evaluation of \(T({\bf x})\)

Enriches the dictionaries in the precomp list if necessary.

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points

  • precomp (dict) – list of dictionaries of precomputed values

  • precomp_type (str) – whether to precompute univariate Vandermonde matrices ‘uni’ or multivariate Vandermonde matrices ‘multi’

Returns:

(dict of list [\(d\)]

dict) – necessary structures

evaluate(x, precomp=None, idxs_slice=slice(None), cache=None)[source]

Evaluate the transport map at the points \({\bf x} \in \mathbb{R}^{m \times d}\).

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points

  • precomp (dict) – dictionary of precomputed values

  • idxs_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 match x.shape[0].

  • cache (dict) – cache

Returns:

(ndarray [\(m,d\)]) – transformed points

Raises:

ValueError – if \(d\) does not match the dimension of the transport map.

precomp_grad_x(x, precomp=None, precomp_type='uni')[source]

Precompute necessary structures for the evaluation of \(\nabla_{\bf x}T({\bf x},{\bf a})\)

Enriches the dictionaries in the precomp list if necessary.

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points

  • precomp (dict) – list of dictionaries of precomputed values

  • precomp_type (str) – whether to precompute univariate Vandermonde matrices ‘uni’ or multivariate Vandermonde matrices ‘multi’

Returns:

(dict of list [\(d\)]

dict) – necessary structures

grad_x(x, precomp=None, idxs_slice=slice(None), *args, **kwargs)[source]

Compute \(\nabla_{\bf x} T({\bf x})\).

This is

\nabla_{\bf x} T({\bf x},{\bf a}) = \begin{bmatrix} \nabla_{\bf x} T_1({\bf x}) \\ \nabla_{\bf x} T_2({\bf x}) \\ \vdots \\ \nabla_{\bf x} T_d({\bf x}) \end{bmatrix}

for every evaluation point.

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points

  • precomp (dict) – dictionary of precomputed values

  • idxs_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 match x.shape[0].

Returns:

(ndarray [\(m,d,d\)]) – gradient matrices for every evaluation point.

Raises:

ValueError – if \(d\) does not match the dimension of the transport map.

precomp_hess_x(x, precomp=None, precomp_type='uni')[source]

Precompute necessary structures for the evaluation of \(\nabla^2_{\bf x}T({\bf x})\)

Enriches the dictionaries in the precomp list if necessary.

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points

  • precomp (dict) – list of dictionaries of precomputed values

  • precomp_type (str) – whether to precompute univariate Vandermonde matrices ‘uni’ or multivariate Vandermonde matrices ‘multi’

Returns:

(dict of list [\(d\)]

dict) – necessary structures

hess_x(x, precomp=None, idxs_slice=slice(None), *args, **kwargs)[source]

Compute \(\nabla^2_{\bf x} T({\bf x})\).

This is the tensor

\[\left[\nabla^2_{\bf x} T({\bf x})\right]_{i,k,:,:} = \nabla^2_{\bf x} T_k({\bf x}^{(i)})\]
Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points

  • precomp (dict) – dictionary of precomputed values

  • idxs_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 match x.shape[0].

Returns:

(ndarray [\(m,d,d,d\)]) – Hessian matrices for every evaluation point and every dimension.

Raises:

ValueError – if \(d\) does not match the dimension of the transport map.

action_hess_x(x, dx, precomp=None, idxs_slice=slice(None), *args, **kwargs)[source]

Compute \(\langle\nabla^2_{\bf x} T({\bf x}),\delta{\bf x}\rangle\).

This is the tensor

\[\left[\nabla^2_{\bf x} T({\bf x})\right]_{i,k,:i} = \langle \nabla^2_{\bf x} T_k({\bf x}^{(i)}), \delta{\bf x}\rangle\]
Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points

  • dx (ndarray [\(m,d\)]) – direction on which to evaluate the Hessian

  • precomp (dict) – dictionary of precomputed values

  • idxs_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 match x.shape[0].

Returns:

(ndarray [\(m,d,d\)]) – Hessian matrices for every evaluation point and every dimension.

Raises:

ValueError – if \(d\) does not match the dimension of the transport map.