Skip to content

Commit 6b508db

Browse files
committed
Fix shape of stan variables
1 parent 41e4c61 commit 6b508db

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/stan.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ fn params(
104104
let mut variables = Vec::new();
105105
let mut start_idx = 0;
106106
for (name, idxs) in &name_idxs?.iter().group_by(|(name, _)| name) {
107-
let shape: Vec<usize> = idxs
107+
let mut shape: Vec<usize> = idxs
108108
.map(|(_name, idx)| idx)
109109
.fold(None, |acc, elem| {
110110
let mut shape = acc.unwrap_or(elem.clone());
@@ -117,6 +117,7 @@ fn params(
117117
Some(shape)
118118
})
119119
.unwrap_or(vec![]);
120+
shape.iter_mut().for_each(|max_idx| *max_idx = (*max_idx) + 1);
120121
let size = shape.iter().product();
121122
let end_idx = start_idx + size;
122123
variables.push(Parameter {

0 commit comments

Comments
 (0)