Return detailed information about an odin model. This is the mechanism through which coef works with odin.
odin_ir(x, parsed = FALSE)
An odin_generator
function, as created by
odin::odin
Logical, indicating if the representation should be
parsed and converted into an R object. If FALSE
we
return a json string.
The returned data is subject to change for a few versions while I work out how we'll use it.
exp_decay <- odin::odin({
deriv(y) <- -0.5 * y
initial(y) <- 1
}, target = "r")
#> Generating model in r
odin::odin_ir(exp_decay)
#> {"version":"1.5.11","config":{"base":"odin","include":null,"custom":null},"meta":{"internal":"internal","user":"user","state":"state","result":"dstatedt","output":"output","time":"t","initial_time":"initial_t"},"features":{"continuous":true,"discrete":false,"mixed":false,"has_array":false,"has_output":false,"has_user":false,"has_delay":false,"has_interpolate":false,"has_stochastic":false,"has_data":false,"has_compare":false,"has_include":false,"has_debug":false,"has_derivative":false,"initial_time_dependent":false},"data":{"elements":[{"name":"initial_y","location":"internal","storage_type":"double","rank":0,"dimnames":null,"stage":"constant"},{"name":"y","location":"variable","storage_type":"double","rank":0,"dimnames":null,"stage":"time"}],"variable":{"length":1,"contents":[{"name":"y","offset":0,"initial":"initial_y"}]},"output":{"length":0,"contents":[]}},"equations":[{"name":"deriv_y","type":"expression_scalar","source":[1],"depends":{"functions":["*","-"],"variables":["y"]},"lhs":"y","rhs":{"value":["*",["-",0.5],"y"]}},{"name":"initial_y","type":"expression_scalar","source":[2],"depends":null,"lhs":"initial_y","rhs":{"value":1}}],"debug":[],"components":{"create":{"variables":[],"equations":["initial_y"]},"user":{"variables":[],"equations":[]},"initial":{"variables":[],"equations":[]},"rhs":{"variables":["y"],"equations":["deriv_y"]},"update_stochastic":{"variables":[],"equations":[]},"output":{"variables":[],"equations":[]},"compare":{"variables":[],"equations":[]}},"user":[],"interpolate":{"min":[],"max":[],"critical":[]},"source":["deriv(y) <- -0.5 * y","initial(y) <- 1"]}
coef(exp_decay)
#> [1] name has_default default_value rank min
#> [6] max integer
#> <0 rows> (or 0-length row.names)