Positive Semidefinite restriction

83 views
Skip to first unread message

Daniel Berman

unread,
Jun 4, 2015, 3:10:35 PM6/4/15
to stan-...@googlegroups.com
I'm thinking of using RStan to do some quantum mechanics and a requirement is that the operators be positive semidefinite matrices. Therefore, I was wondering if it is it possible to require that a parameter (which is a matrix) is positive semidefinite? Also, is Stan capable of dealing with complex values (ex. 1+i)?

Ben Goodrich

unread,
Jun 4, 2015, 6:38:12 PM6/4/15
to stan-...@googlegroups.com, daniel....@gmail.com
You can declare a cov_matrix parameter, which will be symmetric and positive definite even if you are not actually using it as a covariance matrix. Stan doesn't do complex values so you would have to compute the real and imaginary parts separately.

Ben

Daniel Berman

unread,
Jun 4, 2015, 7:14:03 PM6/4/15
to stan-...@googlegroups.com, daniel....@gmail.com
Thanks, what is used to indicate something is imaginary, meaning, what is the reserved term for the sqrt(-1)?

Bob Carpenter

unread,
Jun 4, 2015, 7:50:47 PM6/4/15
to stan-...@googlegroups.com
There isn't one. If you want to do complex arithmetic, you'll
have to manipulate the real and imaginary parts yourself --- Stan
doesn't have any native sort for imaginary numbers.

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

Bob Carpenter

unread,
Jun 4, 2015, 7:53:43 PM6/4/15
to stan-...@googlegroups.com
Ben --- are the non-square Cholesky factors meant to be used
for semi-definite matrices?

- Bob

Ben Goodrich

unread,
Jun 4, 2015, 9:14:43 PM6/4/15
to stan-...@googlegroups.com, ca...@alias-i.com
Yes, if someone wants both positive semi-definite and a particular rank, then the rank of L * L' will be the number of columns of L.

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

Daniel Berman

unread,
Jun 4, 2015, 9:50:45 PM6/4/15
to stan-...@googlegroups.com
So how would I go about estimating a matrix that had complex values? If that's not possible, so you know of another program or software that would let me do that?

Andrew Gelman

unread,
Jun 4, 2015, 9:59:02 PM6/4/15
to stan-...@googlegroups.com
You can just express such a matrix as two matrices, one for the real part and one for the imaginary part, and then just carry thru all the math in that way, working out the real and imaginary parts using the appropriate formulas. I suppose it should be possible to write Stan functions to do these.

> On Jun 4, 2015, at 9:50 PM, Daniel Berman <daniel....@gmail.com> wrote:
>
> So how would I go about estimating a matrix that had complex values? If that's not possible, so you know of another program or software that would let me do that?
>

Daniel Berman

unread,
Jun 4, 2015, 10:43:55 PM6/4/15
to stan-...@googlegroups.com, gel...@stat.columbia.edu
Given that I want to place constraints on the matrix such as positive semidefiniteness, is that still possible?

Ben Goodrich

unread,
Jun 4, 2015, 11:59:06 PM6/4/15
to stan-...@googlegroups.com, daniel....@gmail.com
On Thursday, June 4, 2015 at 10:43:55 PM UTC-4, Daniel Berman wrote:
Given that I want to place constraints on the matrix such as positive semidefiniteness, is that still possible?

If you were interested in the complex matrix A where

A = B + i * C

and both B and C are real, symmetric, and positive semi-definite, then maybe something could be done with Stan but you would have to deal with the real and imaginary parts separately. See, e.g.,

http://www.maths.manchester.ac.uk/~higham/narep/narep298.pdf

More generally, for any sort of a constrained multivariate unknown, Stan needs a mapping between that space and the real numbers. And Stan doesn't have any such mappings built in for complex variables.

Ben
 
Reply all
Reply to author
Forward
0 new messages