Skip to contents

In the reference mode (the default) the solvers replay the floating point operations of the Julia packages: fused multiply adds are emulated exactly, and the norms, small LU factorizations, dot products and matrix vector products follow the operation order of OpenBLAS, so results match Julia bit for bit. In the native mode the same algorithms use R's arithmetic, sum(), \%*\% and LAPACK. The tolerances and the step size control are the same; results differ from the reference mode by rounding only, and the solves are faster (two to three times for ordinary differential equations, far more for dense optimizer kernels). The mode can also be set with options(modelcompR.arithmetic = "native") before the package loads.

Usage

arithmetic_mode(mode)

Arguments

mode

"reference" or "native"; missing returns the current mode.

Value

The previous mode, invisibly when mode is given.

Examples

old <- arithmetic_mode("native")
sol <- solve(ODEProblem(function(u, p, t) -u, 1, c(0, 1)), Tsit5())
arithmetic_mode(old)