Skip to content

Commit

Permalink
Fix shape of stan variables
Browse files Browse the repository at this point in the history
  • Loading branch information
aseyboldt committed Jul 1, 2023
1 parent 41e4c61 commit 6b508db
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/stan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ fn params(
let mut variables = Vec::new();
let mut start_idx = 0;
for (name, idxs) in &name_idxs?.iter().group_by(|(name, _)| name) {
let shape: Vec<usize> = idxs
let mut shape: Vec<usize> = idxs
.map(|(_name, idx)| idx)
.fold(None, |acc, elem| {
let mut shape = acc.unwrap_or(elem.clone());
Expand All @@ -117,6 +117,7 @@ fn params(
Some(shape)
})
.unwrap_or(vec![]);
shape.iter_mut().for_each(|max_idx| *max_idx = (*max_idx) + 1);
let size = shape.iter().product();
let end_idx = start_idx + size;
variables.push(Parameter {
Expand Down

0 comments on commit 6b508db

Please sign in to comment.