TriangularLinear
- class pmrf.stats.bijectors.TriangularLinear(matrix: Array, is_lower: bool = True)
Bases:
AbstractLinearBijectorA linear bijector whose weight matrix is triangular.
The bijector is defined as \(f(x) = Ax\) where \(A\) is a \(D \times D\) triangular matrix.
The Jacobian determinant can be computed in \(O(D)\) as follows:
\[\log|\det J(x)| = \log|\det A| = \sum \log|\text{diag}(A)|\]The inverse is computed in \(O(D^2)\) by solving the triangular system \(Ax = y\).
!!! note
The bijector is invertible if and only if all diagonal elements of \(A\) are non-zero. It is the responsibility of the user to make sure that this is the case; the class will make no attempt to verify that the bijector is invertible.
Initializes a TriangularLinear bijector.
Arguments:
- matrix: a square matrix whose triangular part defines A. Can also be a
batch of matrices. Whether A is the lower or upper triangular part of matrix is determined by is_lower.
- is_lower: if True, A is set to the lower triangular part of matrix. If
False, A is set to the upper triangular part of matrix.
- forward(x: Array) Array
Computes y = f(x).
- forward_and_log_det(x: Array) tuple[Array, Array]
Computes y = f(x) and log|det J(f)(x)|.
- forward_log_det_jacobian(x: Array) Array
Computes log|det J(f)(x)|.
- inverse(y: Array) Array
Computes x = f^{-1}(y).
- inverse_and_log_det(y: Array) tuple[Array, Array]
Computes x = f^{-1}(y) and log|det J(f^{-1})(y)|.
- inverse_log_det_jacobian(y: Array) Array
Computes log|det J(f^{-1})(y)|.
- same_as(other: AbstractBijector) bool
Returns True if this bijector is guaranteed to be the same as other.
- event_dims: int
- is_lower: bool
- property matrix: Array
The triangular matrix A of the transformation.