pymc.expand_packed_triangular#

pymc.expand_packed_triangular(n, packed, lower=True, diagonal_only=False)[source]#

Convert a packed triangular matrix into a two dimensional array.

Triangular matrices can be stored with better space efficiency by storing the non-zero values in a one-dimensional array. We number the elements by row like this (for lower or upper triangular matrices):

[[0 - - -] [[0 1 2 3]

[1 2 - -] [- 4 5 6] [3 4 5 -] [- - 7 8] [6 7 8 9]] [- - - 9]

Parameters:
n: int

The number of rows of the triangular matrix.

packed: pytensor.vector

The matrix in packed format.

lower: bool, default=True

If true, assume that the matrix is lower triangular.

diagonal_only: bool

If true, return only the diagonal of the matrix.