| odin_build {odin} | R Documentation | 
Build an odin model generator from its IR
Description
Build an odin model generator from its intermediate representation, as generated by odin_parse. This function is for advanced use.
Usage
odin_build(x, options = NULL)
Arguments
| x | An odin ir (json) object or output from odin_validate. | 
| options | Options to pass to the build stage (see odin_options | 
Details
In applications that want to inspect the intermediate
representation rather before compiling, rather than directly using
odin, use either odin_parse or
odin_validate and then pass the result to
odin::odin_build.
The return value of this function includes information about how long the compilation took, if it was successful, etc, in the same style as odin_validate:
- success
- Logical, indicating if compilation was successful 
- elapsed
- Time taken to compile the model, as a - proc_timeobject, as returned by proc.time.
- output
- Any output produced when compiling the model (only present if compiling to C, and if the cache was not hit. 
- model
- The model itself, as an - odin_generatorobject, as returned by odin.
- ir
- The intermediate representation. 
- error
- Any error thrown during compilation 
See Also
odin_parse, which creates intermediate representations used by this function.
Examples
# Parse a model of exponential decay
ir <- odin::odin_parse({
  deriv(y) <- -0.5 * y
  initial(y) <- 1
})
# Compile the model:
options <- odin::odin_options(target = "r")
res <- odin::odin_build(ir, options)
# All results:
res
# The model:
mod <- res$model$new()
mod$run(0:10)