casadi 3.6.7__cp27-none-manylinux2010_x86_64.whl → 3.7.0__cp27-none-manylinux2010_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- casadi/_casadi.so +0 -0
- casadi/casadi-cli +0 -0
- casadi/casadi.py +6068 -3036
- casadi/cbc +0 -0
- casadi/clp +0 -0
- casadi/cmake/casadi-config-version.cmake +1 -1
- casadi/cmake/casadi-targets-release.cmake +5 -5
- casadi/cmake/casadi-targets.cmake +5 -5
- casadi/{lib64/cmake/tinyxml2/tinyxml2-config-version.cmake → cmake/libzip/libzip-config-version.cmake} +4 -18
- casadi/cmake/libzip/libzip-config.cmake +69 -0
- casadi/cmake/libzip/libzip-targets-release.cmake +19 -0
- casadi/{lib64/cmake/tinyxml2/tinyxml2-static-targets.cmake → cmake/libzip/libzip-targets.cmake} +11 -7
- casadi/cmake/libzip/modules/FindMbedTLS.cmake +141 -0
- casadi/cmake/libzip/modules/FindNettle.cmake +141 -0
- casadi/cmake/libzip/modules/Findzstd.cmake +186 -0
- casadi/include/casadi/casadi.i +194 -44
- casadi/include/casadi/config.h +11 -11
- casadi/include/casadi/core/archiver.hpp +58 -0
- casadi/include/casadi/core/blazing_spline.hpp +47 -0
- casadi/include/casadi/core/calculus.hpp +57 -2
- casadi/include/casadi/core/casadi_common.hpp +37 -0
- casadi/include/casadi/core/casadi_meta.hpp +15 -0
- casadi/include/casadi/core/casadi_misc.hpp +7 -0
- casadi/include/casadi/core/code_generator.hpp +95 -17
- casadi/include/casadi/core/core.hpp +5 -0
- casadi/include/casadi/core/dae_builder.hpp +283 -141
- casadi/include/casadi/core/dm.hpp +3 -0
- casadi/include/casadi/core/filesystem.hpp +58 -0
- casadi/include/casadi/core/fmu.hpp +51 -16
- casadi/include/casadi/core/function.hpp +19 -0
- casadi/include/casadi/core/generic_matrix.hpp +214 -7
- casadi/include/casadi/core/generic_shared.hpp +318 -0
- casadi/include/casadi/core/generic_shared_impl.hpp +214 -0
- casadi/include/casadi/core/generic_shared_internal.hpp +215 -0
- casadi/include/casadi/core/generic_type.hpp +3 -0
- casadi/include/casadi/core/global_options.hpp +10 -0
- casadi/include/casadi/core/integrator.hpp +41 -7
- casadi/include/casadi/core/matrix_decl.hpp +67 -0
- casadi/include/casadi/core/mx.hpp +63 -2
- casadi/include/casadi/core/options.hpp +6 -3
- casadi/include/casadi/core/optistack.hpp +43 -9
- casadi/include/casadi/core/printable.hpp +8 -0
- casadi/include/casadi/core/resource.hpp +107 -0
- casadi/include/casadi/core/runtime/casadi_blazing_1d_boor_eval.hpp +112 -0
- casadi/include/casadi/core/runtime/casadi_blazing_2d_boor_eval.hpp +311 -0
- casadi/include/casadi/core/runtime/casadi_blazing_3d_boor_eval.hpp +645 -0
- casadi/include/casadi/core/runtime/casadi_blazing_de_boor.hpp +101 -0
- casadi/include/casadi/core/runtime/casadi_nlp.hpp +8 -2
- casadi/include/casadi/core/runtime/casadi_printme.hpp +25 -0
- casadi/include/casadi/core/serializer.hpp +12 -4
- casadi/include/casadi/core/serializing_stream.hpp +3 -0
- casadi/include/casadi/core/shared_object.hpp +73 -161
- casadi/include/casadi/core/sparsity.hpp +13 -1
- casadi/include/casadi/core/sparsity_interface.hpp +19 -1
- casadi/include/casadi/core/sx.hpp +41 -0
- casadi/include/casadi/core/sx_elem.hpp +25 -0
- casadi/include/casadi/core/xml_node.hpp +5 -0
- casadi/include/casadi/doc.i +9703 -6539
- casadi/include/casadi/doc_merged.i +6483 -4447
- casadi/include/casadi/valgrind-casadi.supp +138 -0
- casadi/include/casadi/valgrind-python.supp +2470 -0
- casadi/include/licenses/libz-external/LICENSE +22 -0
- casadi/include/licenses/libz-external/contrib/dotzlib/LICENSE_1_0.txt +23 -0
- casadi/include/licenses/libzip-external/LICENSE +31 -0
- casadi/include/zconf.h +545 -0
- casadi/include/zip.h +528 -0
- casadi/include/zipconf.h +48 -0
- casadi/include/zlib.h +1938 -0
- casadi/libCbcSolver.so +0 -0
- casadi/libCbcSolver.so.3 +0 -0
- casadi/libCbcSolver.so.3.10.11 +0 -0
- casadi/libClpSolver.so +0 -0
- casadi/libClpSolver.so.1 +0 -0
- casadi/libClpSolver.so.1.14.9 +0 -0
- casadi/libbonmin.so +0 -0
- casadi/libbonmin.so.4 +0 -0
- casadi/libbonmin.so.4.8.9 +0 -0
- casadi/libcasadi.so +0 -0
- casadi/libcasadi.so.3.7 +0 -0
- casadi/libcasadi_archiver_libzip.so +0 -0
- casadi/libcasadi_archiver_libzip.so.3.7 +0 -0
- casadi/libcasadi_conic_cbc.so +0 -0
- casadi/libcasadi_conic_cbc.so.3.7 +0 -0
- casadi/libcasadi_conic_clp.so +0 -0
- casadi/libcasadi_conic_clp.so.3.7 +0 -0
- casadi/libcasadi_conic_cplex.so +0 -0
- casadi/libcasadi_conic_cplex.so.3.7 +0 -0
- casadi/libcasadi_conic_daqp.so +0 -0
- casadi/libcasadi_conic_daqp.so.3.7 +0 -0
- casadi/libcasadi_conic_gurobi.so +0 -0
- casadi/libcasadi_conic_gurobi.so.3.7 +0 -0
- casadi/libcasadi_conic_hpipm.so +0 -0
- casadi/libcasadi_conic_hpipm.so.3.7 +0 -0
- casadi/libcasadi_conic_ipqp.so +0 -0
- casadi/libcasadi_conic_ipqp.so.3.7 +0 -0
- casadi/libcasadi_conic_nlpsol.so +0 -0
- casadi/libcasadi_conic_nlpsol.so.3.7 +0 -0
- casadi/libcasadi_conic_osqp.so +0 -0
- casadi/libcasadi_conic_osqp.so.3.7 +0 -0
- casadi/libcasadi_conic_qpoases.so +0 -0
- casadi/libcasadi_conic_qpoases.so.3.7 +0 -0
- casadi/libcasadi_conic_qrqp.so +0 -0
- casadi/libcasadi_conic_qrqp.so.3.7 +0 -0
- casadi/libcasadi_conic_superscs.so +0 -0
- casadi/libcasadi_conic_superscs.so.3.7 +0 -0
- casadi/libcasadi_importer_shell.so +0 -0
- casadi/libcasadi_importer_shell.so.3.7 +0 -0
- casadi/libcasadi_integrator_collocation.so +0 -0
- casadi/libcasadi_integrator_collocation.so.3.7 +0 -0
- casadi/libcasadi_integrator_cvodes.so +0 -0
- casadi/libcasadi_integrator_cvodes.so.3.7 +0 -0
- casadi/libcasadi_integrator_idas.so +0 -0
- casadi/libcasadi_integrator_idas.so.3.7 +0 -0
- casadi/libcasadi_integrator_rk.so +0 -0
- casadi/libcasadi_integrator_rk.so.3.7 +0 -0
- casadi/libcasadi_interpolant_bspline.so +0 -0
- casadi/libcasadi_interpolant_bspline.so.3.7 +0 -0
- casadi/libcasadi_interpolant_linear.so +0 -0
- casadi/libcasadi_interpolant_linear.so.3.7 +0 -0
- casadi/libcasadi_linsol_csparse.so +0 -0
- casadi/libcasadi_linsol_csparse.so.3.7 +0 -0
- casadi/libcasadi_linsol_csparsecholesky.so +0 -0
- casadi/libcasadi_linsol_csparsecholesky.so.3.7 +0 -0
- casadi/libcasadi_linsol_lapacklu.so +0 -0
- casadi/libcasadi_linsol_lapacklu.so.3.7 +0 -0
- casadi/libcasadi_linsol_lapackqr.so +0 -0
- casadi/libcasadi_linsol_lapackqr.so.3.7 +0 -0
- casadi/libcasadi_linsol_ldl.so +0 -0
- casadi/libcasadi_linsol_ldl.so.3.7 +0 -0
- casadi/libcasadi_linsol_lsqr.so +0 -0
- casadi/libcasadi_linsol_lsqr.so.3.7 +0 -0
- casadi/libcasadi_linsol_ma27.so +0 -0
- casadi/libcasadi_linsol_ma27.so.3.7 +0 -0
- casadi/libcasadi_linsol_mumps.so +0 -0
- casadi/libcasadi_linsol_mumps.so.3.7 +0 -0
- casadi/libcasadi_linsol_qr.so +0 -0
- casadi/libcasadi_linsol_qr.so.3.7 +0 -0
- casadi/libcasadi_linsol_symbolicqr.so +0 -0
- casadi/libcasadi_linsol_symbolicqr.so.3.7 +0 -0
- casadi/libcasadi_linsol_tridiag.so +0 -0
- casadi/libcasadi_linsol_tridiag.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_ampl.so +0 -0
- casadi/libcasadi_nlpsol_ampl.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_blocksqp.so +0 -0
- casadi/libcasadi_nlpsol_blocksqp.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_bonmin.so +0 -0
- casadi/libcasadi_nlpsol_bonmin.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_feasiblesqpmethod.so +0 -0
- casadi/libcasadi_nlpsol_feasiblesqpmethod.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_ipopt.so +0 -0
- casadi/libcasadi_nlpsol_ipopt.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_knitro.so +0 -0
- casadi/libcasadi_nlpsol_knitro.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_madnlp.so +0 -0
- casadi/libcasadi_nlpsol_madnlp.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_qrsqp.so +0 -0
- casadi/libcasadi_nlpsol_qrsqp.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_scpgen.so +0 -0
- casadi/libcasadi_nlpsol_scpgen.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_snopt.so +0 -0
- casadi/libcasadi_nlpsol_snopt.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_sqpmethod.so +0 -0
- casadi/libcasadi_nlpsol_sqpmethod.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_worhp.so +0 -0
- casadi/libcasadi_nlpsol_worhp.so.3.7 +0 -0
- casadi/libcasadi_rootfinder_fast_newton.so +0 -0
- casadi/libcasadi_rootfinder_fast_newton.so.3.7 +0 -0
- casadi/libcasadi_rootfinder_kinsol.so +0 -0
- casadi/libcasadi_rootfinder_kinsol.so.3.7 +0 -0
- casadi/libcasadi_rootfinder_newton.so +0 -0
- casadi/libcasadi_rootfinder_newton.so.3.7 +0 -0
- casadi/libcasadi_rootfinder_nlpsol.so +0 -0
- casadi/libcasadi_rootfinder_nlpsol.so.3.7 +0 -0
- casadi/libcasadi_sundials_common.so +0 -0
- casadi/libcasadi_sundials_common.so.3.7 +0 -0
- casadi/libcasadi_xmlfile_tinyxml.so +0 -0
- casadi/libcasadi_xmlfile_tinyxml.so.3.7 +0 -0
- casadi/libcoinmumps.so +0 -0
- casadi/libcoinmumps.so.3 +0 -0
- casadi/libcoinmumps.so.3.0.1 +0 -0
- casadi/libdaqpstat.a +0 -0
- casadi/libindirect.a +0 -0
- casadi/libipopt.so +0 -0
- casadi/libipopt.so.3 +0 -0
- casadi/libipopt.so.3.14.11 +0 -0
- casadi/liblinsys.a +0 -0
- casadi/libosqp.a +0 -0
- casadi/libqdldl.a +0 -0
- casadi/libsipopt.so +0 -0
- casadi/libsipopt.so.3 +0 -0
- casadi/libsipopt.so.3.14.11 +0 -0
- casadi/libsuperscs.a +0 -0
- casadi/libz.a +0 -0
- casadi/libz.so +0 -0
- casadi/libz.so.1 +0 -0
- casadi/libz.so.1.3.1 +0 -0
- casadi/libzip.a +0 -0
- casadi/pkgconfig/casadi.pc +1 -1
- casadi/pkgconfig/libzip.pc +14 -0
- casadi/tools/__init__.py +3 -1
- casadi/tools/graph/graph.py +1 -1
- casadi/tools/structure.py +2 -2
- {casadi-3.6.7.dist-info → casadi-3.7.0.dist-info}/METADATA +1 -1
- {casadi-3.6.7.dist-info → casadi-3.7.0.dist-info}/RECORD +204 -178
- casadi/include/tinyxml2.h +0 -2380
- casadi/lib64/cmake/tinyxml2/tinyxml2-config.cmake +0 -57
- casadi/lib64/cmake/tinyxml2/tinyxml2-static-targets-release.cmake +0 -19
- casadi/lib64/libtinyxml2.a +0 -0
- casadi/lib64/pkgconfig/tinyxml2.pc +0 -10
- casadi/tools/structure3.py +0 -1441
- {casadi-3.6.7.dist-info → casadi-3.7.0.dist-info}/WHEEL +0 -0
@@ -0,0 +1,215 @@
|
|
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
|
+
|
26
|
+
#ifndef CASADI_GENERIC_SHARED_INTERNAL_HPP
|
27
|
+
#define CASADI_GENERIC_SHARED_INTERNAL_HPP
|
28
|
+
|
29
|
+
#include "generic_shared.hpp"
|
30
|
+
#ifdef CASADI_WITH_THREADSAFE_SYMBOLICS
|
31
|
+
#include <memory>
|
32
|
+
#endif // CASADI_WITH_THREADSAFE_SYMBOLICS
|
33
|
+
|
34
|
+
#ifdef CASADI_WITH_THREAD
|
35
|
+
#include <atomic>
|
36
|
+
#endif // CASADI_WITH_THREAD
|
37
|
+
|
38
|
+
namespace casadi {
|
39
|
+
|
40
|
+
/// \cond INTERNAL
|
41
|
+
/// Internal class for the reference counting framework, see comments on the public class.
|
42
|
+
template<typename Shared, typename Internal>
|
43
|
+
class GenericSharedInternal {
|
44
|
+
friend class GenericShared<Shared, Internal>;
|
45
|
+
public:
|
46
|
+
|
47
|
+
/// Default constructor
|
48
|
+
GenericSharedInternal();
|
49
|
+
|
50
|
+
/// Copy constructor
|
51
|
+
GenericSharedInternal(const GenericSharedInternal& node);
|
52
|
+
|
53
|
+
/// Assignment operator
|
54
|
+
GenericSharedInternal& operator=(const GenericSharedInternal& node);
|
55
|
+
|
56
|
+
/// Destructor
|
57
|
+
virtual ~GenericSharedInternal() = 0;
|
58
|
+
|
59
|
+
/// Get the reference count
|
60
|
+
casadi_int getCount() const;
|
61
|
+
|
62
|
+
std::string debug_repr(const Internal*) const;
|
63
|
+
|
64
|
+
/** \brief Get a weak reference to the object
|
65
|
+
|
66
|
+
\identifier{1ai} */
|
67
|
+
GenericWeakRef<Shared, Internal>* weak();
|
68
|
+
|
69
|
+
protected:
|
70
|
+
/** Called in the constructor of singletons to avoid that the counter reaches zero */
|
71
|
+
void initSingleton() {
|
72
|
+
casadi_assert_dev(static_cast<Internal*>(this)->count==0);
|
73
|
+
static_cast<Internal*>(this)->count++;
|
74
|
+
}
|
75
|
+
|
76
|
+
/** Called in the destructor of singletons */
|
77
|
+
void destroySingleton() {
|
78
|
+
static_cast<Internal*>(this)->count--;
|
79
|
+
}
|
80
|
+
|
81
|
+
/// Get a shared object from the current internal object
|
82
|
+
template<class B>
|
83
|
+
B shared_from_this() {
|
84
|
+
casadi_assert_dev(B::test_cast(static_cast<Internal*>(this)));
|
85
|
+
B ret;
|
86
|
+
ret.own(static_cast<Internal*>(this));
|
87
|
+
return ret;
|
88
|
+
}
|
89
|
+
|
90
|
+
/// Get a shared object from the current internal object
|
91
|
+
template<class B>
|
92
|
+
const B shared_from_this() const {
|
93
|
+
casadi_assert_dev(B::test_cast(static_cast<const Internal*>(this)));
|
94
|
+
B ret;
|
95
|
+
ret.own(const_cast<Internal*>(static_cast<const Internal*>(this)));
|
96
|
+
return ret;
|
97
|
+
}
|
98
|
+
|
99
|
+
private:
|
100
|
+
/// Weak pointer (non-owning) object for the object
|
101
|
+
GenericWeakRef<Shared, Internal>* weak_ref_;
|
102
|
+
};
|
103
|
+
|
104
|
+
template<typename Shared, typename Internal>
|
105
|
+
class GenericWeakRefInternal : public Internal {
|
106
|
+
public:
|
107
|
+
// Constructor
|
108
|
+
GenericWeakRefInternal(Internal* raw);
|
109
|
+
|
110
|
+
// Destructor
|
111
|
+
~GenericWeakRefInternal() override;
|
112
|
+
|
113
|
+
// Raw pointer to the cached object
|
114
|
+
Internal* raw_;
|
115
|
+
|
116
|
+
#ifdef CASADI_WITH_THREADSAFE_SYMBOLICS
|
117
|
+
mutable std::shared_ptr<std::mutex> mutex_;
|
118
|
+
#endif // CASADI_WITH_THREADSAFE_SYMBOLICS
|
119
|
+
};
|
120
|
+
|
121
|
+
|
122
|
+
template<class A>
|
123
|
+
A getcopy(const A& a,
|
124
|
+
std::map<typename A::base_type*,
|
125
|
+
typename A::internal_base_type> & already_copied) {
|
126
|
+
A ret;
|
127
|
+
if (!a.is_null()) {
|
128
|
+
auto it =
|
129
|
+
already_copied.find(const_cast<typename A::base_type*>(a.get()));
|
130
|
+
if (it!=already_copied.end()) {
|
131
|
+
ret.own(it->second.get());
|
132
|
+
}
|
133
|
+
}
|
134
|
+
return ret;
|
135
|
+
}
|
136
|
+
|
137
|
+
/// \endcond
|
138
|
+
|
139
|
+
|
140
|
+
template<typename Shared, typename Internal>
|
141
|
+
GenericSharedInternal<Shared, Internal>::
|
142
|
+
GenericSharedInternal(const GenericSharedInternal& node) {
|
143
|
+
static_cast<Internal*>(this)->count = 0; // reference counter is _not_ copied
|
144
|
+
weak_ref_ = nullptr; // nor will they have the same weak references
|
145
|
+
}
|
146
|
+
|
147
|
+
template<typename Shared, typename Internal>
|
148
|
+
GenericSharedInternal<Shared, Internal>&
|
149
|
+
GenericSharedInternal<Shared, Internal>::
|
150
|
+
operator=(const GenericSharedInternal<Shared, Internal>& node) {
|
151
|
+
// do _not_ copy the reference counter
|
152
|
+
return *this;
|
153
|
+
}
|
154
|
+
|
155
|
+
template<typename Shared, typename Internal>
|
156
|
+
GenericSharedInternal<Shared, Internal>::GenericSharedInternal() {
|
157
|
+
static_cast<Internal*>(this)->count = 0;
|
158
|
+
weak_ref_ = nullptr;
|
159
|
+
}
|
160
|
+
|
161
|
+
template<typename Shared, typename Internal>
|
162
|
+
std::string GenericSharedInternal<Shared, Internal>::debug_repr(const Internal* i) const {
|
163
|
+
// Note: i != this because of something something multiple inheritance
|
164
|
+
return str( (casadi_int)(i)) + "/" + static_cast<const Internal*>(this)->class_name();
|
165
|
+
}
|
166
|
+
|
167
|
+
template<typename Shared, typename Internal>
|
168
|
+
GenericSharedInternal<Shared, Internal>::~GenericSharedInternal() {
|
169
|
+
#ifdef WITH_REFCOUNT_WARNINGS
|
170
|
+
if (static_cast<Internal*>(this)->count!=0) {
|
171
|
+
// Note that casadi_assert_warning cannot be used in destructors
|
172
|
+
std::cerr << "Reference counting failure." <<
|
173
|
+
"Possible cause: Circular dependency in user code." << std::endl;
|
174
|
+
}
|
175
|
+
#endif // WITH_REFCOUNT_WARNINGS
|
176
|
+
if (weak_ref_!=nullptr) {
|
177
|
+
// Assumption: no other GenericSharedInternal instances
|
178
|
+
// point to the same WeakRefInternal through weak_ref_
|
179
|
+
weak_ref_->kill();
|
180
|
+
delete weak_ref_;
|
181
|
+
weak_ref_ = nullptr;
|
182
|
+
}
|
183
|
+
}
|
184
|
+
|
185
|
+
template<typename Shared, typename Internal>
|
186
|
+
casadi_int GenericSharedInternal<Shared, Internal>::getCount() const {
|
187
|
+
return static_cast<const Internal*>(this)->count;
|
188
|
+
}
|
189
|
+
|
190
|
+
template<typename Shared, typename Internal>
|
191
|
+
GenericWeakRef<Shared, Internal>* GenericSharedInternal<Shared, Internal>::weak() {
|
192
|
+
if (weak_ref_==nullptr) {
|
193
|
+
weak_ref_ = new GenericWeakRef<Shared, Internal>(static_cast<Internal*>(this));
|
194
|
+
}
|
195
|
+
return weak_ref_;
|
196
|
+
}
|
197
|
+
|
198
|
+
template<typename Shared, typename Internal>
|
199
|
+
GenericWeakRefInternal<Shared, Internal>::GenericWeakRefInternal(Internal* raw) :
|
200
|
+
raw_(raw)
|
201
|
+
#ifdef CASADI_WITH_THREADSAFE_SYMBOLICS
|
202
|
+
, mutex_(std::make_shared<std::mutex>())
|
203
|
+
#endif // CASADI_WITH_THREADSAFE_SYMBOLICS
|
204
|
+
{
|
205
|
+
}
|
206
|
+
|
207
|
+
template<typename Shared, typename Internal>
|
208
|
+
GenericWeakRefInternal<Shared, Internal>::~GenericWeakRefInternal() {
|
209
|
+
}
|
210
|
+
|
211
|
+
|
212
|
+
} // namespace casadi
|
213
|
+
|
214
|
+
|
215
|
+
#endif // CASADI_GENERIC_SHARED_INTERNAL_HPP
|
@@ -303,6 +303,9 @@ namespace casadi {
|
|
303
303
|
|
304
304
|
\identifier{17u} */
|
305
305
|
CASADI_EXPORT void update_dict(Dict& target, const Dict& source, bool recurse=false);
|
306
|
+
|
307
|
+
CASADI_EXPORT void update_dict(Dict& target, const std::string& key,
|
308
|
+
const GenericType& value, bool recurse=false);
|
306
309
|
#endif
|
307
310
|
|
308
311
|
} // namespace casadi
|
@@ -72,6 +72,8 @@ namespace casadi {
|
|
72
72
|
|
73
73
|
static bool julia_initialized;
|
74
74
|
|
75
|
+
static casadi_int copy_elision_min_size;
|
76
|
+
|
75
77
|
#endif //SWIG
|
76
78
|
// Setter and getter for simplification_on_the_fly
|
77
79
|
static void setSimplificationOnTheFly(bool flag) { simplification_on_the_fly = flag; }
|
@@ -90,6 +92,14 @@ namespace casadi {
|
|
90
92
|
static void setMaxNumDir(casadi_int ndir) { max_num_dir=ndir; }
|
91
93
|
static casadi_int getMaxNumDir() { return max_num_dir; }
|
92
94
|
|
95
|
+
static void setCopyElisionMinSize(casadi_int sz) {
|
96
|
+
copy_elision_min_size=sz;
|
97
|
+
if (copy_elision_min_size!=-1 && copy_elision_min_size<2) {
|
98
|
+
copy_elision_min_size = 2;
|
99
|
+
}
|
100
|
+
}
|
101
|
+
static casadi_int getCopyElisionMinSize() { return copy_elision_min_size; }
|
102
|
+
|
93
103
|
};
|
94
104
|
|
95
105
|
} // namespace casadi
|
@@ -144,36 +144,45 @@ namespace casadi {
|
|
144
144
|
\identifier{7g} */
|
145
145
|
CASADI_EXPORT casadi_int integrator_n_out();
|
146
146
|
|
147
|
-
/** \brief Get input scheme of
|
147
|
+
/** \brief Get input scheme of a DAE function
|
148
148
|
|
149
149
|
\identifier{25p} */
|
150
150
|
CASADI_EXPORT std::vector<std::string> dyn_in();
|
151
151
|
|
152
|
-
/** \brief Get
|
152
|
+
/** \brief Get output scheme of a DAE function
|
153
153
|
|
154
154
|
\identifier{25q} */
|
155
155
|
CASADI_EXPORT std::vector<std::string> dyn_out();
|
156
156
|
|
157
|
-
/** \brief Get
|
157
|
+
/** \brief Get input scheme of a DAE function by index
|
158
158
|
|
159
159
|
\identifier{25r} */
|
160
160
|
CASADI_EXPORT std::string dyn_in(casadi_int ind);
|
161
161
|
|
162
|
-
/** \brief Get output scheme
|
162
|
+
/** \brief Get output scheme of a DAE function by index
|
163
163
|
|
164
164
|
\identifier{25s} */
|
165
165
|
CASADI_EXPORT std::string dyn_out(casadi_int ind);
|
166
166
|
|
167
|
-
/** \brief Get the number of
|
167
|
+
/** \brief Get the number of inputs for a DAE function
|
168
168
|
|
169
169
|
\identifier{25t} */
|
170
170
|
CASADI_EXPORT casadi_int dyn_n_in();
|
171
171
|
|
172
|
-
/** \brief Get the number of
|
172
|
+
/** \brief Get the number of outputs for a DAE function
|
173
173
|
|
174
174
|
\identifier{25u} */
|
175
175
|
CASADI_EXPORT casadi_int dyn_n_out();
|
176
176
|
|
177
|
+
/** \brief Get input scheme of an event transition function
|
178
|
+
|
179
|
+
\identifier{2b4} */
|
180
|
+
CASADI_EXPORT std::vector<std::string> event_in();
|
181
|
+
|
182
|
+
/** \brief Get output scheme of an event transition functions
|
183
|
+
|
184
|
+
\identifier{2b5} */
|
185
|
+
CASADI_EXPORT std::vector<std::string> event_out();
|
177
186
|
/** @} */
|
178
187
|
|
179
188
|
#ifndef SWIG
|
@@ -186,13 +195,30 @@ enum DynIn {
|
|
186
195
|
DYN_U,
|
187
196
|
DYN_NUM_IN};
|
188
197
|
|
189
|
-
///
|
198
|
+
/// Outputs of the symbolic representation of the DAE
|
190
199
|
enum DynOut {
|
191
200
|
DYN_ODE,
|
192
201
|
DYN_ALG,
|
193
202
|
DYN_QUAD,
|
203
|
+
DYN_ZERO,
|
194
204
|
DYN_NUM_OUT};
|
195
205
|
|
206
|
+
/// Inputs of an event transition function
|
207
|
+
enum EventIn {
|
208
|
+
EVENT_INDEX,
|
209
|
+
EVENT_T,
|
210
|
+
EVENT_X,
|
211
|
+
EVENT_Z,
|
212
|
+
EVENT_P,
|
213
|
+
EVENT_U,
|
214
|
+
EVENT_NUM_IN};
|
215
|
+
|
216
|
+
/// Outputs of an event transition function
|
217
|
+
enum EventOut {
|
218
|
+
EVENT_POST_X,
|
219
|
+
EVENT_POST_Z,
|
220
|
+
EVENT_NUM_OUT};
|
221
|
+
|
196
222
|
/// Input arguments of an integrator
|
197
223
|
enum IntegratorInput {
|
198
224
|
/// Differential state at the initial time
|
@@ -241,12 +267,20 @@ template<> struct enum_traits<DynIn> {
|
|
241
267
|
template<> struct enum_traits<DynOut> {
|
242
268
|
static const size_t n_enum = DYN_NUM_OUT;
|
243
269
|
};
|
270
|
+
template<> struct enum_traits<EventIn> {
|
271
|
+
static const size_t n_enum = EVENT_NUM_IN;
|
272
|
+
};
|
273
|
+
template<> struct enum_traits<EventOut> {
|
274
|
+
static const size_t n_enum = EVENT_NUM_OUT;
|
275
|
+
};
|
244
276
|
///@}
|
245
277
|
|
246
278
|
///@{
|
247
279
|
/// Convert to string
|
248
280
|
CASADI_EXPORT std::string to_string(DynIn v);
|
249
281
|
CASADI_EXPORT std::string to_string(DynOut v);
|
282
|
+
CASADI_EXPORT std::string to_string(EventIn v);
|
283
|
+
CASADI_EXPORT std::string to_string(EventOut v);
|
250
284
|
///@}
|
251
285
|
|
252
286
|
#endif // SWIG
|
@@ -38,6 +38,13 @@
|
|
38
38
|
#include <typeinfo>
|
39
39
|
#include <vector>
|
40
40
|
#include <initializer_list>
|
41
|
+
#ifdef CASADI_WITH_THREAD
|
42
|
+
#ifdef CASADI_WITH_THREAD_MINGW
|
43
|
+
#include <mingw.mutex.h>
|
44
|
+
#else // CASADI_WITH_THREAD_MINGW
|
45
|
+
#include <mutex>
|
46
|
+
#endif // CASADI_WITH_THREAD_MINGW
|
47
|
+
#endif //CASADI_WITH_THREAD
|
41
48
|
|
42
49
|
namespace casadi {
|
43
50
|
|
@@ -284,6 +291,9 @@ namespace casadi {
|
|
284
291
|
const Matrix<Scalar> &x, const Matrix<Scalar> &y);
|
285
292
|
static Matrix<Scalar> matrix_matrix(casadi_int op,
|
286
293
|
const Matrix<Scalar> &x, const Matrix<Scalar> &y);
|
294
|
+
static std::vector< Matrix<Scalar> > call(const Function& f,
|
295
|
+
const std::vector< Matrix<Scalar> > &x);
|
296
|
+
static std::vector< Scalar > call(const Function& f, const std::vector< Scalar > &x);
|
287
297
|
///@}
|
288
298
|
/// \endcond
|
289
299
|
|
@@ -356,6 +366,12 @@ namespace casadi {
|
|
356
366
|
const Matrix<Scalar> &x_default,
|
357
367
|
bool short_circuit=false);
|
358
368
|
static bool depends_on(const Matrix<Scalar> &x, const Matrix<Scalar> &arg);
|
369
|
+
static bool contains(const std::vector<Matrix<Scalar> >& v, const Matrix<Scalar> &n);
|
370
|
+
static bool contains_all(const std::vector<Matrix<Scalar> >& v,
|
371
|
+
const std::vector<Matrix<Scalar> > &n);
|
372
|
+
static bool contains_any(const std::vector<Matrix<Scalar> >& v,
|
373
|
+
const std::vector<Matrix<Scalar> > &n);
|
374
|
+
|
359
375
|
static Matrix<Scalar> mrdivide(const Matrix<Scalar> &x, const Matrix<Scalar> &y);
|
360
376
|
static Matrix<Scalar> mldivide(const Matrix<Scalar> &x, const Matrix<Scalar> &y);
|
361
377
|
static std::vector<Matrix<Scalar> > symvar(const Matrix<Scalar> &x);
|
@@ -417,6 +433,15 @@ namespace casadi {
|
|
417
433
|
static Matrix<Scalar> mac(const Matrix<Scalar> &x,
|
418
434
|
const Matrix<Scalar> &y,
|
419
435
|
const Matrix<Scalar> &z);
|
436
|
+
static void extract_parametric(const Matrix<Scalar> &expr,
|
437
|
+
const Matrix<Scalar>& par,
|
438
|
+
Matrix<Scalar>& expr_ret,
|
439
|
+
std::vector<Matrix<Scalar> >& symbols,
|
440
|
+
std::vector<Matrix<Scalar>>& parametric,
|
441
|
+
const Dict& opts);
|
442
|
+
static void separate_linear(const Matrix<Scalar> &expr,
|
443
|
+
const Matrix<Scalar> &sym_lin, const Matrix<Scalar> &sym_const,
|
444
|
+
Matrix<Scalar>& expr_const, Matrix<Scalar>& expr_lin, Matrix<Scalar>& expr_nonlin);
|
420
445
|
///@}
|
421
446
|
|
422
447
|
///@{
|
@@ -749,6 +774,12 @@ namespace casadi {
|
|
749
774
|
* taylor(sin(x), x)
|
750
775
|
* \endcode
|
751
776
|
* \verbatim >> x \endverbatim
|
777
|
+
*
|
778
|
+
* \code
|
779
|
+
* taylor(sin(x),x,x0) -> sin(x0)+cos(x0)*(x-x0)
|
780
|
+
* \endcode
|
781
|
+
*
|
782
|
+
* \sa linearize, mtaylor, linear_coeff
|
752
783
|
|
753
784
|
\identifier{23q} */
|
754
785
|
friend inline Matrix<Scalar> taylor(const Matrix<Scalar>& ex, const Matrix<Scalar>& x,
|
@@ -765,6 +796,7 @@ namespace casadi {
|
|
765
796
|
* Do Taylor expansions until the aggregated order of a term is equal to 'order'.
|
766
797
|
* The aggregated order of \f$x^n y^m\f$ equals \f$n+m\f$.
|
767
798
|
*
|
799
|
+
* \sa taylor
|
768
800
|
|
769
801
|
\identifier{23r} */
|
770
802
|
friend inline Matrix<Scalar> mtaylor(const Matrix<Scalar>& ex, const Matrix<Scalar>& x,
|
@@ -796,6 +828,7 @@ namespace casadi {
|
|
796
828
|
* \endcode
|
797
829
|
* \f$ (-3 x^2 y-x^3)/6+y+x \f$
|
798
830
|
*
|
831
|
+
* \sa taylor
|
799
832
|
|
800
833
|
\identifier{23s} */
|
801
834
|
friend inline Matrix<Scalar> mtaylor(const Matrix<Scalar>& ex, const Matrix<Scalar>& x,
|
@@ -978,6 +1011,11 @@ namespace casadi {
|
|
978
1011
|
\identifier{19j} */
|
979
1012
|
Sparsity get_sparsity() const;
|
980
1013
|
|
1014
|
+
/** \brief Get an output
|
1015
|
+
|
1016
|
+
\identifier{28i} */
|
1017
|
+
Matrix<Scalar> get_output(casadi_int oind) const;
|
1018
|
+
|
981
1019
|
/** \brief Construct a sparse matrix from triplet form
|
982
1020
|
|
983
1021
|
* Default matrix size is max(col) x max(row)
|
@@ -1099,6 +1137,31 @@ namespace casadi {
|
|
1099
1137
|
\identifier{19v} */
|
1100
1138
|
bool is_constant() const;
|
1101
1139
|
|
1140
|
+
/** \brief Check if function call
|
1141
|
+
|
1142
|
+
\identifier{28j} */
|
1143
|
+
bool is_call() const;
|
1144
|
+
|
1145
|
+
/** \brief Check if evaluation output
|
1146
|
+
|
1147
|
+
\identifier{28k} */
|
1148
|
+
bool is_output() const;
|
1149
|
+
|
1150
|
+
/** \brief Check if a multiple output node
|
1151
|
+
|
1152
|
+
\identifier{28l} */
|
1153
|
+
bool has_output() const;
|
1154
|
+
|
1155
|
+
/** \brief Get the index of evaluation output - only valid when is_output() is true
|
1156
|
+
|
1157
|
+
\identifier{28m} */
|
1158
|
+
casadi_int which_output() const;
|
1159
|
+
|
1160
|
+
/** \brief Get function - only valid when is_call() is true
|
1161
|
+
|
1162
|
+
\identifier{28n} */
|
1163
|
+
Function which_function() const;
|
1164
|
+
|
1102
1165
|
/** \brief Check if the matrix is integer-valued
|
1103
1166
|
|
1104
1167
|
* (note that false negative answers are possible)
|
@@ -1301,6 +1364,10 @@ namespace casadi {
|
|
1301
1364
|
static Matrix<Scalar> _sym(const std::string& name, const Sparsity& sp);
|
1302
1365
|
/// \endcond
|
1303
1366
|
|
1367
|
+
#ifdef CASADI_WITH_THREADSAFE_SYMBOLICS
|
1368
|
+
static std::mutex& get_mutex_temp();
|
1369
|
+
#endif //CASADI_WITH_THREADSAFE_SYMBOLICS
|
1370
|
+
|
1304
1371
|
private:
|
1305
1372
|
/// Sparsity of the matrix in a compressed column storage (CCS) format
|
1306
1373
|
Sparsity sparsity_;
|
@@ -34,6 +34,14 @@
|
|
34
34
|
#include "generic_type.hpp"
|
35
35
|
#include "printable.hpp"
|
36
36
|
#include <vector>
|
37
|
+
#ifdef CASADI_WITH_THREAD
|
38
|
+
#ifdef CASADI_WITH_THREAD_MINGW
|
39
|
+
#include <mingw.mutex.h>
|
40
|
+
#else // CASADI_WITH_THREAD_MINGW
|
41
|
+
#include <mutex>
|
42
|
+
#endif // CASADI_WITH_THREAD_MINGW
|
43
|
+
#endif //CASADI_WITH_THREAD
|
44
|
+
|
37
45
|
namespace casadi {
|
38
46
|
|
39
47
|
/** \brief Forward declaration
|
@@ -122,6 +130,14 @@ namespace casadi {
|
|
122
130
|
\identifier{q5} */
|
123
131
|
MX(const Sparsity& sp, const std::string& fname);
|
124
132
|
|
133
|
+
|
134
|
+
/** \brief Construct matrix with a given sparsity and nonzeros,
|
135
|
+
|
136
|
+
* configurable in codegen via a pool
|
137
|
+
|
138
|
+
\identifier{2aa} */
|
139
|
+
MX(const Matrix<double>& val, const std::string& name);
|
140
|
+
|
125
141
|
/** \brief Create scalar constant (also implicit type conversion)
|
126
142
|
|
127
143
|
\identifier{q6} */
|
@@ -188,6 +204,21 @@ namespace casadi {
|
|
188
204
|
\identifier{qd} */
|
189
205
|
Sparsity get_sparsity() const { return sparsity();}
|
190
206
|
|
207
|
+
/** \brief Get nonzeros as list of scalar MXes
|
208
|
+
*
|
209
|
+
* Since MX is not a containter, the scalar MXes may be complex
|
210
|
+
* When the expression satisfies is_valid_input, the results may be simple
|
211
|
+
*
|
212
|
+
* For example:
|
213
|
+
* vertcat(x,y).nonzeros()
|
214
|
+
* will return {x,y}
|
215
|
+
*
|
216
|
+
* \sa expr.nz[:]
|
217
|
+
*
|
218
|
+
|
219
|
+
\identifier{2bh} */
|
220
|
+
std::vector<MX> get_nonzeros() const;
|
221
|
+
|
191
222
|
/** \brief Erase a submatrix (leaving structural zeros in its place)
|
192
223
|
|
193
224
|
Erase rows and/or columns of a matrix
|
@@ -611,6 +642,8 @@ namespace casadi {
|
|
611
642
|
static MX conditional(const MX& ind, const std::vector<MX> &x, const MX& x_default,
|
612
643
|
bool short_circuit=false);
|
613
644
|
static bool depends_on(const MX& x, const MX& arg);
|
645
|
+
static bool contains_all(const std::vector<MX>& v, const std::vector<MX> &n);
|
646
|
+
static bool contains_any(const std::vector<MX>& v, const std::vector<MX> &n);
|
614
647
|
static MX simplify(const MX& x);
|
615
648
|
static MX dot(const MX& x, const MX& y);
|
616
649
|
static MX mrdivide(const MX& a, const MX& b);
|
@@ -636,6 +669,11 @@ namespace casadi {
|
|
636
669
|
static MX cumsum(const MX &x, casadi_int axis=-1);
|
637
670
|
static MX _logsumexp(const MX& x);
|
638
671
|
static std::vector<MX> cse(const std::vector<MX>& e);
|
672
|
+
static void extract_parametric(const MX &expr, const MX& par,
|
673
|
+
MX& expr_ret, std::vector<MX>& symbols, std::vector<MX>& parametric, const Dict& opts);
|
674
|
+
static void separate_linear(const MX &expr,
|
675
|
+
const MX &sym_lin, const MX &sym_const,
|
676
|
+
MX& expr_const, MX& expr_lin, MX& expr_nonlin);
|
639
677
|
///@}
|
640
678
|
|
641
679
|
///@{
|
@@ -644,9 +682,15 @@ namespace casadi {
|
|
644
682
|
static MX low(const MX& v, const MX& p, const Dict& options = Dict());
|
645
683
|
static MX graph_substitute(const MX& x, const std::vector<MX> &v,
|
646
684
|
const std::vector<MX> &vdef);
|
685
|
+
static MX graph_substitute(const MX& x, const std::vector<MX> &v,
|
686
|
+
const std::vector<MX> &vdef, bool& updated);
|
687
|
+
static std::vector<MX> graph_substitute(const std::vector<MX> &ex,
|
688
|
+
const std::vector<MX> &v,
|
689
|
+
const std::vector<MX> &vdef);
|
647
690
|
static std::vector<MX> graph_substitute(const std::vector<MX> &ex,
|
648
|
-
const std::vector<MX> &
|
649
|
-
const std::vector<MX> &
|
691
|
+
const std::vector<MX> &v,
|
692
|
+
const std::vector<MX> &vdef,
|
693
|
+
bool& updated);
|
650
694
|
static MX matrix_expand(const MX& e, const std::vector<MX> &boundary,
|
651
695
|
const Dict& options);
|
652
696
|
static std::vector<MX> matrix_expand(const std::vector<MX>& e,
|
@@ -724,6 +768,11 @@ namespace casadi {
|
|
724
768
|
return MX::graph_substitute(ex, v, vdef);
|
725
769
|
}
|
726
770
|
|
771
|
+
inline friend MX graph_substitute(const MX& ex, const std::vector<MX> &v,
|
772
|
+
const std::vector<MX> &vdef, bool& updated) {
|
773
|
+
return MX::graph_substitute(ex, v, vdef, updated);
|
774
|
+
}
|
775
|
+
|
727
776
|
/** \brief Substitute multiple expressions in graph
|
728
777
|
|
729
778
|
* Substitute variable var with expression expr in
|
@@ -737,6 +786,14 @@ namespace casadi {
|
|
737
786
|
return MX::graph_substitute(ex, v, vdef);
|
738
787
|
}
|
739
788
|
|
789
|
+
inline friend std::vector<MX>
|
790
|
+
graph_substitute(const std::vector<MX> &ex,
|
791
|
+
const std::vector<MX> &v,
|
792
|
+
const std::vector<MX> &vdef,
|
793
|
+
bool& updated) {
|
794
|
+
return MX::graph_substitute(ex, v, vdef, updated);
|
795
|
+
}
|
796
|
+
|
740
797
|
/** \brief Expand MX graph to SXFunction call
|
741
798
|
*
|
742
799
|
* Expand the given expression e, optionally
|
@@ -928,6 +985,10 @@ namespace casadi {
|
|
928
985
|
// Create matrix symbolic primitive
|
929
986
|
static MX _sym(const std::string& name, const Sparsity& sp);
|
930
987
|
|
988
|
+
#ifdef CASADI_WITH_THREADSAFE_SYMBOLICS
|
989
|
+
static std::mutex& get_mutex_temp() { return mutex_temp; }
|
990
|
+
static std::mutex mutex_temp;
|
991
|
+
#endif //CASADI_WITH_THREADSAFE_SYMBOLICS
|
931
992
|
private:
|
932
993
|
|
933
994
|
/// Create an expression from a node: extra dummy arguments to avoid ambiguity for 0/NULL
|
@@ -30,7 +30,6 @@
|
|
30
30
|
|
31
31
|
namespace casadi {
|
32
32
|
/// \cond INTERNAL
|
33
|
-
#ifndef SWIG
|
34
33
|
|
35
34
|
/** \brief Options metadata for a class
|
36
35
|
|
@@ -39,6 +38,7 @@ namespace casadi {
|
|
39
38
|
|
40
39
|
\identifier{x9} */
|
41
40
|
struct CASADI_EXPORT Options {
|
41
|
+
#ifndef SWIG
|
42
42
|
// Base classes, whose options are also valid for the derived class
|
43
43
|
std::vector<const Options*> bases;
|
44
44
|
|
@@ -57,6 +57,8 @@ namespace casadi {
|
|
57
57
|
// Locate an entry
|
58
58
|
const Options::Entry* find(const std::string& name) const;
|
59
59
|
|
60
|
+
#endif // SWIG
|
61
|
+
|
60
62
|
// Get all entries
|
61
63
|
std::vector<std::string> all() const;
|
62
64
|
|
@@ -66,8 +68,10 @@ namespace casadi {
|
|
66
68
|
// Get description for an entry
|
67
69
|
std::string info(const std::string& name) const;
|
68
70
|
|
71
|
+
#ifndef SWIG
|
69
72
|
// Print all entries
|
70
73
|
void disp(std::ostream& stream) const;
|
74
|
+
#endif // SWIG
|
71
75
|
|
72
76
|
/** \brief A distance metric between two words
|
73
77
|
|
@@ -95,7 +99,7 @@ namespace casadi {
|
|
95
99
|
static bool is_sane(const Dict& opts);
|
96
100
|
|
97
101
|
/// Sanitize a options dictionary
|
98
|
-
static Dict sanitize(const Dict& opts);
|
102
|
+
static Dict sanitize(const Dict& opts, bool top_level=true);
|
99
103
|
|
100
104
|
/// Check if options exist
|
101
105
|
void check(const Dict& opts) const;
|
@@ -111,7 +115,6 @@ namespace casadi {
|
|
111
115
|
void print_one(const std::string &name, std::ostream &stream) const;
|
112
116
|
};
|
113
117
|
|
114
|
-
#endif // SWIG
|
115
118
|
/// \endcond
|
116
119
|
} // namespace casadi
|
117
120
|
|