I am interested in an inference problem where the posterior distribution is over positive semi-definite matrices whose trace is equal to 1. I have not begun working on this, but before I do, I would be interested to hear any opinions from those experienced users about how best to implement this, as in, what to put in the `parameters`

section of the stan program. I understand there are constrained native types for cholesky factors, correlations, and covariance matrices.

I once wrote pair of inverse functions that transform between \mathbb{R}^{d^2-1} and the set of d\times d unit-trace positive semi-definite operators with the constraint based on stick-breaking (see here).

Would implementing this in stan be a useful approach, or is there a simpler way? Here is a blurb copied from the docstring of `vec_to_state()`

:

The unit trace condition is met by using a stick-breaking like trick, where

a given value of`x`

doesnâ€™t directly store a cholesky factor matrix element,

but rather, it stores (after being shrunk) the fraction of the remaining

budget of the trace until`1`

. Note that the trace of a positive operator

is the square Hilbert-Schmidt norm of its cholesky factor, so this is a

2-norm version of stick breaking.

Thanks for any help.