matrix_normal.hpp

52 views
Skip to first unread message

Ben Goodrich

unread,
Mar 3, 2015, 10:28:24 AM3/3/15
to stan...@googlegroups.com
@Marcus: We were talking at the meeting today about the matrix_normal() function, which is apparently not exposed to the Stan language. Did you have a reason why you only wanted that to be used internally?

Ben

Marcus Brubaker

unread,
Mar 3, 2015, 3:11:32 PM3/3/15
to stan...@googlegroups.com
I don't recall why I didn't want it exposed.  In fact if you hadn't said otherwise I would have thought that it *was* exposed!  The only issue with it really is that it will be slow for certain specialized uses (eg, when one of the matrices is large, sparse and constant, like with CAR models).  I'm also not sure if we have the regular parameterization available.  I know I implemented a matrix_normal_prec version which took precision matrices, but I don't recall implementing the base matrix_normal.  Of course, my memory isn't what it used to be these days...

Cheers,
Marcus


On Tue, Mar 3, 2015 at 10:28 AM Ben Goodrich <goodri...@gmail.com> wrote:
@Marcus: We were talking at the meeting today about the matrix_normal() function, which is apparently not exposed to the Stan language. Did you have a reason why you only wanted that to be used internally?

Ben

--
You received this message because you are subscribed to the Google Groups "stan development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ben Goodrich

unread,
Mar 3, 2015, 3:23:58 PM3/3/15
to stan...@googlegroups.com
Right. The function in the matrix_normal.hpp file is called matrix_normal_prec(). It is not exposed, although it has tests, so we should probably expose it and then maybe Seth or Aki can work on enhancing it and / or speeding it up.

Ben
To unsubscribe from this group and stop receiving emails from it, send an email to stan-dev+unsubscribe@googlegroups.com.

Marcus Brubaker

unread,
Mar 3, 2015, 3:26:36 PM3/3/15
to stan...@googlegroups.com
Yeah, that sounds fine.  The testing is probably not fully up to par, but the function should be at a level that it can be used.

Cheers,
Marcus


To unsubscribe from this group and stop receiving emails from it, send an email to stan-dev+u...@googlegroups.com.

Aki Vehtari

unread,
Mar 6, 2015, 3:25:22 AM3/6/15
to stan...@googlegroups.com
I couldn't find a issue for this, and created one
https://github.com/stan-dev/stan/issues/1344

Aki

On Tuesday, March 3, 2015 at 10:26:36 PM UTC+2, Marcus Brubaker wrote:
> Yeah, that sounds fine.  The testing is probably not fully up to par, but the function should be at a level that it can be used.
>
>
>
> Cheers,
> Marcus
>
>
>
> On Tue, Mar 3, 2015 at 3:24 PM Ben Goodrich <goodri...@gmail.com> wrote:
>
> Right. The function in the matrix_normal.hpp file is called matrix_normal_prec(). It is not exposed, although it has tests, so we should probably expose it and then maybe Seth or Aki can work on enhancing it and / or speeding it up.
>
>
> Ben
>
>
> On Tuesday, March 3, 2015 at 3:11:32 PM UTC-5, Marcus Brubaker wrote:
> I don't recall why I didn't want it exposed.  In fact if you hadn't said otherwise I would have thought that it *was* exposed!  The only issue with it really is that it will be slow for certain specialized uses (eg, when one of the matrices is large, sparse and constant, like with CAR models).  I'm also not sure if we have the regular parameterization available.  I know I implemented a matrix_normal_prec version which took precision matrices, but I don't recall implementing the base matrix_normal.  Of course, my memory isn't what it used to be these days...
>
>
>
> Cheers,
> Marcus
>
>
>
> On Tue, Mar 3, 2015 at 10:28 AM Ben Goodrich <goodri...@gmail.com> wrote:
>
> @Marcus: We were talking at the meeting today about the matrix_normal() function, which is apparently not exposed to the Stan language. Did you have a reason why you only wanted that to be used internally?
>
> Ben
>
>
>
>
>
> --
>
> You received this message because you are subscribed to the Google Groups "stan development mailing list" group.
>

Daniel Lee

unread,
Mar 6, 2015, 5:03:23 AM3/6/15
to stan...@googlegroups.com
Thanks!

I haven't looked at the current state of the unexposed function, but what we want is for it to be good enough to expose. The most help would be to provide examples of:
- values of matrices where it should work, with derivatives. 
- matrices where it should fail (inf, nan, mismatched sizes)

If we had these things in hand, it would be easy to code up tests and expose the function to the language.

Ben Goodrich

unread,
Mar 6, 2015, 8:12:47 AM3/6/15
to stan...@googlegroups.com
On Friday, March 6, 2015 at 5:03:23 AM UTC-5, Daniel Lee wrote:
Thanks!

I haven't looked at the current state of the unexposed function, but what we want is for it to be good enough to expose. The most help would be to provide examples of:
- values of matrices where it should work, with derivatives. 
- matrices where it should fail (inf, nan, mismatched sizes)

If we had these things in hand, it would be easy to code up tests and expose the function to the language.

Those exist in src/test/unit/prob/distributions/multivariate/continuous/matrix_normal_test.cpp, although the fwd stuff may need to put in another directory.

Ben
 

To unsubscribe from this group and stop receiving emails from it, send an email to stan-dev+unsubscribe@googlegroups.com.

Daniel Lee

unread,
Mar 6, 2015, 8:17:44 AM3/6/15
to stan...@googlegroups.com
So... there's one test for inputs where it should work. No tests for derivatives for that single test case. I guess I'd like to see maybe another couple test cases? Especially with matrices that have dimension 1 on one of the sides. And with dim 0.

There are some tests in place where it should fail.

Bob Carpenter

unread,
Mar 7, 2015, 12:31:15 AM3/7/15
to stan...@googlegroups.com
Yes, and we need derivative tests. Finite diffs should be OK.

- Bob
Reply all
Reply to author
Forward
0 new messages