dm.hpp
1 /*
2  * This file is part of CasADi.
3  *
4  * CasADi -- A symbolic framework for dynamic optimization.
5  * Copyright (C) 2010-2023 Joel Andersson, Joris Gillis, Moritz Diehl,
6  * KU Leuven. All rights reserved.
7  * Copyright (C) 2011-2014 Greg Horn
8  *
9  * CasADi is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 3 of the License, or (at your option) any later version.
13  *
14  * CasADi is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with CasADi; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22  *
23  */
24 
25 #ifndef CASADI_DM_HPP
26 #define CASADI_DM_HPP
27 
28 #include "dm_fwd.hpp"
29 #include "matrix_decl.hpp"
30 
31 namespace casadi {
32 
33 
34  template<>
35  DM DM::
36  solve(const DM& A, const DM& b,
37  const std::string& lsolver, const Dict& dict);
38 
39  template<>
40  DM DM::
41  inv(const DM& A,
42  const std::string& lsolver, const Dict& dict);
43  template<>
44  DM DM::
45  pinv(const DM& A, const std::string& lsolver,
46  const Dict& dict);
47 
48  template<>
49  DM DM::
50  rand(const Sparsity& sp); // NOLINT(runtime/threadsafe_fn)
51 
52  template<>
53  DM DM::
54  expm(const DM& A);
55 
56  template<>
57  DM DM::
58  expm_const(const DM& A, const DM& t);
59 
60  template<>
61  DM DM::
62  _logsumexp(const DM& A);
63 
64  template<>
65  std::vector<DM> DM::
66  cse(const std::vector<DM>& e);
67 
68  template<> void DM::export_code(const std::string& lang,
69  std::ostream &stream, const Dict& options) const;
70 
71  template<>
72  Dict DM::info() const;
73 
74  template<>
75  void DM::to_file(const std::string& filename, const Sparsity& sp,
76  const double* nonzeros, const std::string& format);
77 
78  template<>
79  DM DM::from_file(const std::string& filename, const std::string& format_hint);
80 
81 #ifndef CASADI_DM_INSTANTIATOR_CPP
82  extern template class Matrix<double>;
83 #endif // CASADI_DM_INSTANTIATOR_CPP
84 
85 } // namespace casadi
86 
87 #endif // CASADI_DM_HPP
Dict info() const
void to_file(const std::string &filename, const std::string &format="") const
static Matrix< Scalar > rand(casadi_int nrow=1, casadi_int ncol=1)
Create a matrix with uniformly distributed random numbers.
void export_code(const std::string &lang, std::ostream &stream=casadi::uout(), const Dict &options=Dict()) const
Export matrix in specific language.
static Matrix< double > from_file(const std::string &filename, const std::string &format_hint="")
friend Matrix< Scalar > solve(const Matrix< Scalar > &A, const Matrix< Scalar > &b)
Solve a system of equations: A*x = b.
friend Matrix< Scalar > inv(const Matrix< Scalar > &A)
Matrix inverse.
friend Matrix< Scalar > expm_const(const Matrix< Scalar > &A, const Matrix< Scalar > &t)
Calculate Matrix exponential.
friend Matrix< Scalar > cse(const Matrix< Scalar > &e)
Common subexpression elimination.
friend Matrix< Scalar > expm(const Matrix< Scalar > &A)
Calculate Matrix exponential.
friend Matrix< Scalar > pinv(const Matrix< Scalar > &A)
Computes the Moore-Penrose pseudo-inverse.
The casadi namespace.
GenericType::Dict Dict
C++ equivalent of Python's dict or MATLAB's struct.
Matrix< double > DM
Definition: dm_fwd.hpp:33