Wrapper around casadi::Function providing Eigen-native IO.
More...
#include <Function.hpp>
|
| | Function (const std::string &name, const std::vector< SymbolicArg > &inputs, const std::vector< SymbolicArg > &outputs) |
| | Construct a new Function object.
|
| | Function (const std::vector< SymbolicArg > &inputs, const std::vector< SymbolicArg > &outputs) |
| | Constructor with auto-generated name.
|
| template<typename... Args> |
| auto | operator() (Args &&...args) const |
| | Evaluate function with arbitrary arguments (scalars or Eigen matrices) Handles both numeric (double/MatrixXd) and symbolic (MX/SymbolicMatrix) inputs.
|
| template<typename... Args> |
| auto | eval (Args &&...args) const |
| | Evaluate function and return first output.
|
| std::vector< NumericMatrix > | operator() (std::vector< double > &args) const |
| | Evaluate with a mutable vector of doubles.
|
| std::vector< NumericMatrix > | operator() (const std::vector< double > &args) const |
| | Evaluate with a const vector of doubles.
|
| const casadi::Function & | casadi_function () const |
| | Access the underlying CasADi function.
|
| Function | map (int n, MapParallelization parallelization=MapParallelization::Parallel) const |
| | Create a batched version of this function using CasADi's map primitive.
|
| Function | map (int n, const std::string ¶llelization) const |
| | Create a batched version using a direct CasADi backend name.
|
| Function | map (int n, MapParallelization parallelization, int max_num_threads) const |
| | Create a batched version of this function with an explicit thread cap.
|
| Function | map (int n, const std::string ¶llelization, int max_num_threads) const |
| | Create a batched version with explicit backend name and thread cap.
|
Wrapper around casadi::Function providing Eigen-native IO.
- See also
- SymbolicArg, make_function
◆ Function() [1/2]
| janus::Function::Function |
( |
const std::string & | name, |
|
|
const std::vector< SymbolicArg > & | inputs, |
|
|
const std::vector< SymbolicArg > & | outputs ) |
|
inline |
Construct a new Function object.
- Parameters
-
| name | Name of the function |
| inputs | Vector of symbolic arguments (scalars or matrices) describing the inputs |
| outputs | Vector of symbolic arguments (scalars or matrices) describing the outputs |
◆ Function() [2/2]
| janus::Function::Function |
( |
const std::vector< SymbolicArg > & | inputs, |
|
|
const std::vector< SymbolicArg > & | outputs ) |
|
inline |
Constructor with auto-generated name.
- Parameters
-
| inputs | Vector of symbolic arguments (scalars or matrices) describing the inputs |
| outputs | Vector of symbolic arguments (scalars or matrices) describing the outputs |
◆ casadi_function()
| const casadi::Function & janus::Function::casadi_function |
( |
| ) |
const |
|
inline |
Access the underlying CasADi function.
- Returns
- const reference to casadi::Function
◆ eval()
template<typename... Args>
| auto janus::Function::eval |
( |
Args &&... | args | ) |
const |
|
inline |
◆ map() [1/4]
| Function janus::Function::map |
( |
int | n, |
|
|
const std::string & | parallelization ) const |
|
inline |
Create a batched version using a direct CasADi backend name.
- Parameters
-
| n | Number of batch samples |
| parallelization | Backend string ("openmp", "serial", or "unroll") |
- Returns
- Batched Janus function wrapper
◆ map() [2/4]
| Function janus::Function::map |
( |
int | n, |
|
|
const std::string & | parallelization, |
|
|
int | max_num_threads ) const |
|
inline |
Create a batched version with explicit backend name and thread cap.
- Parameters
-
| n | Number of batch samples |
| parallelization | Backend string ("openmp", "serial", or "unroll") |
| max_num_threads | Maximum worker threads |
- Returns
- Batched Janus function wrapper
◆ map() [3/4]
Create a batched version of this function with an explicit thread cap.
- Parameters
-
| n | Number of batch samples |
| parallelization | Mapping backend selection |
| max_num_threads | Maximum number of worker threads for supported backends |
- Returns
- Function Batched Janus function wrapper
◆ map() [4/4]
Create a batched version of this function using CasADi's map primitive.
For a function f(a, b) -> (y), map(n) returns F(A, B) -> (Y) where each input/output is the horizontal concatenation of n samples: A = horzcat([a0, a1, ..., a_(n-1)]), Y = horzcat([y0, y1, ..., y_(n-1)]).
The default backend is MapParallelization::Parallel, which requests CasADi's OpenMP mapper for parallel batch evaluation. CasADi falls back to serial if it was built without OpenMP support.
Use this for batch evaluation over multiple independent samples while preserving CasADi's derivative propagation through the mapped graph.
- Parameters
-
| n | Number of batch samples |
| parallelization | Mapping backend selection |
- Returns
- Function Batched Janus function wrapper
◆ operator()() [1/3]
template<typename... Args>
| auto janus::Function::operator() |
( |
Args &&... | args | ) |
const |
|
inline |
Evaluate function with arbitrary arguments (scalars or Eigen matrices) Handles both numeric (double/MatrixXd) and symbolic (MX/SymbolicMatrix) inputs.
- Template Parameters
-
- Parameters
-
| args | Variadic arguments matching the function inputs |
- Returns
- Vector of result matrices (NumericMatrix or SymbolicMatrix)
◆ operator()() [2/3]
| std::vector< NumericMatrix > janus::Function::operator() |
( |
const std::vector< double > & | args | ) |
const |
|
inline |
Evaluate with a const vector of doubles.
- Parameters
-
- Returns
- Vector of numeric result matrices
◆ operator()() [3/3]
| std::vector< NumericMatrix > janus::Function::operator() |
( |
std::vector< double > & | args | ) |
const |
|
inline |
Evaluate with a mutable vector of doubles.
- Parameters
-
- Returns
- Vector of numeric result matrices
The documentation for this class was generated from the following file: