15.3 Complex matrices and vectors
Stan supports complex matrices, vectors, and row vectors. Variables of these types are declared with sizes in the same way as their real-based counterparts.
complex_vector v; complex_row_vector rv; complex_matrix[3, 2] m;
We can construct vectors and matrices using brackets in the same way
as for real-valued vectors and matrices. For example, given the
rv above, we could assign it to a constructed row
2 + 3i, 1.9 - 2.3i];rv = [
Complex matrices and vectors support all of the standard arithetmic operations including negation, addition, subtraction, and multiplication (division involves a solve, and isn’t a simple arithmetic operation for matrices). They also support transposition.
Furthermore, it is possible to convert back and forth between arrays
and matrices using the