Skip to content
class

LowerCholeskyTransform

extendsTransform
LowerCholeskyTransform()

Map an unconstrained matrix to a positive-diagonal lower-triangular factor.

The standard reparameterisation used to learn covariance / scale matrices: a free D×DD \times D matrix is mapped to a lower triangular matrix with strictly positive diagonal by zeroing the strict upper triangle and exponentiating the diagonal, as the reference framework does. Composing with a base on RD×D\mathbb{R}^{D \times D} produces a pushforward over the cone of valid Cholesky factors. event_dim = 2.

The strict upper triangle of the input is discarded, so the map is onto the lower-Cholesky cone but not one-to-one on RD×D\mathbb{R}^{D \times D}; it is registered with transform_to and not biject_to.

Notes

Forward (element-wise on a D×DD \times D input XX):

Lij={exp⁡(Xii)i=jXiji>j0i<jL_{ij} = \begin{cases} \exp(X_{ii}) & i = j \\ X_{ij} & i > j \\ 0 & i < j \end{cases}

Inverse:

Xii=log⁡Lii,Xij=Lij    (i>j)X_{ii} = \log L_{ii}, \qquad X_{ij} = L_{ij}\;\;(i > j)

Log Jacobian determinant (summed over the matrix event dims):

log⁡∣det⁡J∣=∑i=1Dlog⁡exp⁡(Xii)=∑i=1DXii\log|\det J| = \sum_{i=1}^{D} \log \exp(X_{ii}) = \sum_{i=1}^{D} X_{ii}

Off-diagonal entries contribute unit Jacobian (identity map); only the exponential applied to the diagonal carries a non-trivial factor.

For correlation-matrix factors (unit diagonal) use CorrCholeskyTransform instead.

Examples

>>> import lucid
>>> from lucid.distributions.transforms import LowerCholeskyTransform
>>> T = LowerCholeskyTransform()
>>> X = lucid.tensor([[0.0, 0.0], [0.5, 0.0]])
>>> L = T(X)  # exp on diagonal, raw on strict lower

Used by 2

Instance methods

1
fn

log_abs_det_jacobian

→Tensor
log_abs_det_jacobian(x: Tensor, y: Tensor)

Sum of the diagonal of x: ∑ixii\sum_i x_{ii}.

Off-diagonal entries contribute unit Jacobian; the exponential on the diagonal contributes log⁡exp⁡(xii)=xii\log \exp(x_{ii}) = x_{ii}.

Parameters

Pre-transform input matrix (last two dims square).
Post-transform output; ignored — the log-Jacobian uses x's diagonal only.

Returns

Tensor

Per-sample log-Jacobian (reduces the last two matrix axes).