pangolin.interface.fill_tril#
- pangolin.interface.fill_tril(params)#
Fill a lower-triangular matrix row by row from a vector.
This function creates no specialized Op; it lowers the operation to indexing and multiplication in the ordinary Pangolin IR.
- Parameters:
params (RVLike) – One-dimensional RV or array-like value of length
N * (N + 1) / 2.- Returns:
matrix – Lower-triangular RV with shape
(N, N).- Return type:
Examples
>>> import pangolin.interface as pi >>> params = pi.constant([1.1,2.2,3.3]) >>> out = pi.fill_tril(params) >>> out.shape (2, 2) >>> pi.print_upstream(out) shape | statement ------ | --------- (3,) | a = [1.1 2.2 3.3] (2, 2) | b = [[0 0] [1 2]] (2, 2) | c = vmap(vmap(index, [None, 0], 2), [None, 0], 2)(a, b) (2, 2) | d = [[1. 0.] [1. 1.]] (2, 2) | e = vmap(vmap(mul, [0, 0], 2), [0, 0], 2)(c, d)