DoubleVisitor {symengine} | R Documentation |
Double Visitor
Description
Construct DoubleVisitor
object from Basic
or VecBasic
and use it to numerically evaluate symbolic expressions.
Usage
DoubleVisitor(
exprs,
args,
perform_cse = TRUE,
llvm_opt_level = if (symengine_have_component("llvm")) 3L else -1L
)
visitor_call(visitor, input, do_transpose = FALSE)
Arguments
exprs |
A Basic object or a VecBasic object to be evaluated. |
args |
A VecBasic object indicating order of input arguments. Can be missing. |
perform_cse |
Boolean. |
llvm_opt_level |
Integer. If negative, it will return a |
visitor |
A DoubleVisitor object. |
input |
A numeric matrix. Each row is input value for one argument. |
do_transpose |
Boolean. Matters when |
Details
DoubleVisitor
constructs the visitor and visitor itself is callable.
visitor_call
is the low level function to call the visitor with input.
Value
DoubleVisitor
returns a callable LambdaDoubleVisitor
or
LLVMDoubleVisitor
. visitor_call
returns a numeric vector or matrix.
See Also
Examples
a <- S("a")
b <- S("b")
c <- S("c")
vec <- c(log(a), log(a)/log(b) + c)
func <- DoubleVisitor(vec, args = c(a, b, c))
args(func)
## Use closure
func(a = 1:10, b = 10:1, c = 1.43)
## Use visitor_call
input <- rbind(a = 1:10, b = 10:1, c = 1.43)
visitor_call(func, input, do_transpose = TRUE)