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

corr_matrix of size 0 fails #2958

Open
ecmerkle opened this issue Sep 30, 2020 · 3 comments
Open

corr_matrix of size 0 fails #2958

ecmerkle opened this issue Sep 30, 2020 · 3 comments
Labels

Comments

@ecmerkle
Copy link

Summary:

Defining a size 0 correlation matrix leads to std::bad_alloc in rstan. This is related to #2588, where it is suggested that corr_matrix and related types should be able to work for size 0. #2588 was closed, but I think the "allow size 0" issue was never addressed.

Reproducible Steps:

This zip file contains an R file and stan file (run with rstan), illustrating the issue: corrmat.zip

Current Output:

std::bad_alloc if the corr_matrix size is 0.

Expected Output:

Optimally, this model would still sample when the corr_matrix size is 0.

Current Version:

I am using rstan 2.21.2 with R 4.0.2. I also reproduced with CmdStan 2.24.0, which reported:

Exception initializing step size.
Posterior is improper. Please check your model.

@syclik
Copy link
Member

syclik commented Sep 30, 2020

Thanks for reporting this issue!

@syclik syclik added the bug label Sep 30, 2020
@syclik
Copy link
Member

syclik commented Sep 30, 2020

I verified this issue. Happens with v2.24.0 and also with current develop. (I'm not sure it's in Math.)

@syclik
Copy link
Member

syclik commented Sep 30, 2020

This also happens with corr_matrix[1].

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

No branches or pull requests

2 participants