On 11/15/12 9:14 PM, Ben Goodrich wrote:
> On Thursday, November 15, 2012 3:32:01 PM UTC-5, Bob Carpenter wrote:
>
> I extracted some top-level to-do items for Stan in no particular
> order. Could we discuss priorities at the next meeting?
>
>
> In terms of local priority,
>
> * covariance matrix w. caching (inverse, determinant, Cholesky)
> * new types: lower triangular (+/- strict), diagonal matrix,
> symmetric matrix, Cholesky factor of pos-def matrix
>
>
> I would say that the Cholesky factor type should go in ASAP and before the covariance matrix class stuff.
That's actually not that hard a thing to do. I could
probably knock that off in a few days including all the
doc and testing. In fact, it's probably even easier than
that because most of the code and transform doc is already
there inside of cov_matrix!
> But I'm not
> sure the other types would add that much value once we have the planned covariance matrix classes. There will be a
> DiagonalCovarianceMatrix class, and we already have diag_matrix(vector). Rarely is there a need for a symmetric matrix
> that is not also a covariance matrix or a need for a triangular matrix with negative diagonal elements (and thus is not
> a Cholesky factor).
I've already been surprised about what people have
asked for in terms of data structures. I think general
ragged data structures can cover the triangular case.
Nobody's asked for symmetric matrices -- I'm just
a natural collector and like to have complete sets :-)
diag_matrix(vector) is very inefficient the way we
do it -- we're still bypassing the expression templates
in Eigen that make it efficient. We could add an
efficient
matrix diag_matrix_multiply(vector v, matrix m);
that computes diag_matrix(v) * m directly without blowing
it out. First level would be to use Eigen, second level
would be to write specialized auto-diffs.
I have almost no feeling at all which of these ops will
be useful. They're very easy to write, though.
> But maybe the value added would be worth the effort if Eigen supported them directly. Conversely, if
> we add a Cholesky factor type, then we should also add wishart_cholesky() and inv_wishart_cholesky() densities.
Agreed.
- Bob