stanc3 icon indicating copy to clipboard operation
stanc3 copied to clipboard

[FR] Add row simplex matrices and column simplex matrices

Open SteveBronder opened this issue 4 years ago • 1 comments

For stuff like the hmm models I think it would be nice to have a row_simplex_matrix type. This would be pretty easy to add. Either in Stan math we can have an explicit row/col_matrix_simplex() function or here in the compiler we can call simplex_constrain() on each row/col of a parameter matrix. Is there any reason not to add these to the language?

SteveBronder avatar Sep 24 '21 20:09 SteveBronder

A right stochastic matrix is one where every row is a simplex and a left stochastic matrix is one where every column is a simplex. I think the usual default is a right stochastic matrix. See: https://en.wikipedia.org/wiki/Stochastic_matrix

For Stan, the matrix form is less efficient than an array of simplexes, because you have to build new objects to pull the simplexes out of a matrix. If we had something like views of matrix rows, it'd be the right thing to do.

bob-carpenter avatar Sep 24 '21 21:09 bob-carpenter

#1442

WardBrian avatar Sep 26 '24 13:09 WardBrian