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

Specifying Jacobian in Odin #251

Open
schnebeni opened this issue Dec 14, 2021 · 3 comments
Open

Specifying Jacobian in Odin #251

schnebeni opened this issue Dec 14, 2021 · 3 comments

Comments

@schnebeni
Copy link

I'd like to specify the Jacobian for a system of equations I'm working with – I'm also working with an array. I'm not sure how I should specify the order of elements though, because I'm not sure what order the vector of parameters is read-in as.

@richfitz
Copy link
Member

This is not currently supported. I believe (though I could be wrong) that if the RHS is compiled then deSolve requires that Jacobian is also supplied, and that would require some work to do as we'd need to extend the odin syntax to support this.

If you press on, the parameter order is always available from the model, e.g.:

names(odin::odin_ir(gen, TRUE)$data$variable$contents)

but you can't rely on different versions of odin not reordering it (it comes from sorting the graph through the equations, and we have thoughts about changing that next year to generate more cache-friendly code).

If you do get something working, please point me to an example where it helps and if and when I get some time I can look at adding support for it more nicely.

@schnebeni
Copy link
Author

I'd love to contribute a solution for this problem. Do you have any more tips for implementing a vector of Jacobians (one for each id in the array)?

@richfitz
Copy link
Member

This is likely to be a big job and would require some care to get right. You could start by:

  • identifying a system where it would help
  • creating a deSolve + C and deSolve + R implementation of this system
  • proposing a syntax for defining the system alongside the rhs

Then I'd need to see what changes would be needed to support this.

A warning though - we're pretty swamped with covid response work so this would likely not feature very high up the list of priorities for a while I'm afraid

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

No branches or pull requests

2 participants