Data types and arguments of code generation routines
Source:R/codegen-utilities.R
codegen-datatypes.RdDataType() holds the names of a data type in the target languages, and
get_default_datatype() chooses one for an expression, as in
sympy.utilities.codegen. InputArgument(), OutputArgument(),
InOutArgument() and Result() describe the arguments and results of a
routine made by make_routine(); their fields are read with
ast_attr().
Usage
DataType(cname, fname, pyname, jlname, octname, rsname)
get_default_datatype(expr, complex_allowed = NULL)
InputArgument(name, datatype = NULL, dimensions = NULL, precision = NULL)
OutputArgument(
name,
result_var,
expr,
datatype = NULL,
dimensions = NULL,
precision = NULL
)
InOutArgument(
name,
result_var,
expr,
datatype = NULL,
dimensions = NULL,
precision = NULL
)
Result(
expr,
name = NULL,
result_var = NULL,
datatype = NULL,
dimensions = NULL,
precision = NULL
)Arguments
- cname, fname, pyname, jlname, octname, rsname
The type names in C, Fortran, Python, Julia, Octave and Rust.
- expr
An expression.
- complex_allowed
Whether a complex type is allowed.
NULLreads the optionsymcompR.complex_allowed(defaultFALSE), which plays the part of SymPy's module flagCOMPLEX_ALLOWED.- name
A symbol (or, for
Result(), a name).- datatype
A
DataType().- dimensions
A list of
list(lower, upper)bounds.- precision
The precision, or
NULL.- result_var
The variable or element the result is stored in.
Examples
x <- Symbol("x")
get_default_datatype(x)
#> <DataType double>
InputArgument(x)
#> InputArgument(x)