Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

complex_vector assigment matching-size check sometimes broken #3199

Closed
nhuurre opened this issue Jun 16, 2023 · 1 comment · Fixed by stan-dev/math#2915
Closed

complex_vector assigment matching-size check sometimes broken #3199

nhuurre opened this issue Jun 16, 2023 · 1 comment · Fixed by stan-dev/math#2915

Comments

@nhuurre
Copy link
Contributor

nhuurre commented Jun 16, 2023

transformed parameters {
    complex_vector[2] eigVals = eigenvalues([[1,2],[3,4]]);
}

This model compiles but running it fails with exception

Unrecoverable error evaluating the log probability at the initial value.
Exception: vector assign columns: assigning variable eigVals (1) and right hand side columns (2) must match in size 

But the variable sizes are correct. It even works when placed inside an array:

transformed parameters {
    array[1] complex_vector[2] eigVals = {eigenvalues([[1,2],[3,4]])};
}

Current Version:

v2.32.2

@WardBrian
Copy link
Member

I think that the issue may actually be that eigenvalues has the wrong return type in the Math library. The type is given as Eigen::Matrix<complex_return_t<value_type_t<EigMat>>, 1, -1>, which is a row vector.

@syclik and I went back and forth in stan-dev/math#2846 about whether or not to have the return type be auto, and then missed the fact that I wrote down the wrong type when I did explicitly write it out... oops

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants