casadi 3.6.7__cp27-none-manylinux2010_x86_64.whl → 3.7.1__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 +6529 -3037
- casadi/cbc +0 -0
- casadi/clp +0 -0
- casadi/cmake/casadi-config-version.cmake +1 -1
- casadi/cmake/casadi-config.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 +276 -47
- 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/callback.hpp +9 -0
- 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 +21 -0
- casadi/include/casadi/core/code_generator.hpp +115 -19
- casadi/include/casadi/core/core.hpp +5 -0
- casadi/include/casadi/core/dae_builder.hpp +303 -141
- casadi/include/casadi/core/dm.hpp +3 -0
- casadi/include/casadi/core/filesystem.hpp +58 -0
- casadi/include/casadi/core/fmu.hpp +62 -16
- casadi/include/casadi/core/function.hpp +24 -0
- casadi/include/casadi/core/generic_matrix.hpp +214 -7
- casadi/include/casadi/core/generic_shared.hpp +395 -0
- casadi/include/casadi/core/generic_shared_impl.hpp +218 -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 +71 -0
- casadi/include/casadi/core/mx.hpp +63 -2
- casadi/include/casadi/core/nlp_builder.hpp +2 -1
- 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_finite_diff.hpp +1 -1
- casadi/include/casadi/core/runtime/casadi_nlp.hpp +8 -2
- casadi/include/casadi/core/runtime/casadi_print_canonical.hpp +55 -0
- casadi/include/casadi/core/runtime/casadi_print_scalar.hpp +25 -0
- casadi/include/casadi/core/runtime/casadi_print_vector.hpp +32 -0
- casadi/include/casadi/core/runtime/casadi_printme.hpp +26 -0
- casadi/include/casadi/core/serializer.hpp +13 -5
- casadi/include/casadi/core/serializing_stream.hpp +9 -2
- 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 +10026 -6513
- casadi/include/casadi/doc_merged.i +6744 -4449
- 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 +7 -7
- {casadi-3.6.7.dist-info → casadi-3.7.1.dist-info}/METADATA +1 -1
- {casadi-3.6.7.dist-info → casadi-3.7.1.dist-info}/RECORD +211 -182
- 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.1.dist-info}/WHEEL +0 -0
@@ -0,0 +1,47 @@
|
|
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_BLAZING_SPLINE_FUNCTION_HPP
|
27
|
+
#define CASADI_BLAZING_SPLINE_FUNCTION_HPP
|
28
|
+
|
29
|
+
#include "function.hpp"
|
30
|
+
|
31
|
+
namespace casadi {
|
32
|
+
/** \brief Construct a specialized parametric BSpline
|
33
|
+
*
|
34
|
+
* Specialized in these ways:
|
35
|
+
* - order 3 is assumed
|
36
|
+
* - up to dimension 3 supported
|
37
|
+
* - a single scalar output (m=1)
|
38
|
+
*
|
39
|
+
|
40
|
+
\identifier{2b9} */
|
41
|
+
CASADI_EXPORT Function blazing_spline(const std::string& name,
|
42
|
+
const std::vector< std::vector<double> >& knots,
|
43
|
+
const Dict& opts=Dict());
|
44
|
+
|
45
|
+
} // namespace casadi
|
46
|
+
|
47
|
+
#endif // CASADI_BLAZING_SPLINE_FUNCTION_HPP
|
@@ -483,8 +483,6 @@ namespace casadi {
|
|
483
483
|
template<> struct F0XChecker<OP_MUL>{ static const bool check=true;};
|
484
484
|
template<> struct F0XChecker<OP_DIV>{ static const bool check=true;};
|
485
485
|
template<> struct F0XChecker<OP_NEG>{ static const bool check=true;};
|
486
|
-
template<> struct F0XChecker<OP_POW>{ static const bool check=true;};
|
487
|
-
template<> struct F0XChecker<OP_CONSTPOW>{ static const bool check=true;};
|
488
486
|
template<> struct F0XChecker<OP_SQRT>{ static const bool check=true;};
|
489
487
|
template<> struct F0XChecker<OP_SQ>{ static const bool check=true;};
|
490
488
|
template<> struct F0XChecker<OP_TWICE>{ static const bool check=true;};
|
@@ -1156,6 +1154,11 @@ namespace casadi {
|
|
1156
1154
|
\identifier{1gb} */
|
1157
1155
|
static inline void derF(unsigned char op, const T& x, const T& y, T& f, T* d);
|
1158
1156
|
|
1157
|
+
/** \brief Evaluate function on a const/linear/nonlinear partition
|
1158
|
+
|
1159
|
+
\identifier{28f} */
|
1160
|
+
static inline void fun_linear(unsigned char op, const T*x, const T* y, T* f);
|
1161
|
+
|
1159
1162
|
/** \brief Is binary operation?
|
1160
1163
|
|
1161
1164
|
\identifier{1gc} */
|
@@ -1545,6 +1548,56 @@ case OP_HYPOT: DerBinaryOperation<OP_HYPOT>::derf(X, Y, F, D); break;
|
|
1545
1548
|
case OP_LOG1P: \
|
1546
1549
|
case OP_EXPM1:
|
1547
1550
|
|
1551
|
+
template<typename T>
|
1552
|
+
inline void casadi_math<T>::fun_linear(unsigned char op, const T* x, const T* y, T* f) {
|
1553
|
+
if (op==OP_ADD || op==OP_SUB) {
|
1554
|
+
for (int i=0;i<3;++i) {
|
1555
|
+
f[i] = T::binary(op, x[i], y[i]);
|
1556
|
+
}
|
1557
|
+
} else if (op==OP_TWICE || op==OP_NEG) {
|
1558
|
+
for (int i=0;i<3;++i) {
|
1559
|
+
f[i] = T::unary(op, x[i]);
|
1560
|
+
}
|
1561
|
+
} else if (op==OP_MUL) {
|
1562
|
+
f[0] += x[0]*y[0];
|
1563
|
+
f[1] += x[0]*y[1];
|
1564
|
+
f[2] += x[0]*y[2];
|
1565
|
+
f[1] += x[1]*y[0];
|
1566
|
+
f[2] += x[1]*y[1];
|
1567
|
+
f[2] += x[1]*y[2];
|
1568
|
+
f[2] += x[2]*y[0];
|
1569
|
+
f[2] += x[2]*y[1];
|
1570
|
+
f[2] += x[2]*y[2];
|
1571
|
+
} else if (op==OP_DIV) {
|
1572
|
+
bool const_argy = y[1].is_zero() && y[2].is_zero();
|
1573
|
+
if (const_argy) {
|
1574
|
+
f[0] = x[0]/y[0];
|
1575
|
+
f[1] = x[1]/y[0];
|
1576
|
+
f[2] = x[2]/y[0];
|
1577
|
+
} else {
|
1578
|
+
f[2] = (x[0]+x[1]+x[2])/(y[0]+y[1]+y[2]);
|
1579
|
+
}
|
1580
|
+
} else if (casadi_math<T>::is_unary(op)) {
|
1581
|
+
bool const_arg = x[1].is_zero() && x[2].is_zero();
|
1582
|
+
if (const_arg) {
|
1583
|
+
f[0] = T::unary(op, x[0]);
|
1584
|
+
} else {
|
1585
|
+
f[2] = T::unary(op, x[0]+x[1]+x[2]);
|
1586
|
+
}
|
1587
|
+
|
1588
|
+
} else if (casadi_math<T>::is_binary(op)) {
|
1589
|
+
bool const_argx = x[1].is_zero() && x[2].is_zero();
|
1590
|
+
bool const_argy = y[1].is_zero() && y[2].is_zero();
|
1591
|
+
if (const_argx && const_argy) {
|
1592
|
+
f[0] = T::binary(op, x[0], y[0]);
|
1593
|
+
} else {
|
1594
|
+
f[2] = T::binary(op, x[0]+x[1]+x[2], y[0]+y[1]+y[2]);
|
1595
|
+
}
|
1596
|
+
} else {
|
1597
|
+
casadi_error("Not implemented");
|
1598
|
+
}
|
1599
|
+
}
|
1600
|
+
|
1548
1601
|
template<typename T>
|
1549
1602
|
bool casadi_math<T>::is_binary(unsigned char op) {
|
1550
1603
|
switch (op) {
|
@@ -1576,6 +1629,8 @@ case OP_HYPOT: DerBinaryOperation<OP_HYPOT>::derf(X, Y, F, D); break;
|
|
1576
1629
|
CASADI_MATH_BINARY_BUILTIN
|
1577
1630
|
case OP_IF_ELSE_ZERO:
|
1578
1631
|
return 2;
|
1632
|
+
case OP_CALL:
|
1633
|
+
return -1;
|
1579
1634
|
default:
|
1580
1635
|
return 1;
|
1581
1636
|
}
|
@@ -168,6 +168,15 @@ namespace casadi {
|
|
168
168
|
\identifier{og} */
|
169
169
|
virtual bool uses_output() const;
|
170
170
|
|
171
|
+
/** \brief Customize calls to the function factory
|
172
|
+
|
173
|
+
\identifier{2de} */
|
174
|
+
virtual Function get_factory(const std::string& name,
|
175
|
+
const std::vector<std::string>& s_in,
|
176
|
+
const std::vector<std::string>& s_out,
|
177
|
+
const Function::AuxOut& aux,
|
178
|
+
const Dict& opts) const;
|
179
|
+
|
171
180
|
///@{
|
172
181
|
/** \brief Return Jacobian of all input elements with respect to all output elements
|
173
182
|
|
@@ -183,6 +183,9 @@ namespace casadi {
|
|
183
183
|
template<typename T2>
|
184
184
|
std::string str(const std::map<std::string, T2> &p, bool more=false);
|
185
185
|
|
186
|
+
/// String representation of an array
|
187
|
+
template<typename T, size_t N>
|
188
|
+
std::string str(const std::array<T, N> &p, bool more=false);
|
186
189
|
|
187
190
|
//! \brief Create a list of strings from __VA_ARGS__, no argument
|
188
191
|
inline std::vector<std::string> strvec() {
|
@@ -309,8 +312,42 @@ namespace casadi {
|
|
309
312
|
ss << "}";
|
310
313
|
return ss.str();
|
311
314
|
}
|
315
|
+
|
316
|
+
template<typename T, size_t N>
|
317
|
+
std::string str(const std::array<T, N> &v, bool more) {
|
318
|
+
std::stringstream ss;
|
319
|
+
ss << "[";
|
320
|
+
for (casadi_int i=0; i<N; ++i) {
|
321
|
+
if (i!=0) ss << ", ";
|
322
|
+
ss << v[i];
|
323
|
+
}
|
324
|
+
ss << "]";
|
325
|
+
return ss.str();
|
326
|
+
}
|
327
|
+
|
312
328
|
#endif // SWIG
|
313
329
|
|
330
|
+
template<typename _Mutex>
|
331
|
+
class conditional_lock_guard {
|
332
|
+
public:
|
333
|
+
typedef _Mutex mutex_type;
|
334
|
+
|
335
|
+
conditional_lock_guard(mutex_type& m, bool condition) : mtx_(m), condition_(condition) {
|
336
|
+
if (condition_) mtx_.lock();
|
337
|
+
}
|
338
|
+
|
339
|
+
~conditional_lock_guard() {
|
340
|
+
if (condition_) mtx_.unlock();
|
341
|
+
}
|
342
|
+
|
343
|
+
conditional_lock_guard(const conditional_lock_guard&) = delete;
|
344
|
+
conditional_lock_guard& operator=(const conditional_lock_guard&) = delete;
|
345
|
+
|
346
|
+
private:
|
347
|
+
mutex_type& mtx_;
|
348
|
+
bool condition_;
|
349
|
+
};
|
350
|
+
|
314
351
|
} // namespace casadi
|
315
352
|
|
316
353
|
#include "casadi_logger.hpp"
|
@@ -100,6 +100,21 @@ namespace casadi {
|
|
100
100
|
|
101
101
|
\identifier{j9} */
|
102
102
|
static const char* install_prefix();
|
103
|
+
|
104
|
+
/** \brief Obtain shared library prefix
|
105
|
+
|
106
|
+
\identifier{2be} */
|
107
|
+
static const char* shared_library_prefix();
|
108
|
+
|
109
|
+
/** \brief Obtain shared library suffix
|
110
|
+
|
111
|
+
\identifier{2bf} */
|
112
|
+
static const char* shared_library_suffix();
|
113
|
+
|
114
|
+
/** \brief Obtain object file suffix
|
115
|
+
|
116
|
+
\identifier{2bg} */
|
117
|
+
static const char* object_file_suffix();
|
103
118
|
};
|
104
119
|
|
105
120
|
} // namespace casadi
|
@@ -426,6 +426,20 @@ private:
|
|
426
426
|
CASADI_EXPORT void normalized_setup(std::istream& stream);
|
427
427
|
CASADI_EXPORT void normalized_setup(std::ostream& stream);
|
428
428
|
|
429
|
+
|
430
|
+
class CASADI_EXPORT StreamStateGuard {
|
431
|
+
public:
|
432
|
+
explicit StreamStateGuard(std::ostream& os);
|
433
|
+
~StreamStateGuard();
|
434
|
+
|
435
|
+
private:
|
436
|
+
std::ostream& stream_;
|
437
|
+
std::ios::fmtflags flags_;
|
438
|
+
std::streamsize precision_;
|
439
|
+
std::streamsize width_;
|
440
|
+
std::locale locale_;
|
441
|
+
};
|
442
|
+
|
429
443
|
inline void normalized_out(std::ostream& stream, double val) {
|
430
444
|
if (val==std::numeric_limits<double>::infinity()) {
|
431
445
|
stream << "inf";
|
@@ -487,6 +501,13 @@ namespace std {
|
|
487
501
|
return stream;
|
488
502
|
}
|
489
503
|
|
504
|
+
/// Enables flushing an std::vector to a stream (prints representation)
|
505
|
+
template<typename T, size_t N>
|
506
|
+
ostream& operator<<(ostream& stream, const array<T, N>& v) {
|
507
|
+
stream << casadi::str(v);
|
508
|
+
return stream;
|
509
|
+
}
|
510
|
+
|
490
511
|
/// Enables flushing an std::set to a stream (prints representation)
|
491
512
|
template<typename T>
|
492
513
|
ostream& operator<<(ostream& stream, const set<T>& v) {
|
@@ -82,11 +82,19 @@ namespace casadi {
|
|
82
82
|
/// Add/get a shorthand
|
83
83
|
std::string shorthand(const std::string& name, bool allow_adding=true);
|
84
84
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
85
|
+
/* Add a sparsity pattern
|
86
|
+
*
|
87
|
+
* \param canonical If true, request canonical form,
|
88
|
+
* as opposed to potential dense abbreviation
|
89
|
+
*/
|
90
|
+
std::string sparsity(const Sparsity& sp, bool canonical=true);
|
91
|
+
|
92
|
+
/* Add a sparsity pattern, get index
|
93
|
+
*
|
94
|
+
* \param canonical If true, request canonical form,
|
95
|
+
* as opposed to potential dense abbreviation
|
96
|
+
*/
|
97
|
+
casadi_int add_sparsity(const Sparsity& sp, bool canonical=true);
|
90
98
|
|
91
99
|
/** \brief Get the index of an existing sparsity pattern
|
92
100
|
|
@@ -163,15 +171,26 @@ namespace casadi {
|
|
163
171
|
\identifier{s4} */
|
164
172
|
void define_rom_integer(const void* id, casadi_int size);
|
165
173
|
|
166
|
-
/** \brief Setup a callback
|
167
|
-
|
168
|
-
\identifier{27s} */
|
169
|
-
void setup_callback(const std::string& s, const Function& f);
|
170
174
|
/** \brief Access file scope integer read-only memory
|
171
175
|
|
172
176
|
\identifier{s5} */
|
173
177
|
std::string rom_integer(const void* id) const;
|
174
178
|
|
179
|
+
/** \brief Allocate file scope double writeable memory
|
180
|
+
|
181
|
+
\identifier{2aw} */
|
182
|
+
void define_pool_double(const std::string& name, const std::vector<double>& def);
|
183
|
+
|
184
|
+
/** \brief Access file scope double writeable memory
|
185
|
+
|
186
|
+
\identifier{2ax} */
|
187
|
+
std::string pool_double(const std::string& name) const;
|
188
|
+
|
189
|
+
/** \brief Setup a callback
|
190
|
+
|
191
|
+
\identifier{27s} */
|
192
|
+
void setup_callback(const std::string& s, const Function& f);
|
193
|
+
|
175
194
|
/** \brief Generate a call to a function (generic signature)
|
176
195
|
|
177
196
|
\identifier{s6} */
|
@@ -242,7 +261,7 @@ namespace casadi {
|
|
242
261
|
/** \brief Avoid stack?
|
243
262
|
|
244
263
|
\identifier{si} */
|
245
|
-
bool avoid_stack() { return avoid_stack_;}
|
264
|
+
bool avoid_stack() const { return avoid_stack_;}
|
246
265
|
|
247
266
|
/** \brief Print a constant in a lossless but compact manner
|
248
267
|
|
@@ -250,14 +269,38 @@ namespace casadi {
|
|
250
269
|
std::string constant(double v);
|
251
270
|
std::string constant(casadi_int v);
|
252
271
|
std::string constant(const std::string& v);
|
272
|
+
std::string constant(char v);
|
273
|
+
|
274
|
+
std::string format_padded(casadi_int i) const;
|
253
275
|
|
254
|
-
|
276
|
+
std::string zeros(casadi_int sz);
|
277
|
+
std::string ones(casadi_int sz);
|
278
|
+
|
279
|
+
/** \brief Print an initializer
|
255
280
|
|
256
281
|
\identifier{sk} */
|
257
|
-
|
258
|
-
std::string initializer(const std::vector<
|
259
|
-
|
260
|
-
|
282
|
+
template <typename T>
|
283
|
+
std::string initializer(const std::vector<T>& v) {
|
284
|
+
std::stringstream s;
|
285
|
+
if (v.size() > max_initializer_elements_per_line) {
|
286
|
+
s << "\n ";
|
287
|
+
}
|
288
|
+
|
289
|
+
s << "{";
|
290
|
+
for (casadi_int i = 0; i < v.size(); ++i) {
|
291
|
+
if (i != 0) {
|
292
|
+
if (max_initializer_elements_per_line > 1 &&
|
293
|
+
i % max_initializer_elements_per_line == 0) {
|
294
|
+
s << ",\n ";
|
295
|
+
} else {
|
296
|
+
s << ", ";
|
297
|
+
}
|
298
|
+
}
|
299
|
+
s << constant(v[i]);
|
300
|
+
}
|
301
|
+
s << "}";
|
302
|
+
return s.str();
|
303
|
+
}
|
261
304
|
|
262
305
|
/** \brief Sanitize source files for codegen
|
263
306
|
|
@@ -487,6 +530,11 @@ namespace casadi {
|
|
487
530
|
\identifier{te} */
|
488
531
|
std::string norm_inf(casadi_int n, const std::string& x);
|
489
532
|
|
533
|
+
/** \brief norm_1
|
534
|
+
|
535
|
+
\identifier{2br} */
|
536
|
+
std::string norm_1(casadi_int n, const std::string& x);
|
537
|
+
|
490
538
|
/**
|
491
539
|
|
492
540
|
* \brief norm_2
|
@@ -634,7 +682,15 @@ namespace casadi {
|
|
634
682
|
AUX_ORACLE_CALLBACK,
|
635
683
|
AUX_OCP_BLOCK,
|
636
684
|
AUX_ORACLE,
|
637
|
-
AUX_SCALED_COPY
|
685
|
+
AUX_SCALED_COPY,
|
686
|
+
AUX_BLAZING_DE_BOOR,
|
687
|
+
AUX_BLAZING_1D_BOOR_EVAL,
|
688
|
+
AUX_BLAZING_2D_BOOR_EVAL,
|
689
|
+
AUX_BLAZING_3D_BOOR_EVAL,
|
690
|
+
AUX_PRINTME,
|
691
|
+
AUX_PRINT_SCALAR,
|
692
|
+
AUX_PRINT_VECTOR,
|
693
|
+
AUX_PRINT_CANONICAL
|
638
694
|
};
|
639
695
|
|
640
696
|
/** \brief Add a built-in auxiliary function
|
@@ -650,11 +706,16 @@ namespace casadi {
|
|
650
706
|
const std::vector<Sparsity>& sp_out);
|
651
707
|
|
652
708
|
/** Get work vector name from index */
|
653
|
-
std::string work(casadi_int n, casadi_int sz) const;
|
709
|
+
std::string work(casadi_int n, casadi_int sz, bool is_ref) const;
|
654
710
|
|
655
711
|
/** Get work vector element from index */
|
656
712
|
std::string workel(casadi_int n) const;
|
657
713
|
|
714
|
+
/** \brief Reserve a maximum size of work elements, used for padding of index
|
715
|
+
|
716
|
+
\identifier{2ay} */
|
717
|
+
void reserve_work(casadi_int n);
|
718
|
+
|
658
719
|
/** Declare an array */
|
659
720
|
static std::string array(const std::string& type, const std::string& name, casadi_int len,
|
660
721
|
const std::string& def=std::string());
|
@@ -683,6 +744,21 @@ namespace casadi {
|
|
683
744
|
void print_vector(std::ostream &s, const std::string& name,
|
684
745
|
const std::vector<std::string>& v);
|
685
746
|
|
747
|
+
/** \brief Print canonical representaion of a matrix
|
748
|
+
|
749
|
+
\identifier{2dk} */
|
750
|
+
std::string print_canonical(const Sparsity& sp, const std::string& arg);
|
751
|
+
|
752
|
+
/** \brief Print canonical representaion of a vector
|
753
|
+
|
754
|
+
\identifier{2dl} */
|
755
|
+
std::string print_vector(casadi_int sz, const std::string& arg);
|
756
|
+
|
757
|
+
/** \brief Print canonical representaion of a scalar
|
758
|
+
|
759
|
+
\identifier{2dm} */
|
760
|
+
std::string print_scalar(const std::string& arg);
|
761
|
+
|
686
762
|
/** \brief Create a copy operation
|
687
763
|
|
688
764
|
\identifier{tt} */
|
@@ -692,6 +768,9 @@ namespace casadi {
|
|
692
768
|
void copy_default(const std::string& arg, std::size_t n, const std::string& res,
|
693
769
|
const std::string& def, bool check_rhs=true);
|
694
770
|
|
771
|
+
// Should we elide a copy?
|
772
|
+
bool elide_copy(casadi_int sz);
|
773
|
+
|
695
774
|
/** \brief Create a fill operation
|
696
775
|
|
697
776
|
\identifier{tu} */
|
@@ -791,10 +870,10 @@ namespace casadi {
|
|
791
870
|
static std::string casadi_version();
|
792
871
|
|
793
872
|
/// Print file header
|
794
|
-
static void
|
873
|
+
static void stream_open(std::ostream& f, bool cpp);
|
795
874
|
|
796
875
|
/// Print file header
|
797
|
-
static void
|
876
|
+
static void stream_close(std::ostream& f, bool cpp);
|
798
877
|
|
799
878
|
/** \brief Get number of temporary variables needed for all functions
|
800
879
|
|
@@ -887,6 +966,15 @@ namespace casadi {
|
|
887
966
|
// Have a flag for exporting/importing symbols
|
888
967
|
bool with_export, with_import;
|
889
968
|
|
969
|
+
// Maximum number of declarations per line
|
970
|
+
casadi_int max_declarations_per_line;
|
971
|
+
|
972
|
+
// Maximum number of initializer elements per line
|
973
|
+
casadi_int max_initializer_elements_per_line;
|
974
|
+
|
975
|
+
// Force the external API to use canonical sparsity
|
976
|
+
bool force_canonical;
|
977
|
+
|
890
978
|
// Prefix symbols in DLLs?
|
891
979
|
std::string dll_export, dll_import;
|
892
980
|
|
@@ -907,6 +995,12 @@ namespace casadi {
|
|
907
995
|
casadi_int indent_;
|
908
996
|
casadi_int current_indent_;
|
909
997
|
|
998
|
+
// Number of zeros/ones
|
999
|
+
casadi_int sz_zeros_;
|
1000
|
+
casadi_int sz_ones_;
|
1001
|
+
|
1002
|
+
casadi_int padding_length_;
|
1003
|
+
|
910
1004
|
// Names of exposed functions
|
911
1005
|
std::vector<std::string> exposed_fname;
|
912
1006
|
|
@@ -926,6 +1020,8 @@ namespace casadi {
|
|
926
1020
|
std::map<std::string, std::string> local_default_;
|
927
1021
|
std::map<const void *, casadi_int> file_scope_double_;
|
928
1022
|
std::map<const void *, casadi_int> file_scope_integer_;
|
1023
|
+
std::vector< std::vector<double> > pool_double_defaults_;
|
1024
|
+
std::map<std::string, casadi_int> pool_double_;
|
929
1025
|
|
930
1026
|
// Added functions
|
931
1027
|
struct FunctionMeta {
|
@@ -56,6 +56,7 @@
|
|
56
56
|
#include "expm.hpp"
|
57
57
|
#include "interpolant.hpp"
|
58
58
|
#include "external.hpp"
|
59
|
+
#include "blazing_spline.hpp"
|
59
60
|
|
60
61
|
// Misc
|
61
62
|
#include "integration_tools.hpp"
|
@@ -66,5 +67,9 @@
|
|
66
67
|
#include "optistack.hpp"
|
67
68
|
#include "serializer.hpp"
|
68
69
|
#include "tools.hpp"
|
70
|
+
#include "resource.hpp"
|
71
|
+
#include "archiver.hpp"
|
72
|
+
#include "filesystem.hpp"
|
73
|
+
#include "options.hpp"
|
69
74
|
|
70
75
|
#endif // CASADI_CORE_HPP
|