73 const std::array<casadi_dim, N_in> &dim_in = {},
74 const std::array<casadi_dim, N_out> &dim_out = {}) {
75 using namespace std::literals::string_literals;
76 static constexpr std::array count{
"first",
"second",
"third",
77 "fourth",
"fifth",
"sixth",
79 static_assert(N_in <= count.size());
80 static_assert(N_out <= count.size());
81 auto to_string = [](casadi_dim d) {
82 return "(" + std::to_string(d.first) +
", " +
83 std::to_string(d.second) +
")";
85 for (
size_t n = 0; n < N_in; ++n) {
87 if (dim_in[n].first != 0 && dim_in[n] != fun.size_in(cs_n))
88 throw invalid_argument_dimensions(
89 "Invalid dimension of "s + count[n] +
90 " input argument: got " + to_string(fun.size_in(cs_n)) +
91 ", should be " + to_string(dim_in[n]) +
".");
93 for (
size_t n = 0; n < N_out; ++n) {
95 if (dim_out[n].first != 0 && dim_out[n] != fun.size_out(cs_n))
96 throw invalid_argument_dimensions(
97 "Invalid dimension of "s + count[n] +
98 " output argument: got " + to_string(fun.size_out(cs_n)) +
99 ", should be " + to_string(dim_out[n]) +
".");
115 fun(arg_work.data(), res_work.data(), iwork.data(), dwork.data(), 0);