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

New approach to array indexing #115

Closed
richfitz opened this issue Apr 17, 2018 · 2 comments
Closed

New approach to array indexing #115

richfitz opened this issue Apr 17, 2018 · 2 comments
Projects

Comments

@richfitz
Copy link
Member

@richfitz richfitz commented Apr 17, 2018

Rather than the current minus1 approach (which seems quite fragile) go the other way and unpack matrices offset so that everything just goes.

This will affect

  • all for loops, which will instead run from 1 to <= bound rather than 0 to < bound
  • all functions that take a whole array (sum, multinomial distr)

but a large class of off-by-one errors will go away. When unpacking, rather than writing

double *x = odin_p->state[offset];

we'd just write

double *x = odin->state[offset] - 1;

and then later we can write x[1] and it will use the 0 offset of the actual state

@richfitz richfitz added this to To Do in development May 10, 2018
@richfitz
Copy link
Member Author

@richfitz richfitz commented Jul 3, 2018

Not sure where this would leave 2d and higher arrays though

@richfitz
Copy link
Member Author

@richfitz richfitz commented Jul 3, 2018

should be fine - it's the same logic as one would use from R...

@richfitz richfitz mentioned this issue Mar 18, 2019
@richfitz richfitz closed this Apr 8, 2019
development automation moved this from To Do to Done Apr 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
development
  
Done
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.