Helpful Stan Functions
Vectorization operations on matrices

Functions

vector lower_ele (matrix mat, int K)
 

Detailed Description

vector lower_ele(matrix mat, int K) {
int N = rows(mat);
vector[K] out;
int count = N;
int pos = 1;
for (k in 1 : K - 1) {
count -= 1;
out[pos : pos + count - 1] = sub_col(mat, k + 1, k, count);
pos += count;
}
return out;
}
vector lower_ele(matrix mat, int K)
Definition: vectorization.stanfunctions:17

Function Documentation

◆ lower_ele()

vector lower_ele ( matrix  mat,
int  K 
)

Lower triangular elements

Copyright 2021, Sean Pinkney

Parameters
matMatrix
KInt if mat is size N x N then
K is N * N / 2
vectorof lower triangular elements