Menu

More than 4 arguments for Dopri/Radau

2017-09-14
2017-09-14
  • Ben Mayersohn

    Ben Mayersohn - 2017-09-14

    Hi there!

    I just started using PyDSTool recently with the hopes of using it to replace a scipy implementation of an ecosystem model. It's a predator-prey like model, and I'm typically modeling about 12 species at a time. However, it seems that to use the faster Dopri/Radau integrators, one can only have up to 4 compartments total.

    Vode is quite slow compared to my original implementation that uses scipy.integrate.ode: PyDSTool will take around 50 seconds while scipy will take about 15. So it's unusable for me right now.

    Is there a particular reason we're so limited in the number of arguments we can pass to the faster integrators? Sorry if I'm missing something obvious!

    The block of code is found in the code generator file c.py

    if num_args > 4:
        raise NotImplementedError("Max of more than 4 arguments not currently supported in C")
    

    Thanks in advance!

    Best,
    Ben

     
  • Rob Clewley

    Rob Clewley - 2017-09-15

    Hi. Good question! It has been a long time since that code was written and the full change logs weren't even in git at that point. I recall hacking together some quick min and max helper functions in C but had trouble (or lack of time) making fully generic, i.e. arbitrary number of arguments. Somehow it ended up with 4 as the limit. I can't even see the evidence of where 4 is a constraint in the C definitions for the __maxof and __minof underlying functions, so it's possible they were updated by me or someone else and the constraint went away while this check did not. The empirical approach would simply be to try taking this check out and testing it on a clear case (a simplified test dynamical system) to check the results.

    Please let me know if you find anything out. If not, I can try to dig deeper.

     

Log in to post a comment.