[R-sig-dyn-mod] deSolve: events in compiled code

Soetaert, Karline K.Soetaert at nioo.knaw.nl
Fri Aug 5 09:45:16 CEST 2011


Jonas,

Do you know the maximal number of parameters? 
If you do you could, in your fortran/C function allocate the maximal
number (in initparms function), and then pad the parms argument to the
ode function with dummy values.

Sure, it would not be difficult to add these two arguments to the event
function, as it is done in C-code, but it would need changes for all
solvers. 

Only problem is that this would not be backward compatible. 
Maybe some older applications would have event code without extra
arguments, while the new versions of the solvers would expect this. 
R tends to end with a fatal error, if something like that happens in
compiled code.

But I have no idea if other people are modeling events in compiled code,
and what their feelings are about changing the defaults.


Karline

-----Original Message-----
From: r-sig-dynamic-models-bounces at r-project.org
[mailto:r-sig-dynamic-models-bounces at r-project.org] On Behalf Of Jonas
Rauch
Sent: 19 July 2011 07:44
To: r-sig-dynamic-models at r-project.org
Subject: [R-sig-dyn-mod] deSolve: events in compiled code

Hi,

it seems that a compiled event function does not get pointers to IPAR
and RPAR as the right hand side or the root finding function do. I have
a problem where my events depend on parameters, but because the number
of parameters I'm using varies between instances I cannot use the
"initparms" / common block version of passing parameters either.

Does anyone have an idea how to do this?

If there is no way to do this currently I'll try to dig through the code
for deSolve and come up with a patch. I guess it shouldn't be too hard
to pass two additional arguments to the event function.

Best regards,
Jonas

	[[alternative HTML version deleted]]

_______________________________________________
R-sig-dynamic-models mailing list
R-sig-dynamic-models at r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-dynamic-models



More information about the R-sig-dynamic-models mailing list