TransportMaps.Maps.FrozenTriangularTransportMaps

Module Contents

Classes

FrozenLinearDiagonalTransportMap

Linear diagonal transport map \((x_1,\ldots,x_d) \rightarrow (a_1+b_1 x_1, \ldots, a_d + b_d x_d)\)

FrozenExponentialDiagonalTransportMap

Exponential diagonal transport map \((x_1,\ldots,x_d) \rightarrow (\exp(x_1), \ldots, \exp(x_d))\)

FrozenNormalToUniformDiagonalTransportMap

Gaussian to Uniform diagonal transport map \((x_1,\ldots,x_d) \rightarrow (\frac{1}{2}[1+{\rm erf}(x_1/\sqrt{2})], \ldots, \frac{1}{2}[1+{\rm erf}(x_d/\sqrt{2})])\)

FrozenBananaMap

Transport map \(T({\bf x},{\bf a}): \mathbb{R}^d \rightarrow \mathbb{R}^d\).

Attributes

FrozenGaussianToUniformDiagonalTransportMap

class TransportMaps.Maps.FrozenTriangularTransportMaps.FrozenLinearDiagonalTransportMap(a, b)[source]

Bases: TransportMaps.Maps.TriangularComponentwiseTransportMapBase.TriangularComponentwiseTransportMap

Linear diagonal transport map \((x_1,\ldots,x_d) \rightarrow (a_1+b_1 x_1, \ldots, a_d + b_d x_d)\)

Parameters:
  • a (ndarray [\(d\)]) – coefficients

  • b (ndarray [\(d\)]) – coefficients

Note

This map is frozen, meaning that optimizing the coefficients with respect to a certain cost function is not allowed.

See also

TriangularTransportMap for a description of the overridden methods and FunctionalApproximations.FrozenLinear for a description of the linear approximation used for each component.

evaluate(x, *args, **kwargs)[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.

inverse(x, *args, **kwargs)[source]

Compute: \(T^{-1}({\bf y})\)

If the map has more input than outputs \(d_{\rm in} > d_{\rm out}\), it consider the first \(d_{\rm in} - d_{\rm out}\) values in x to be already inverted values and feed them to the following approximations to find the inverse.

If x has \(d < d_{\rm in}\), performs the inversion only on the \(d\) dimensional head of the map.

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\)]) – \(T^{-1}({\bf y})\) for every evaluation point

Raises:

ValueError – if \(d_{\rm in} < d_{\rm out}\)

grad_x(x, *args, **kwargs)[source]

This is a diagonal map

grad_x_inverse(x, *args, **kwargs)[source]

Compute \(\nabla_{\bf x} T^{-1}({\bf x})\).

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:

NotImplementedError – to be implemented in subclasses

det_grad_x(x, *args, **kwargs)[source]

[Abstract] Compute: \(\det \nabla_{\bf x} T({\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\)]) – \(\det \nabla_{\bf x} T({\bf x}, {\bf a})\) at every evaluation point

log_det_grad_x(x, *args, **kwargs)[source]

Compute: \(\log \det \nabla_{\bf x} T({\bf x})\).

Since the map is lower triangular,

\[\log \det \nabla_{\bf x} T({\bf x}) = \sum_{k=1}^d \log \partial_{{\bf x}_k} T_k({\bf x}_{1:k})\]
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\)]) – \(\log \det \nabla_{\bf x} T({\bf x})\) at every evaluation point

Raises:

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

log_det_grad_x_inverse(x, *args, **kwargs)[source]

Compute: \(\log \det \nabla_{\bf x} T^{-1}({\bf x})\).

Since the map is lower triangular,

\[\log \det \nabla_{\bf y} T^{-1}({\bf x}) = \sum_{k=1}^d \log \partial_{{\bf x}_k} T^{-1}_k({\bf y}_{1:k})\]

For \({\bf x} = T^{-1}({\bf y})\),

\[\log \det \nabla_{\bf y} T^{-1}({\bf x}) = - \sum_{k=1}^d \log \partial_{{\bf x}_k} T_k({\bf x}_{1:k})\]
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\)]) – \(\log \det \nabla_{\bf x} T({\bf x})\) at every evaluation point

Raises:

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

grad_x_log_det_grad_x(x, *args, **kwargs)[source]

Compute: \(\nabla_{\bf x} \log \det \nabla_{\bf x} T({\bf x})\)

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\)]) – \(\nabla_{\bf x} \log \det \nabla_{\bf x} T({\bf x})\) at every evaluation point

Raises:

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

See also

log_det_grad_x().

grad_x_log_det_grad_x_inverse(x, *args, **kwargs)[source]

[Abstract] Compute: \(\nabla_{\bf x} \log \det \nabla_{\bf x} 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\)]) – \(\nabla_{\bf x} \log \det \nabla_{\bf x} T^{-1}({\bf x}, {\bf a})\) at every evaluation point

See also

log_det_grad_x().

hess_x(x, *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.

hess_x_inverse(x, *args, **kwargs)[source]

[Abstract] Evaluate the Hessian of the Moore-Penrose inverse \(\nabla^2_{\bf x}T^\dagger\) at the points \({\bf x} \in \mathbb{R}^{m \times d_x}\).

Parameters:
  • x (ndarray [\(m,d_x\)]) – 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_y,d_x,d_x\)]) – transformed points

Raises:

NotImplementedError – to be implemented in sub-classes

action_hess_x(x, dx, *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.

action_hess_x_inverse(x, dx, *args, **kwargs)[source]

[Abstract] Evaluate the action of the Hessian of the Moore-Penrose inverse \(\langle\nabla^2_{\bf x}T^\dagger,\delta{\bf x}\rangle\) at the points \({\bf x} \in \mathbb{R}^{m \times d_x}\).

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

  • dx (ndarray [\(m,d_x\)]) – 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_y,d_x\)]) – transformed points

Raises:

NotImplementedError – to be implemented in sub-classes

hess_x_log_det_grad_x(x, *args, **kwargs)[source]

Compute: \(\nabla^2_{\bf x} \log \det \nabla_{\bf x} T({\bf x})\)

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\)]) – \(\nabla^2_{\bf x} \log \det \nabla_{\bf x} T({\bf x})\) at every evaluation point

Raises:

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

hess_x_log_det_grad_x_inverse(x, *args, **kwargs)[source]

[Abstract] Compute: \(\nabla^2_{\bf x} \log \det \nabla_{\bf x} 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,d\)]) – \(\nabla^2_{\bf x} \log \det \nabla_{\bf x} T^{-1}({\bf x}, {\bf a})\) at every evaluation point

action_hess_x_log_det_grad_x(x, dx, *args, **kwargs)[source]

Compute: \(\langle\nabla^2_{\bf x} \log \det \nabla_{\bf x} T({\bf x}), \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\)]) – \(\langle\nabla^2_{\bf x} \log \det \nabla_{\bf x} T({\bf x}), \delta{\bf x}\rangle\) at every evaluation point

Raises:

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

action_hess_x_log_det_grad_x_inverse(x, dx, *args, **kwargs)[source]

[Abstract] Compute: \(\langle\nabla^2_{\bf x} \log \det \nabla_{\bf x} T^-1({\bf x}), \delta{\bf x}\rangle\)

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

  • dx (ndarray [\(m,d\)]) – directions 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\)]) – \(\langle\nabla^2_{\bf x} \log \det \nabla_{\bf x} T^-1({\bf x}), \delta{\bf x}\rangle\) at every evaluation point

class TransportMaps.Maps.FrozenTriangularTransportMaps.FrozenExponentialDiagonalTransportMap(dim)[source]

Bases: TransportMaps.Maps.TriangularComponentwiseTransportMapBase.TriangularComponentwiseTransportMap

Exponential diagonal transport map \((x_1,\ldots,x_d) \rightarrow (\exp(x_1), \ldots, \exp(x_d))\)

Parameters:

dim (int) – dimension \(d\) of the transport map

Note

This map is frozen, meaning that optimizing the coefficients with respect to a certain cost function is not allowed.

See also

TriangularTransportMap for a description of the overridden methods and FunctionalApproximations.FrozenExponential for a description of the exponential approximation used for each component.

evaluate(x, *args, **kwargs)[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.

grad_x(x, *args, **kwargs)[source]

This is a diagonal map

action_grad_x(x, dx, *args, **kwargs)[source]

[Abstract] Evaluate the action of the gradient \(\langle\nabla_{\bf x}T({\bf x}),\delta{\bf x}\rangle\) at the points \({\bf x} \in \mathbb{R}^{m \times d_x}\) on the vector \(\delta{\bf x}\).

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

  • dx (ndarray [\(m,d_x,...\)]) – vector \(\delta{\bf x}\)

  • 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_y,...\)]) – transformed points

Raises:

NotImplementedError – to be implemented in sub-classes

action_adjoint_grad_x(x, dx, *args, **kwargs)[source]

[Abstract] Evaluate the action of the gradient \(\langle\delta{\bf x},\nabla_{\bf x}T({\bf x})\rangle\) at the points \({\bf x} \in \mathbb{R}^{m \times d_x}\) on the vector \(\delta{\bf x}\).

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

  • dx (ndarray [\(m,d_x,...\)]) – vector \(\delta{\bf x}\)

  • 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_y,...\)]) – transformed points

Raises:

NotImplementedError – to be implemented in sub-classes

tuple_grad_x(x, *args, **kwargs)[source]

[Abstract] Evaluate the function and gradient.

Parameters:
  • x (ndarray [\(m,d_x\)]) – 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:

(tuple) – function and gradient evaluation

Raises:

NotImplementedError – to be implemented in sub-classes

action_tuple_grad_x(x, dx, *args, **kwargs)[source]

[Abstract] Evaluate the function and action of the gradient.

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

  • dx (ndarray [\(m,d_x,...\)]) – vector \(\delta{\bf x}\)

  • 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:

(tuple) – function and action of the gradient evaluation

Raises:

NotImplementedError – to be implemented in sub-classes

det_grad_x(x, *args, **kwargs)[source]

[Abstract] Compute: \(\det \nabla_{\bf x} T({\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\)]) – \(\det \nabla_{\bf x} T({\bf x}, {\bf a})\) at every evaluation point

log_det_grad_x(x, *args, **kwargs)[source]

Compute: \(\log \det \nabla_{\bf x} T({\bf x})\).

Since the map is lower triangular,

\[\log \det \nabla_{\bf x} T({\bf x}) = \sum_{k=1}^d \log \partial_{{\bf x}_k} T_k({\bf x}_{1:k})\]
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\)]) – \(\log \det \nabla_{\bf x} T({\bf x})\) at every evaluation point

Raises:

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

grad_x_log_det_grad_x(x, *args, **kwargs)[source]

Compute: \(\nabla_{\bf x} \log \det \nabla_{\bf x} T({\bf x})\)

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\)]) – \(\nabla_{\bf x} \log \det \nabla_{\bf x} T({\bf x})\) at every evaluation point

Raises:

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

See also

log_det_grad_x().

hess_x(x, *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, *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.

hess_x_log_det_grad_x(x, *args, **kwargs)[source]

Compute: \(\nabla^2_{\bf x} \log \det \nabla_{\bf x} T({\bf x})\)

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\)]) – \(\nabla^2_{\bf x} \log \det \nabla_{\bf x} T({\bf x})\) at every evaluation point

Raises:

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

action_hess_x_log_det_grad_x(x, dx, *args, **kwargs)[source]

Compute: \(\langle\nabla^2_{\bf x} \log \det \nabla_{\bf x} T({\bf x}), \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\)]) – \(\langle\nabla^2_{\bf x} \log \det \nabla_{\bf x} T({\bf x}), \delta{\bf x}\rangle\) at every evaluation point

Raises:

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

inverse(x, *args, **kwargs)[source]

Compute: \(T^{-1}({\bf y})\)

If the map has more input than outputs \(d_{\rm in} > d_{\rm out}\), it consider the first \(d_{\rm in} - d_{\rm out}\) values in x to be already inverted values and feed them to the following approximations to find the inverse.

If x has \(d < d_{\rm in}\), performs the inversion only on the \(d\) dimensional head of the map.

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\)]) – \(T^{-1}({\bf y})\) for every evaluation point

Raises:

ValueError – if \(d_{\rm in} < d_{\rm out}\)

grad_x_inverse(x, *args, **kwargs)[source]

Compute \(\nabla_{\bf x} T^{-1}({\bf x})\).

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:

NotImplementedError – to be implemented in subclasses

hess_x_inverse(x, *args, **kwargs)[source]

[Abstract] Evaluate the Hessian of the Moore-Penrose inverse \(\nabla^2_{\bf x}T^\dagger\) at the points \({\bf x} \in \mathbb{R}^{m \times d_x}\).

Parameters:
  • x (ndarray [\(m,d_x\)]) – 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_y,d_x,d_x\)]) – transformed points

Raises:

NotImplementedError – to be implemented in sub-classes

action_hess_x_inverse(x, dx, *args, **kwargs)[source]

[Abstract] Evaluate the action of the Hessian of the Moore-Penrose inverse \(\langle\nabla^2_{\bf x}T^\dagger,\delta{\bf x}\rangle\) at the points \({\bf x} \in \mathbb{R}^{m \times d_x}\).

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

  • dx (ndarray [\(m,d_x\)]) – 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_y,d_x\)]) – transformed points

Raises:

NotImplementedError – to be implemented in sub-classes

log_det_grad_x_inverse(x, *args, **kwargs)[source]

Compute: \(\log \det \nabla_{\bf x} T^{-1}({\bf x})\).

Since the map is lower triangular,

\[\log \det \nabla_{\bf y} T^{-1}({\bf x}) = \sum_{k=1}^d \log \partial_{{\bf x}_k} T^{-1}_k({\bf y}_{1:k})\]

For \({\bf x} = T^{-1}({\bf y})\),

\[\log \det \nabla_{\bf y} T^{-1}({\bf x}) = - \sum_{k=1}^d \log \partial_{{\bf x}_k} T_k({\bf x}_{1:k})\]
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\)]) – \(\log \det \nabla_{\bf x} T({\bf x})\) at every evaluation point

Raises:

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

grad_x_log_det_grad_x_inverse(x, *args, **kwargs)[source]

[Abstract] Compute: \(\nabla_{\bf x} \log \det \nabla_{\bf x} 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\)]) – \(\nabla_{\bf x} \log \det \nabla_{\bf x} T^{-1}({\bf x}, {\bf a})\) at every evaluation point

See also

log_det_grad_x().

hess_x_log_det_grad_x_inverse(x, *args, **kwargs)[source]

[Abstract] Compute: \(\nabla^2_{\bf x} \log \det \nabla_{\bf x} 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,d\)]) – \(\nabla^2_{\bf x} \log \det \nabla_{\bf x} T^{-1}({\bf x}, {\bf a})\) at every evaluation point

action_hess_x_log_det_grad_x_inverse(x, dx, *args, **kwargs)[source]

[Abstract] Compute: \(\langle\nabla^2_{\bf x} \log \det \nabla_{\bf x} T^-1({\bf x}), \delta{\bf x}\rangle\)

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

  • dx (ndarray [\(m,d\)]) – directions 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\)]) – \(\langle\nabla^2_{\bf x} \log \det \nabla_{\bf x} T^-1({\bf x}), \delta{\bf x}\rangle\) at every evaluation point

class TransportMaps.Maps.FrozenTriangularTransportMaps.FrozenNormalToUniformDiagonalTransportMap(dim)[source]

Bases: TransportMaps.Maps.TriangularComponentwiseTransportMapBase.TriangularComponentwiseTransportMap

Gaussian to Uniform diagonal transport map \((x_1,\ldots,x_d) \rightarrow (\frac{1}{2}[1+{\rm erf}(x_1/\sqrt{2})], \ldots, \frac{1}{2}[1+{\rm erf}(x_d/\sqrt{2})])\)

Parameters:

dim (int) – dimension \(d\) of the transport map

Note

This map is frozen, meaning that optimizing the coefficients with respect to a certain cost function is not allowed.

See also

TriangularTransportMap for a description of the overridden methods and FunctionalApproximations.FrozenGaussianToUniform for a description of the Gaussian to Uniform approximation used for each component.

TransportMaps.Maps.FrozenTriangularTransportMaps.FrozenGaussianToUniformDiagonalTransportMap[source]
class TransportMaps.Maps.FrozenTriangularTransportMaps.FrozenBananaMap(a, b)[source]

Bases: TransportMaps.Maps.TransportMapBase.TransportMap

Transport map \(T({\bf x},{\bf a}): \mathbb{R}^d \rightarrow \mathbb{R}^d\).

Parameters:
  • dim_in (int) – input dimension

  • dim_out (int) – output dimension

evaluate(x, *args, **kwargs)[source]

[Abstract] Evaluate the map \(T\) at the points \({\bf x} \in \mathbb{R}^{m \times d_x}\).

Parameters:
  • x (ndarray [\(m,d_x\)]) – 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_y\)]) – transformed points

Raises:

NotImplementedError – to be implemented in sub-classes

inverse(y, *args, **kwargs)[source]

[Abstract] Compute: \(T^{-1}({\bf x})\)

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

  • precomp (dict) – 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\)]) – \(T^{-1}({\bf x})\) for every evaluation point

log_det_grad_x(x, *args, **kwargs)[source]

[Abstract] Compute: \(\log \det \nabla_{\bf x} T({\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\)]) – \(\log \det \nabla_{\bf x} T({\bf x}, {\bf a})\) at every evaluation point

log_det_grad_x_inverse(x, *args, **kwargs)[source]

[Abstract] Compute: \(\log \det \nabla_{\bf x} 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\)]) – \(\log \det \nabla_{\bf x} T^{-1}({\bf x}, {\bf a})\) at every evaluation point

grad_x_log_det_grad_x_inverse(x, *args, **kwargs)[source]

[Abstract] Compute: \(\nabla_{\bf x} \log \det \nabla_{\bf x} 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\)]) – \(\nabla_{\bf x} \log \det \nabla_{\bf x} T^{-1}({\bf x}, {\bf a})\) at every evaluation point

See also

log_det_grad_x().

hess_x_log_det_grad_x_inverse(x, *args, **kwargs)[source]

[Abstract] Compute: \(\nabla^2_{\bf x} \log \det \nabla_{\bf x} 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,d\)]) – \(\nabla^2_{\bf x} \log \det \nabla_{\bf x} T^{-1}({\bf x}, {\bf a})\) at every evaluation point

See also

log_det_grad_x() and grad_x_log_det_grad_x().

action_hess_x_log_det_grad_x_inverse(x, dx, *args, **kwargs)[source]

[Abstract] Compute: \(\langle\nabla^2_{\bf x} \log \det \nabla_{\bf x} T^-1({\bf x}), \delta{\bf x}\rangle\)

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

  • dx (ndarray [\(m,d\)]) – directions 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\)]) – \(\langle\nabla^2_{\bf x} \log \det \nabla_{\bf x} T^-1({\bf x}), \delta{\bf x}\rangle\) at every evaluation point

See also

log_det_grad_x() and grad_x_log_det_grad_x().

grad_x(x, *args, **kwargs)[source]

[Abstract] Evaluate the gradient \(\nabla_{\bf x}T\) at the points \({\bf x} \in \mathbb{R}^{m \times d_x}\).

Parameters:
  • x (ndarray [\(m,d_x\)]) – 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_y,d_x\)]) – transformed points

Raises:

NotImplementedError – to be implemented in sub-classes

hess_x(x, *args, **kwargs)[source]

[Abstract] Evaluate the Hessian \(\nabla^2_{\bf x}T\) at the points \({\bf x} \in \mathbb{R}^{m \times d_x}\).

Parameters:
  • x (ndarray [\(m,d_x\)]) – 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_y,d_x,d_x\)]) – transformed points

Raises:

NotImplementedError – to be implemented in sub-classes

grad_x_inverse(x, *args, **kwargs)[source]

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

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:

NotImplementedError – to be implemented in subclasses

hess_x_inverse(x, *args, **kwargs)[source]

[Abstract] Compute \(\nabla_{\bf x}^2 T^{-1}({\bf x})\).

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\)]) – Hessian tensors for every evaluation point.

Raises:

NotImplementedError – to be implemented in subclasses

action_hess_x_inverse(x, dx, *args, **kwargs)[source]

[Abstract] Evaluate the action of the Hessian of the Moore-Penrose inverse \(\langle\nabla^2_{\bf x}T^\dagger,\delta{\bf x}\rangle\) at the points \({\bf x} \in \mathbb{R}^{m \times d_x}\).

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

  • dx (ndarray [\(m,d_x\)]) – 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_y,d_x\)]) – transformed points

Raises:

NotImplementedError – to be implemented in sub-classes