26 #ifndef CASADI_MAP_HPP
27 #define CASADI_MAP_HPP
29 #include "function_internal.hpp"
42 static Function create(
const std::string& parallelization,
58 bool is_a(
const std::string& type,
bool recursive)
const override;
61 virtual std::vector<std::string> get_function()
const override;
64 const Function& get_function(
const std::string &name)
const override;
67 bool has_function(
const std::string& fname)
const override;
74 return repmat(f_.sparsity_in(i), 1, n_);
77 return repmat(f_.sparsity_out(i), 1, n_);
84 double get_default_in(casadi_int ind)
const override {
return f_.default_in(ind);}
90 size_t get_n_in()
override {
return f_.n_in();}
98 std::string
get_name_in(casadi_int i)
override {
return f_.name_in(i);}
99 std::string
get_name_out(casadi_int i)
override {
return f_.name_out(i);}
106 int eval_gen(
const T** arg, T** res, casadi_int* iw, T* w,
int mem=0)
const;
109 int eval(
const double** arg,
double** res, casadi_int* iw,
double* w,
void* mem)
const override;
118 casadi_int* iw,
SXElem* w,
void* mem,
119 bool always_inline,
bool never_inline)
const override;
125 casadi_int* iw,
bvec_t* w,
void* mem)
const override;
130 int sp_reverse(
bvec_t** arg,
bvec_t** res, casadi_int* iw,
bvec_t* w,
void* mem)
const override;
156 void init(
const Dict& opts)
override;
163 Function get_forward(casadi_int nfwd,
const std::string& name,
164 const std::vector<std::string>& inames,
165 const std::vector<std::string>& onames,
166 const Dict& opts)
const override;
174 Function get_reverse(casadi_int nadj,
const std::string& name,
175 const std::vector<std::string>& inames,
176 const std::vector<std::string>& onames,
177 const Dict& opts)
const override;
181 Dict info()
const override {
return {{
"f", f_}, {
"n", n_}}; }
209 Map(
const std::string& name,
const Function& f, casadi_int n);
244 bool is_a(
const std::string& type,
bool recursive)
const override;
247 int eval(
const double** arg,
double** res, casadi_int* iw,
double* w,
void* mem)
const override;
252 void init(
const Dict& opts)
override;
290 std::string
class_name()
const override {
return "ThreadMap";}
295 bool is_a(
const std::string& type,
bool recursive)
const override;
298 int eval(
const double** arg,
double** res, casadi_int* iw,
double* w,
void* mem)
const override;
303 void init(
const Dict& opts)
override;
Helper class for C code generation.
Helper class for Serialization.
Internal class for Function.
size_t get_n_in() override
Number of function inputs and outputs.
double get_default_in(casadi_int ind) const override
Get default input value.
std::string serialize_base_function() const override
String used to identify the immediate FunctionInternal subclass.
Sparsity get_sparsity_out(casadi_int i) override
Sparsities of function inputs and outputs.
bool has_sprev() const override
Sparsity get_sparsity_in(casadi_int i) override
Sparsities of function inputs and outputs.
bool has_codegen() const override
Is codegen supported?
bool has_reverse(casadi_int nadj) const override
Generate a function that calculates nadj adjoint derivatives.
Dict info() const override
size_t get_n_out() override
Number of function inputs and outputs.
std::string class_name() const override
Get type name.
bool has_spfwd() const override
bool has_forward(casadi_int nfwd) const override
Generate a function that calculates nfwd forward derivatives.
std::string get_name_out(casadi_int i) override
Names of function input and outputs.
std::string get_name_in(casadi_int i) override
Names of function input and outputs.
virtual std::string parallelization() const
Type of parallellization.
OmpMap(const std::string &name, const Function &f, casadi_int n)
std::string class_name() const override
Get type name.
OmpMap(DeserializingStream &s)
Deserializing constructor.
std::string parallelization() const override
Type of parallellization.
Base class for FunctionInternal and LinsolInternal.
The basic scalar symbolic class of CasADi.
Helper class for Serialization.
std::string parallelization() const override
Type of parallellization.
ThreadMap(const std::string &name, const Function &f, casadi_int n)
ThreadMap(DeserializingStream &s)
Deserializing constructor.
std::string class_name() const override
Get type name.
unsigned long long bvec_t
GenericType::Dict Dict
C++ equivalent of Python's dict or MATLAB's struct.