I have a batch of upper triangular matrix of shape (B, N, N) and I want to calculate a batch of positive definite matrices (covariance matrix) using cholesky decomposition such that each matrix in resultant batch comes from corresponding upper triangular matrix in the given batch of upper triangular matrices.
Let me say what I think your problem is:
You have a batch (batch-size B) of NxN upper triangular matrices
that are stored as full NxN matrices, for which the elements in
the lower triangle are zero.
We think of these matrices as having come from the Cholesky
decomposition of symmetric-positive-definite (SPD) matrices,
and you wish to recover those SPD matrices as explicit, full
S be the desired full SPD matrix, and
L be its upper-triangular
Cholesky decomposition. Then, by definition,
S = L x L-transpose.
l be your
(B, N, N) batch of upper-triangular matrices,
s = torch.matmul (l, torch.transpose (l, 1, 2))
should give you
(B, N, N) batch of your SPD matrices.
This is perfectly what I was looking for !!
Thanks K. Frank !!