3#include <alpaqa/casadi-loader-export.h>
24 Function(std::shared_ptr<void> so_handle,
const std::string &func_name);
32 [[nodiscard]] std::pair<casadi_int, casadi_int> size()
const;
36 [[nodiscard]]
bool is_dense()
const;
38 [[nodiscard]]
const casadi_int *colind()
const;
47 [[nodiscard]] std::pair<casadi_int, casadi_int> size_in(
casadi_int)
const;
48 [[nodiscard]] std::pair<casadi_int, casadi_int> size_out(
casadi_int)
const;
58 std::span<double *const> res) {
59 if (arg.size() !=
static_cast<size_t>(n_in()))
60 throw std::invalid_argument(
"Wrong number of arguments to CasADi "
62 if (res.size() !=
static_cast<size_t>(n_out()))
63 throw std::invalid_argument(
"Wrong number of outputs to CasADi "
67 std::ranges::copy(arg, work->arg.begin());
68 std::ranges::copy(res, work->res.begin());
69 functions.call(work->arg.data(), work->res.data(), work->iw.data(),
75 void load(
void *so_handle,
const std::string &func_name);
96 std::vector<const casadi_real *>
arg;
97 std::vector<casadi_real *>
res;
98 std::vector<casadi_int>
iw;
99 std::vector<casadi_real>
w;
113 return &colind()[size2() + 1];
#define BEGIN_ALPAQA_CASADI_LOADER_NAMESPACE
#define END_ALPAQA_CASADI_LOADER_NAMESPACE
Sparsity(const casadi_int *data)
const casadi_int * colind() const
std::pair< casadi_int, casadi_int > size() const
const casadi_int * row() const
Class that loads and calls pre-compiled CasADi functions in a DLL/SO file.
std::vector< const casadi_real * > arg
std::vector< casadi_real * > res
std::vector< casadi_int > iw
std::vector< casadi_real > w
std::shared_ptr< void > so_handle
std::optional< Work > work
void operator()(std::span< const double *const > arg, std::span< double *const > res)
Function external(const std::string &name, const std::string &bin_name, DynamicLoadFlags dl_flags)
Load the given CasADi function from the given DLL/SO file.
Flags to be passed to dlopen.