Eigenvalues of a nonsymmetric matrix throws an error

I’m trying to compute eigenvalues of a nonsymmetric matrix but get the following error when sampling:

Exception: vector assign columns: assigning variable lambda (1) and right hand side columns (2) must match in size

  matrix[2,2] A;  
  complex_vector[2] lambda; 
  A = [ [2,1],[1,0] ];
  lambda = eigenvalues(A);

The eigenvalue() function should return a complex_vector and not a complex_row_vector. However, when I I print out the dimensions of eigenvalue(A) I get 1 row and 2 cols, so I’m confused. Declaring complex_row_vector[2] lambda also doesn’t work and throws an error at compilation.

Can anyone help me out here?

I’m using cmdstan 2.32.1

It’s a known issue and a fix was merged 2 weeks ago in Fix: eigenvalues returns column vector by WardBrian · Pull Request #2915 · stan-dev/math · GitHub.

Right now you’ll have to wait until a new release or build one yourself.