You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently validate_dims is a non-virtual function on class stan::io::var_context. Make this class virtural and move implementation to classes stan::io::dump and cmdstan::io::json.
Description:
In JSON notation, multi-dim arrays with leading dim 0 are indistinguishable from single-dim arrays of size 0, e.g., 3d array 0 x 0 x 0 is represented in JSON as '[ ]'. Therefore, for JSON notation, we need to hack the function validate_dims.
Rdump notation allows this - e.g.
d_m_ar <- structure(c(), .Dim = c(0, 0, 0))
defines a 3d array, dims 0 x 0 x 0
in JSON, this is represented as
"d_m_ar" : [ ]
while [ [ [ ] ] ] describes a 1 x 1 x 0 array.
Reproducible Steps:
Please report steps to reproduce the issue. If it's not possible to reproduce, please include a description of how you discovered the issue.
If you have a reproducible example, please include it.
Current Output:
Currently, CmdStan and by extension CmdStanPy and CmdStanR cannot accept JSON inputs is there are any 0-size multi-dim container objects.
Expected Output:
Stan program:
data {
int d;
vector[d] d_v1;
vector[d] d_v2;
row_vector[d] d_rv1;
row_vector[d] d_rv2;
vector[d] d_v_ar[d];
row_vector[d] d_rv_ar[d];
matrix[d, d] d_m;
}
should run (and do nothing) for following JSON data file:
Summary:
Currently
validate_dims
is a non-virtual function on classstan::io::var_context
. Make this class virtural and move implementation to classesstan::io::dump
andcmdstan::io::json
.Description:
In JSON notation, multi-dim arrays with leading dim 0 are indistinguishable from single-dim arrays of size 0, e.g., 3d array 0 x 0 x 0 is represented in JSON as '[ ]'. Therefore, for JSON notation, we need to hack the function
validate_dims
.Rdump notation allows this - e.g.
defines a 3d array, dims 0 x 0 x 0
in JSON, this is represented as
while
[ [ [ ] ] ]
describes a 1 x 1 x 0 array.Reproducible Steps:
Please report steps to reproduce the issue. If it's not possible to reproduce, please include a description of how you discovered the issue.
If you have a reproducible example, please include it.
Current Output:
Currently, CmdStan and by extension CmdStanPy and CmdStanR cannot accept JSON inputs is there are any 0-size multi-dim container objects.
Expected Output:
Stan program:
should run (and do nothing) for following JSON data file:
Additional Information:
see stan-dev/cmdstan#775
Current Version:
v2.21.0
The text was updated successfully, but these errors were encountered: