26 #ifndef CASADI_MULTIPLICATION_HPP
27 #define CASADI_MULTIPLICATION_HPP
29 #include "mx_node.hpp"
61 static MX create(
const MX& z,
const MX& x,
const MX& y,
62 const std::string& blas =
"reference");
68 const std::string& blas =
"reference");
78 std::string disp(
const std::vector<std::string>& arg)
const override;
84 const std::vector<casadi_int>& arg,
85 const std::vector<casadi_int>& res,
86 const std::vector<bool>& arg_is_ref,
87 std::vector<bool>& res_is_ref)
const override;
96 virtual void eval_kernel(
const double** arg,
double** res,
double* w)
const;
101 int eval_gen(
const T** arg, T** res, casadi_int* iw, T* w)
const {
102 if (arg[0]!=res[0]) std::copy(arg[0], arg[0]+dep(0).nnz(), res[0]);
103 eval_kernel(arg, res, w);
108 int eval(
const double** arg,
double** res, casadi_int* iw,
double* w)
const override {
109 return eval_gen<double>(arg, res, iw, w);
114 return eval_gen<SXElem>(arg, res, iw, w);
120 void eval_mx(
const std::vector<MX>& arg, std::vector<MX>& res,
121 const std::vector<bool>& unique={})
const override;
126 void eval_linear(
const std::vector<std::array<MX, 3> >& arg,
127 std::vector<std::array<MX, 3> >& res)
const override;
132 void ad_forward(
const std::vector<std::vector<MX> >& fseed,
133 std::vector<std::vector<MX> >& fsens)
const override;
138 void ad_reverse(
const std::vector<std::vector<MX> >& aseed,
139 std::vector<std::vector<MX> >& asens)
const override;
144 int sp_forward(
const bvec_t** arg,
bvec_t** res, casadi_int* iw,
bvec_t* w)
const override;
149 int eval_activity(
const bvec_t** arg,
bvec_t** res, casadi_int* iw,
bvec_t* w)
const override;
168 return sameOpAndDeps(node, depth) &&
dynamic_cast<const Multiplication*
>(node)!=
nullptr;
174 size_t sz_w()
const override {
return sparsity().size1();}
217 static MXNode* try_create(
const MX& z,
const MX& x,
const MX& y,
218 const std::string& blas =
"reference");
221 const std::string& blas =
"reference")
225 void eval_kernel(
const double** arg,
double** res,
double* w)
const override;
229 const std::vector<casadi_int>& arg,
230 const std::vector<casadi_int>& res,
231 const std::vector<bool>& arg_is_ref,
232 std::vector<bool>& res_is_ref)
const override;
248 static MXNode* try_create(
const MX& z,
const MX& x,
const MX& y,
249 const std::string& blas =
"reference");
252 const std::string& blas =
"reference")
256 void eval_kernel(
const double** arg,
double** res,
double* w)
const override;
260 const std::vector<casadi_int>& arg,
261 const std::vector<casadi_int>& res,
262 const std::vector<bool>& arg_is_ref,
263 std::vector<bool>& res_is_ref)
const override;
285 static MXNode* try_create(
const MX& z,
const MX& x,
const MX& y,
286 const std::string& blas =
"reference");
289 casadi_int nrow_x_compact, casadi_int ncol_x_compact,
290 casadi_int ncol_y_compact,
291 const std::string& blas =
"reference");
294 void eval_kernel(
const double** arg,
double** res,
double* w)
const override;
298 const std::vector<casadi_int>& arg,
299 const std::vector<casadi_int>& res,
300 const std::vector<bool>& arg_is_ref,
301 std::vector<bool>& res_is_ref)
const override;
309 casadi_int a_, b_, c_;
Helper class for C code generation.
Dense * Dense -> Dense matrix product.
~DenseMultiplication() override
DenseMultiplication(DeserializingStream &s, bool legacy=false)
DenseMultiplication(const MX &z, const MX &x, const MX &y, const std::string &blas="reference")
Dense * Sparse -> Dense matrix product.
DenseSparseMultiplication(DeserializingStream &s)
DenseSparseMultiplication(const MX &z, const MX &x, const MX &y, const std::string &blas="reference")
~DenseSparseMultiplication() override
Helper class for Serialization.
Node class for MX objects.
An MX atomic for matrix-matrix product,.
int eval(const double **arg, double **res, casadi_int *iw, double *w) const override
Evaluate the function numerically.
casadi_int n_inplace() const override
Can the operation be performed inplace (i.e. overwrite the result)
bool is_equal(const MXNode *node, casadi_int depth) const override
Check if two nodes are equivalent up to a given depth.
~Multiplication() override
Destructor.
int eval_gen(const T **arg, T **res, casadi_int *iw, T *w) const
Evaluate the function (template) — copy z, then run subclass kernel.
casadi_int op() const override
Get the operation.
size_t sz_w() const override
Get required length of w field.
casadi_int blas_shorthand_
int eval_sx(const SXElem **arg, SXElem **res, casadi_int *iw, SXElem *w) const override
Evaluate the function symbolically (SX)
Compactible * Compactible -> Compactible product.
~PseudoDenseMultiplication() override
The basic scalar symbolic class of CasADi.
Helper class for Serialization.
unsigned long long bvec_t