TransportMaps.Maps.AffineTransportMapBase

Module Contents

Classes

AffineTransportMap

Linear map \(T({\bf x})={\bf c} + {\bf L}{\bf x}\)

LinearTransportMap

Linear map \(T({\bf x})={\bf c} + {\bf L}{\bf x}\)

class TransportMaps.Maps.AffineTransportMapBase.AffineTransportMap(**kwargs)[source]

Bases: TransportMaps.Maps.AffineMapBase.AffineMap, TransportMaps.Maps.ParametricTransportMapBase.ParametricTransportMap

Linear map \(T({\bf x})={\bf c} + {\bf L}{\bf x}\)

Note

This class supports only regular matrices. Ad-hoc implemnetations for sparse matrices should be implemented by the user.

property L[source]

The linear term \({\bf L}\)

solve_linear(y)[source]

Solves the linear system \({\bf L}{\bf x} = {\bf y}\)

solve_linear_transpose(y)[source]

Solves the linear system \({\bf L}^{\top}{\bf x} = {\bf y}\)

static build_from_Gaussian(pi, typeMap='sym')[source]
static build_from_Normal(pi, typeMap='sym')[source]

Build a linear transport map from a standard normal to a Gaussian distribution pi

Parameters:
  • pi (GaussianDistribution) – constant term of the linear map

  • typeMap (str) – the linear term \(L\) is obtained as the square root of the covarinace \(\Sigma\) or precision \(\Sigma^{-1}\) matrix. For typeMap=='sym', \(L=U\Lambda^{\frac{1}{2}}U^T\) where \(\Sigma = U\Lambda U^T\) is the eigenvalue decomposition of \(\Sigma\). For typeMap=='tri', :maht:`L=C` where \(\Sigma=CC^T\) is the Cholesky decomposition of \(\Sigma\). For typeMap=='kl', \(L=U\Lambda^{\frac{1}{2}}\) where \(\Sigma = U\Lambda U^T\) is the eigenvalue decomposition of \(\Sigma\) (this corresponds to the Karuenen-Loeve expansion). The eigenvalues and eigenvectors are ordered with \(\lambda_i\geq\lambda_{i+1}\).

Raises:

ValueError – if the shape of linear and constant term are inconsistent.

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

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

Parameters:

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

Returns:

(float) – \(\log \det \nabla_{\bf x} \hat{T}({\bf x}, {\bf a})\) (constant 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}, {\bf a})\)

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

  • precomp (dict) – dictionary of precomputed values

Returns:

(ndarray [\(m,d\)]) – \(\nabla_{\bf x} \log \det \nabla_{\bf x} T({\bf x}, {\bf a})\) 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_log_det_grad_x(x, *args, **kwargs)[source]

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

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

  • precomp (dict) – dictionary of precomputed values

Returns:

(ndarray [\(m,d\)]) – \(\nabla^2_{\bf x} \log \det \nabla_{\bf x} T({\bf x}, {\bf a})\) at every evaluation point

Raises:

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

See also

log_det_grad_x().

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}, {\bf a}),\delta{\bf x}\rangle\)

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

  • precomp (dict) – dictionary of precomputed values

Returns:

(ndarray [\(m,d\)]) – \(\nabla^2_{\bf x} \log \det \nabla_{\bf x} T({\bf x}, {\bf a})\) at every evaluation point

Raises:

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

See also

log_det_grad_x().

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

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

Parameters:

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

Returns:

(ndarray [\(m,d\)]) – \(\hat{T}^{-1}({\bf y},{\bf a})\) for every evaluation point

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

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

Parameters:

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

Returns:

(ndarray [\(d,d\)]) – gradient matrix (constant 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}, {\bf a})\).

Parameters:

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

Returns:

(float) – \(\log \det \nabla_{\bf x} T^{-1}({\bf x}, {\bf a})\) (constant 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

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.AffineTransportMapBase.LinearTransportMap(c, L, Linv=None)[source]

Bases: AffineTransportMap

Linear map \(T({\bf x})={\bf c} + {\bf L}{\bf x}\)

Note

This class supports only regular matrices. Ad-hoc implemnetations for sparse matrices should be implemented by the user.