# TransportMaps.Maps.ParametricComponentwiseMapBase¶

## Module Contents¶

### Classes¶

 ParametricComponentwiseMap Map $$T[{\bf a}_{1:d_y}]({\bf x})= [T_1[{\bf a}_1]({\bf x}_{{\bf j}_{1}}),\ldots,T_{d_y}[{\bf a}_{d_y}]({\bf x}_{{\bf j}_{d_y}})]^\top$$, where $$T_i[{\bf a}_i]({\bf x}_{{\bf j}_{i}}):\mathbb{R}^{n_i}\times\mathbb{R}^{\text{dim}({{\bf j}_{i}})}\rightarrow\mathbb{R}$$.
class TransportMaps.Maps.ParametricComponentwiseMapBase.ParametricComponentwiseMap(**kwargs)[source]

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

property n_coeffs[source]

Returns the total number of coefficients.

Returns:

total number $$N$$ of coefficients characterizing the transport map.

property coeffs[source]

Returns the actual value of the coefficients.

Returns:

(ndarray [$$N$$]) – coefficients.

abstract get_identity_coeffs()[source]

[Abstract] Returns the coefficients corresponding to the identity map

Returns:

coefficients

Return type:

(ndarray [$$N$$])

Raises:

NotImplementedError – must be implemented in subclasses.

Compute $$\nabla_{\bf a} T[{\bf a}]({\bf x})$$

By the definition of the transport map $$T[{\bf a}]({\bf x})$$, the components $$T_1[{\bf a}^{(1)}] ({\bf x}_1)$$, $$T_2[{\bf a}^{(2)}] ({\bf x}_{1:2})$$, … are defined by different sets of parameters $${\bf a}^{(1)}$$, $${\bf a}^{(2)}$$, etc.

For this reason $$\nabla_{\bf a} T[{\bf a}]({\bf x})$$ is block diagonal:

\nabla_a T[{\bf a}]({\bf x}) = \begin{bmatrix} \left[ \nabla_{{\bf a}^{(1)}} T_1[{\bf a}^{(1)}] ({\bf x}_1) \right]^T & {\bf 0} & \cdots \\ {\bf 0} & \left[ \nabla_{{\bf a}^{(2)}} T_2[{\bf a}^{(2)}] ({\bf x}_{1:2}) \right]^T & \\ \vdots & & \ddots \end{bmatrix}

Consequentely this function will return only the diagonal blocks of the gradient.

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 (dics) – cache

Returns:

(list of ndarray [$$n_i$$]) –

list containing $$\nabla_{{\bf a}^{(1)}} T_1[{\bf a}^{(1)}] ({\bf x}_1)$$, $$\nabla_{{\bf a}^{(2)}} T_2[{\bf a}^{(2)}] ({\bf x}_{1:2})$$, etc.

Raises:

ValueError – if $$d$$ does not match the dimension of the transport map.

[Abstract] Compute $$\nabla_{\bf a} T^{-1}({\bf x},{\bf a})$$

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,N$$]) –

$$\nabla_{\bf a} T^{-1}({\bf x},{\bf a})$$

Raises:

ValueError – if $$d$$ does not match the dimension of the transport map.

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

Compute $$\nabla^2_{\bf a} T[{\bf a}]({\bf x})$$.

As in the case of grad_a(), the $$d \times N \times N$$ Hessian of T[{bf a}]({bf x}) is (hyper) block diagonal.

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:

(list of ndarray [$$n_i,n_i$$]) –

list containing $$\nabla^2_{{\bf a}^{(1)}} T_1[{\bf a}^{(1)}] ({\bf x}_1)$$, $$\nabla^2_{{\bf a}^{(2)}} T_2[{\bf a}^{(2)}] ({\bf x}_{1:2})$$, etc.

Raises:

ValueError – if $$d$$ does not match the dimension of the transport map.

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

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

As in the case of grad_a(), the :math:d times N  actions of the Hessian of T[{bf a}]({bf x}) is (hyper) block diagonal.

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

• da (ndarray [$$N$$]) – 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].

• cache (dict) – cache

Returns:

(list of ndarray [$$n_i,n_i$$]) –

list containing $$\langle\nabla^2_{{\bf a}^{(1)}} T_1[{\bf a}^{(1)}] ({\bf x}_1),\delta{\bf a}^{(1)}\rangle$$, $$\langle\nabla^2_{{\bf a}^{(2)}} T_2[{\bf a}^{(2)}] ({\bf x}_{1:2}),\delta{\bf a}^{(2)}\rangle$$, etc.

Raises:

ValueError – if $$d$$ does not match the dimension of the transport map.

Compute $$\nabla_{\bf a} \nabla_{\bf x} T[{\bf a}]({\bf x})$$

By the definition of the transport map $$T[{\bf a}]({\bf x})$$, the components $$T_1[{\bf a}^{(1)}] ({\bf x}_1)$$, $$T_2[{\bf a}^{(2)}] ({\bf x}_{1:2})$$, … are defined by different sets of parameters $${\bf a}^{(1)}$$, $${\bf a}^{(2)}$$, etc.

For this reason $$\nabla_{\bf a} \nabla_{\bf x} T[{\bf a}]({\bf x})$$ is block diagonal:

\nabla_a \nabla_{\bf x} T[{\bf a}]({\bf x}) = \begin{bmatrix} \left[ \nabla_{{\bf a}^{(1)}} \nabla_{\bf x}_1 T_1[{\bf a}^{(1)}] ({\bf x}_1) \right]^T & {\bf 0} & \cdots \\ {\bf 0} & \left[ \nabla_{{\bf a}^{(2)}} \nabla_{\bf x}_{1:2} T_2[{\bf a}^{(2)}] ({\bf x}_{1:2}) \right]^T & \\ \vdots & & \ddots \end{bmatrix}

Consequentely this function will return only the diagonal blocks of the gradient.

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:

(list of ndarray [$$n_i$$]) –

list containing $$\nabla_{{\bf a}^{(1)}} \nabla_{\bf x}_1 T_1[{\bf a}^{(1)}] ({\bf x}_1)$$, $$\nabla_{{\bf a}^{(2)}} \nabla_{\bf x}_{1:2} T_2[{\bf a}^{(2)}] ({\bf x}_{1:2})$$, etc.

Raises:

ValueError – if $$d$$ does not match the dimension of the transport map.

Compute $$\nabla_{\bf a} \nabla^2_{\bf x} T[{\bf a}]({\bf x})$$.

By the definition of the transport map $$T[{\bf a}]({\bf x})$$, the components $$T_1[{\bf a}^{(1)}] ({\bf x}_1)$$, $$T_2[{\bf a}^{(2)}] ({\bf x}_{1:2})$$, … are defined by different sets of parameters $${\bf a}^{(1)}$$, $${\bf a}^{(2)}$$, etc.

For this reason $$\nabla_{\bf a} \nabla^2_{\bf x} T[{\bf a}]({\bf x})$$ is block diagonal:

\nabla_a \nabla^2_{\bf x} T[{\bf a}]({\bf x}) = \begin{bmatrix} \left[ \nabla_{{\bf a}^{(1)}} \nabla^2_{\bf x}_1 T_1[{\bf a}^{(1)}] ({\bf x}_1) \right]^T & {\bf 0} & \cdots \\ {\bf 0} & \left[ \nabla_{{\bf a}^{(2)}} \nabla^2_{\bf x}_{1:2} T_2[{\bf a}^{(2)}] ({\bf x}_{1:2}) \right]^T & \\ \vdots & & \ddots \end{bmatrix}

Consequentely this function will return only the diagonal blocks of the hessian.

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:

(list of ndarray [$$n_i$$]) –

list containing $$\nabla_{{\bf a}^{(1)}} \nabla^2_{\bf x}_1 T_1[{\bf a}^{(1)}] ({\bf x}_1)$$, $$\nabla_{{\bf a}^{(2)}} \nabla^2_{\bf x}_{1:2} T_2[{\bf a}^{(2)}] ({\bf x}_{1:2})$$, etc.

Raises:

ValueError – if $$d$$ does not match the dimension of the transport map.