casadi 3.6.4__cp312-none-manylinux2014_i686.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.
Files changed (1484) hide show
  1. casadi/__init__.py +92 -0
  2. casadi/_casadi.so +0 -0
  3. casadi/casadi-cli +0 -0
  4. casadi/casadi.py +50467 -0
  5. casadi/cbc +0 -0
  6. casadi/clp +0 -0
  7. casadi/cmake/alpaqa/alpaqaConfig.cmake +24 -0
  8. casadi/cmake/alpaqa/alpaqaConfigVersion.cmake +70 -0
  9. casadi/cmake/alpaqa/alpaqaTargets-release.cmake +29 -0
  10. casadi/cmake/alpaqa/alpaqaTargets.cmake +131 -0
  11. casadi/cmake/casadi-config-version.cmake +11 -0
  12. casadi/cmake/casadi-config.cmake +8 -0
  13. casadi/cmake/casadi-targets-release.cmake +19 -0
  14. casadi/cmake/casadi-targets.cmake +107 -0
  15. casadi/cmake/highs/highs-config.cmake +24 -0
  16. casadi/cmake/highs/highs-targets-release.cmake +28 -0
  17. casadi/cmake/highs/highs-targets.cmake +114 -0
  18. casadi/cmake/osqp/osqp-config.cmake +1 -0
  19. casadi/cmake/osqp/osqp-targets-noconfig.cmake +29 -0
  20. casadi/cmake/osqp/osqp-targets.cmake +109 -0
  21. casadi/cmake/proxsuite/find-external/Simde/FindSimde.cmake +39 -0
  22. casadi/cmake/proxsuite/proxsuiteConfig.cmake +177 -0
  23. casadi/cmake/proxsuite/proxsuiteConfigVersion.cmake +70 -0
  24. casadi/cmake/proxsuite/proxsuiteTargets.cmake +115 -0
  25. casadi/cmake/qdldl/qdldl-config.cmake +1 -0
  26. casadi/cmake/qdldl/qdldl-targets-noconfig.cmake +29 -0
  27. casadi/cmake/qdldl/qdldl-targets.cmake +109 -0
  28. casadi/cmake/sleqp/sleqp-config-version.cmake +70 -0
  29. casadi/cmake/sleqp/sleqp-config.cmake +1 -0
  30. casadi/cmake/sleqp/sleqp-targets-release.cmake +20 -0
  31. casadi/cmake/sleqp/sleqp-targets.cmake +102 -0
  32. casadi/cmake/trlib/trlib-config-release.cmake +19 -0
  33. casadi/cmake/trlib/trlib-config-version.cmake +88 -0
  34. casadi/cmake/trlib/trlib-config.cmake +107 -0
  35. casadi/highs +0 -0
  36. casadi/include/casadi/casadi.hpp +31 -0
  37. casadi/include/casadi/casadi.i +4673 -0
  38. casadi/include/casadi/casadi_c.h +136 -0
  39. casadi/include/casadi/casadi_numpy.hpp +97 -0
  40. casadi/include/casadi/config.h +46 -0
  41. casadi/include/casadi/core/calculus.hpp +1750 -0
  42. casadi/include/casadi/core/callback.hpp +226 -0
  43. casadi/include/casadi/core/casadi_common.hpp +317 -0
  44. casadi/include/casadi/core/casadi_enum.hpp +90 -0
  45. casadi/include/casadi/core/casadi_export.h +42 -0
  46. casadi/include/casadi/core/casadi_interrupt.hpp +83 -0
  47. casadi/include/casadi/core/casadi_limits.hpp +104 -0
  48. casadi/include/casadi/core/casadi_logger.hpp +134 -0
  49. casadi/include/casadi/core/casadi_meta.hpp +107 -0
  50. casadi/include/casadi/core/casadi_misc.hpp +949 -0
  51. casadi/include/casadi/core/casadi_types.hpp +65 -0
  52. casadi/include/casadi/core/code_generator.hpp +918 -0
  53. casadi/include/casadi/core/conic.hpp +213 -0
  54. casadi/include/casadi/core/core.hpp +69 -0
  55. casadi/include/casadi/core/dae_builder.hpp +723 -0
  56. casadi/include/casadi/core/dm.hpp +87 -0
  57. casadi/include/casadi/core/dm_fwd.hpp +39 -0
  58. casadi/include/casadi/core/dple.hpp +138 -0
  59. casadi/include/casadi/core/exception.hpp +167 -0
  60. casadi/include/casadi/core/expm.hpp +84 -0
  61. casadi/include/casadi/core/external.hpp +70 -0
  62. casadi/include/casadi/core/fmu.hpp +224 -0
  63. casadi/include/casadi/core/function.hpp +1347 -0
  64. casadi/include/casadi/core/generic_expression.hpp +760 -0
  65. casadi/include/casadi/core/generic_matrix.hpp +1598 -0
  66. casadi/include/casadi/core/generic_type.hpp +287 -0
  67. casadi/include/casadi/core/global_options.hpp +95 -0
  68. casadi/include/casadi/core/im.hpp +52 -0
  69. casadi/include/casadi/core/im_fwd.hpp +35 -0
  70. casadi/include/casadi/core/importer.hpp +221 -0
  71. casadi/include/casadi/core/integration_tools.hpp +292 -0
  72. casadi/include/casadi/core/integrator.hpp +256 -0
  73. casadi/include/casadi/core/interpolant.hpp +163 -0
  74. casadi/include/casadi/core/linsol.hpp +171 -0
  75. casadi/include/casadi/core/matrix_decl.hpp +1337 -0
  76. casadi/include/casadi/core/matrix_fwd.hpp +37 -0
  77. casadi/include/casadi/core/mx.hpp +938 -0
  78. casadi/include/casadi/core/nlp_builder.hpp +162 -0
  79. casadi/include/casadi/core/nlp_tools.hpp +124 -0
  80. casadi/include/casadi/core/nlpsol.hpp +234 -0
  81. casadi/include/casadi/core/nonzeros.hpp +111 -0
  82. casadi/include/casadi/core/options.hpp +119 -0
  83. casadi/include/casadi/core/optistack.hpp +647 -0
  84. casadi/include/casadi/core/polynomial.hpp +126 -0
  85. casadi/include/casadi/core/printable.hpp +73 -0
  86. casadi/include/casadi/core/rootfinder.hpp +176 -0
  87. casadi/include/casadi/core/runtime/casadi_axpy.hpp +8 -0
  88. casadi/include/casadi/core/runtime/casadi_bfgs.hpp +49 -0
  89. casadi/include/casadi/core/runtime/casadi_bilin.hpp +42 -0
  90. casadi/include/casadi/core/runtime/casadi_bound_consistency.hpp +51 -0
  91. casadi/include/casadi/core/runtime/casadi_cache.hpp +59 -0
  92. casadi/include/casadi/core/runtime/casadi_clear.hpp +27 -0
  93. casadi/include/casadi/core/runtime/casadi_clip_max.hpp +33 -0
  94. casadi/include/casadi/core/runtime/casadi_clip_min.hpp +33 -0
  95. casadi/include/casadi/core/runtime/casadi_convexify.hpp +182 -0
  96. casadi/include/casadi/core/runtime/casadi_copy.hpp +31 -0
  97. casadi/include/casadi/core/runtime/casadi_cvx.hpp +463 -0
  98. casadi/include/casadi/core/runtime/casadi_de_boor.hpp +36 -0
  99. casadi/include/casadi/core/runtime/casadi_dense_lsqr.hpp +247 -0
  100. casadi/include/casadi/core/runtime/casadi_densify.hpp +48 -0
  101. casadi/include/casadi/core/runtime/casadi_dot.hpp +27 -0
  102. casadi/include/casadi/core/runtime/casadi_feasiblesqpmethod.hpp +208 -0
  103. casadi/include/casadi/core/runtime/casadi_file_slurp.hpp +32 -0
  104. casadi/include/casadi/core/runtime/casadi_fill.hpp +27 -0
  105. casadi/include/casadi/core/runtime/casadi_finite_diff.hpp +345 -0
  106. casadi/include/casadi/core/runtime/casadi_flip.hpp +33 -0
  107. casadi/include/casadi/core/runtime/casadi_getu.hpp +35 -0
  108. casadi/include/casadi/core/runtime/casadi_iamax.hpp +36 -0
  109. casadi/include/casadi/core/runtime/casadi_interpn.hpp +39 -0
  110. casadi/include/casadi/core/runtime/casadi_interpn_grad.hpp +72 -0
  111. casadi/include/casadi/core/runtime/casadi_interpn_interpolate.hpp +43 -0
  112. casadi/include/casadi/core/runtime/casadi_interpn_weights.hpp +39 -0
  113. casadi/include/casadi/core/runtime/casadi_ipqp.hpp +868 -0
  114. casadi/include/casadi/core/runtime/casadi_jac.hpp +186 -0
  115. casadi/include/casadi/core/runtime/casadi_kkt.hpp +67 -0
  116. casadi/include/casadi/core/runtime/casadi_kron.hpp +50 -0
  117. casadi/include/casadi/core/runtime/casadi_ldl.hpp +109 -0
  118. casadi/include/casadi/core/runtime/casadi_logsumexp.hpp +41 -0
  119. casadi/include/casadi/core/runtime/casadi_low.hpp +65 -0
  120. casadi/include/casadi/core/runtime/casadi_lsqr.hpp +247 -0
  121. casadi/include/casadi/core/runtime/casadi_masked_norm_inf.hpp +33 -0
  122. casadi/include/casadi/core/runtime/casadi_max_viol.hpp +37 -0
  123. casadi/include/casadi/core/runtime/casadi_mmax.hpp +28 -0
  124. casadi/include/casadi/core/runtime/casadi_mmin.hpp +29 -0
  125. casadi/include/casadi/core/runtime/casadi_mtimes.hpp +75 -0
  126. casadi/include/casadi/core/runtime/casadi_mv.hpp +46 -0
  127. casadi/include/casadi/core/runtime/casadi_mv_dense.hpp +39 -0
  128. casadi/include/casadi/core/runtime/casadi_nd_boor_dual_eval.hpp +127 -0
  129. casadi/include/casadi/core/runtime/casadi_nd_boor_eval.hpp +120 -0
  130. casadi/include/casadi/core/runtime/casadi_newton.hpp +66 -0
  131. casadi/include/casadi/core/runtime/casadi_nlp.hpp +149 -0
  132. casadi/include/casadi/core/runtime/casadi_norm_1.hpp +29 -0
  133. casadi/include/casadi/core/runtime/casadi_norm_2.hpp +24 -0
  134. casadi/include/casadi/core/runtime/casadi_norm_inf.hpp +28 -0
  135. casadi/include/casadi/core/runtime/casadi_norm_inf_mul.hpp +105 -0
  136. casadi/include/casadi/core/runtime/casadi_polyval.hpp +29 -0
  137. casadi/include/casadi/core/runtime/casadi_project.hpp +39 -0
  138. casadi/include/casadi/core/runtime/casadi_qp.hpp +86 -0
  139. casadi/include/casadi/core/runtime/casadi_qr.hpp +272 -0
  140. casadi/include/casadi/core/runtime/casadi_qrqp.hpp +1239 -0
  141. casadi/include/casadi/core/runtime/casadi_rank1.hpp +40 -0
  142. casadi/include/casadi/core/runtime/casadi_regularize.hpp +73 -0
  143. casadi/include/casadi/core/runtime/casadi_runtime.hpp +315 -0
  144. casadi/include/casadi/core/runtime/casadi_scal.hpp +26 -0
  145. casadi/include/casadi/core/runtime/casadi_sparsify.hpp +42 -0
  146. casadi/include/casadi/core/runtime/casadi_sparsity.hpp +24 -0
  147. casadi/include/casadi/core/runtime/casadi_sqpmethod.hpp +168 -0
  148. casadi/include/casadi/core/runtime/casadi_sum.hpp +31 -0
  149. casadi/include/casadi/core/runtime/casadi_sum_viol.hpp +37 -0
  150. casadi/include/casadi/core/runtime/casadi_swap.hpp +32 -0
  151. casadi/include/casadi/core/runtime/casadi_trans.hpp +35 -0
  152. casadi/include/casadi/core/runtime/casadi_tri_project.hpp +37 -0
  153. casadi/include/casadi/core/runtime/casadi_trilsolve.hpp +81 -0
  154. casadi/include/casadi/core/runtime/casadi_triusolve.hpp +81 -0
  155. casadi/include/casadi/core/runtime/casadi_vector_fmax.hpp +28 -0
  156. casadi/include/casadi/core/runtime/casadi_vector_fmin.hpp +28 -0
  157. casadi/include/casadi/core/runtime/casadi_vfmax.hpp +28 -0
  158. casadi/include/casadi/core/runtime/casadi_vfmin.hpp +28 -0
  159. casadi/include/casadi/core/runtime/shared.hpp +261 -0
  160. casadi/include/casadi/core/serializer.hpp +256 -0
  161. casadi/include/casadi/core/serializing_stream.hpp +329 -0
  162. casadi/include/casadi/core/shared_object.hpp +270 -0
  163. casadi/include/casadi/core/slice.hpp +149 -0
  164. casadi/include/casadi/core/sparsity.hpp +1486 -0
  165. casadi/include/casadi/core/sparsity_interface.hpp +745 -0
  166. casadi/include/casadi/core/submatrix.hpp +156 -0
  167. casadi/include/casadi/core/sx.hpp +203 -0
  168. casadi/include/casadi/core/sx_elem.hpp +351 -0
  169. casadi/include/casadi/core/sx_fwd.hpp +45 -0
  170. casadi/include/casadi/core/timing.hpp +98 -0
  171. casadi/include/casadi/core/xml_file.hpp +93 -0
  172. casadi/include/casadi/core/xml_node.hpp +207 -0
  173. casadi/include/casadi/doc.i +57768 -0
  174. casadi/include/casadi/doc_merged.i +35612 -0
  175. casadi/include/casadi/mem.h +310 -0
  176. casadi/include/casadi/valgrind-casadi.supp +511 -0
  177. casadi/include/casadi/valgrind-python.supp +1416 -0
  178. casadi/include/eigen3/Eigen/Cholesky +45 -0
  179. casadi/include/eigen3/Eigen/CholmodSupport +48 -0
  180. casadi/include/eigen3/Eigen/Core +384 -0
  181. casadi/include/eigen3/Eigen/Dense +7 -0
  182. casadi/include/eigen3/Eigen/Eigen +2 -0
  183. casadi/include/eigen3/Eigen/Eigenvalues +60 -0
  184. casadi/include/eigen3/Eigen/Geometry +59 -0
  185. casadi/include/eigen3/Eigen/Householder +29 -0
  186. casadi/include/eigen3/Eigen/IterativeLinearSolvers +48 -0
  187. casadi/include/eigen3/Eigen/Jacobi +32 -0
  188. casadi/include/eigen3/Eigen/KLUSupport +41 -0
  189. casadi/include/eigen3/Eigen/LU +47 -0
  190. casadi/include/eigen3/Eigen/MetisSupport +35 -0
  191. casadi/include/eigen3/Eigen/OrderingMethods +70 -0
  192. casadi/include/eigen3/Eigen/PaStiXSupport +49 -0
  193. casadi/include/eigen3/Eigen/PardisoSupport +35 -0
  194. casadi/include/eigen3/Eigen/QR +50 -0
  195. casadi/include/eigen3/Eigen/QtAlignedMalloc +39 -0
  196. casadi/include/eigen3/Eigen/SPQRSupport +34 -0
  197. casadi/include/eigen3/Eigen/SVD +50 -0
  198. casadi/include/eigen3/Eigen/Sparse +34 -0
  199. casadi/include/eigen3/Eigen/SparseCholesky +37 -0
  200. casadi/include/eigen3/Eigen/SparseCore +69 -0
  201. casadi/include/eigen3/Eigen/SparseLU +50 -0
  202. casadi/include/eigen3/Eigen/SparseQR +36 -0
  203. casadi/include/eigen3/Eigen/StdDeque +27 -0
  204. casadi/include/eigen3/Eigen/StdList +26 -0
  205. casadi/include/eigen3/Eigen/StdVector +27 -0
  206. casadi/include/eigen3/Eigen/SuperLUSupport +64 -0
  207. casadi/include/eigen3/Eigen/UmfPackSupport +40 -0
  208. casadi/include/eigen3/Eigen/src/Cholesky/LDLT.h +688 -0
  209. casadi/include/eigen3/Eigen/src/Cholesky/LLT.h +558 -0
  210. casadi/include/eigen3/Eigen/src/Cholesky/LLT_LAPACKE.h +99 -0
  211. casadi/include/eigen3/Eigen/src/CholmodSupport/CholmodSupport.h +682 -0
  212. casadi/include/eigen3/Eigen/src/Core/ArithmeticSequence.h +413 -0
  213. casadi/include/eigen3/Eigen/src/Core/Array.h +417 -0
  214. casadi/include/eigen3/Eigen/src/Core/ArrayBase.h +226 -0
  215. casadi/include/eigen3/Eigen/src/Core/ArrayWrapper.h +209 -0
  216. casadi/include/eigen3/Eigen/src/Core/Assign.h +90 -0
  217. casadi/include/eigen3/Eigen/src/Core/AssignEvaluator.h +1010 -0
  218. casadi/include/eigen3/Eigen/src/Core/Assign_MKL.h +178 -0
  219. casadi/include/eigen3/Eigen/src/Core/BandMatrix.h +353 -0
  220. casadi/include/eigen3/Eigen/src/Core/Block.h +448 -0
  221. casadi/include/eigen3/Eigen/src/Core/BooleanRedux.h +162 -0
  222. casadi/include/eigen3/Eigen/src/Core/CommaInitializer.h +164 -0
  223. casadi/include/eigen3/Eigen/src/Core/ConditionEstimator.h +175 -0
  224. casadi/include/eigen3/Eigen/src/Core/CoreEvaluators.h +1741 -0
  225. casadi/include/eigen3/Eigen/src/Core/CoreIterators.h +132 -0
  226. casadi/include/eigen3/Eigen/src/Core/CwiseBinaryOp.h +183 -0
  227. casadi/include/eigen3/Eigen/src/Core/CwiseNullaryOp.h +1001 -0
  228. casadi/include/eigen3/Eigen/src/Core/CwiseTernaryOp.h +197 -0
  229. casadi/include/eigen3/Eigen/src/Core/CwiseUnaryOp.h +103 -0
  230. casadi/include/eigen3/Eigen/src/Core/CwiseUnaryView.h +132 -0
  231. casadi/include/eigen3/Eigen/src/Core/DenseBase.h +701 -0
  232. casadi/include/eigen3/Eigen/src/Core/DenseCoeffsBase.h +685 -0
  233. casadi/include/eigen3/Eigen/src/Core/DenseStorage.h +652 -0
  234. casadi/include/eigen3/Eigen/src/Core/Diagonal.h +258 -0
  235. casadi/include/eigen3/Eigen/src/Core/DiagonalMatrix.h +391 -0
  236. casadi/include/eigen3/Eigen/src/Core/DiagonalProduct.h +28 -0
  237. casadi/include/eigen3/Eigen/src/Core/Dot.h +318 -0
  238. casadi/include/eigen3/Eigen/src/Core/EigenBase.h +160 -0
  239. casadi/include/eigen3/Eigen/src/Core/ForceAlignedAccess.h +150 -0
  240. casadi/include/eigen3/Eigen/src/Core/Fuzzy.h +155 -0
  241. casadi/include/eigen3/Eigen/src/Core/GeneralProduct.h +465 -0
  242. casadi/include/eigen3/Eigen/src/Core/GenericPacketMath.h +1040 -0
  243. casadi/include/eigen3/Eigen/src/Core/GlobalFunctions.h +194 -0
  244. casadi/include/eigen3/Eigen/src/Core/IO.h +258 -0
  245. casadi/include/eigen3/Eigen/src/Core/IndexedView.h +237 -0
  246. casadi/include/eigen3/Eigen/src/Core/Inverse.h +117 -0
  247. casadi/include/eigen3/Eigen/src/Core/Map.h +171 -0
  248. casadi/include/eigen3/Eigen/src/Core/MapBase.h +310 -0
  249. casadi/include/eigen3/Eigen/src/Core/MathFunctions.h +2057 -0
  250. casadi/include/eigen3/Eigen/src/Core/MathFunctionsImpl.h +200 -0
  251. casadi/include/eigen3/Eigen/src/Core/Matrix.h +565 -0
  252. casadi/include/eigen3/Eigen/src/Core/MatrixBase.h +547 -0
  253. casadi/include/eigen3/Eigen/src/Core/NestByValue.h +85 -0
  254. casadi/include/eigen3/Eigen/src/Core/NoAlias.h +109 -0
  255. casadi/include/eigen3/Eigen/src/Core/NumTraits.h +335 -0
  256. casadi/include/eigen3/Eigen/src/Core/PartialReduxEvaluator.h +232 -0
  257. casadi/include/eigen3/Eigen/src/Core/PermutationMatrix.h +605 -0
  258. casadi/include/eigen3/Eigen/src/Core/PlainObjectBase.h +1128 -0
  259. casadi/include/eigen3/Eigen/src/Core/Product.h +191 -0
  260. casadi/include/eigen3/Eigen/src/Core/ProductEvaluators.h +1179 -0
  261. casadi/include/eigen3/Eigen/src/Core/Random.h +218 -0
  262. casadi/include/eigen3/Eigen/src/Core/Redux.h +515 -0
  263. casadi/include/eigen3/Eigen/src/Core/Ref.h +381 -0
  264. casadi/include/eigen3/Eigen/src/Core/Replicate.h +142 -0
  265. casadi/include/eigen3/Eigen/src/Core/Reshaped.h +454 -0
  266. casadi/include/eigen3/Eigen/src/Core/ReturnByValue.h +119 -0
  267. casadi/include/eigen3/Eigen/src/Core/Reverse.h +217 -0
  268. casadi/include/eigen3/Eigen/src/Core/Select.h +164 -0
  269. casadi/include/eigen3/Eigen/src/Core/SelfAdjointView.h +365 -0
  270. casadi/include/eigen3/Eigen/src/Core/SelfCwiseBinaryOp.h +47 -0
  271. casadi/include/eigen3/Eigen/src/Core/Solve.h +188 -0
  272. casadi/include/eigen3/Eigen/src/Core/SolveTriangular.h +235 -0
  273. casadi/include/eigen3/Eigen/src/Core/SolverBase.h +168 -0
  274. casadi/include/eigen3/Eigen/src/Core/StableNorm.h +251 -0
  275. casadi/include/eigen3/Eigen/src/Core/StlIterators.h +463 -0
  276. casadi/include/eigen3/Eigen/src/Core/Stride.h +116 -0
  277. casadi/include/eigen3/Eigen/src/Core/Swap.h +68 -0
  278. casadi/include/eigen3/Eigen/src/Core/Transpose.h +464 -0
  279. casadi/include/eigen3/Eigen/src/Core/Transpositions.h +386 -0
  280. casadi/include/eigen3/Eigen/src/Core/TriangularMatrix.h +1001 -0
  281. casadi/include/eigen3/Eigen/src/Core/VectorBlock.h +96 -0
  282. casadi/include/eigen3/Eigen/src/Core/VectorwiseOp.h +784 -0
  283. casadi/include/eigen3/Eigen/src/Core/Visitor.h +381 -0
  284. casadi/include/eigen3/Eigen/src/Core/arch/AVX/Complex.h +372 -0
  285. casadi/include/eigen3/Eigen/src/Core/arch/AVX/MathFunctions.h +228 -0
  286. casadi/include/eigen3/Eigen/src/Core/arch/AVX/PacketMath.h +1574 -0
  287. casadi/include/eigen3/Eigen/src/Core/arch/AVX/TypeCasting.h +115 -0
  288. casadi/include/eigen3/Eigen/src/Core/arch/AVX512/Complex.h +422 -0
  289. casadi/include/eigen3/Eigen/src/Core/arch/AVX512/MathFunctions.h +362 -0
  290. casadi/include/eigen3/Eigen/src/Core/arch/AVX512/PacketMath.h +2303 -0
  291. casadi/include/eigen3/Eigen/src/Core/arch/AVX512/TypeCasting.h +89 -0
  292. casadi/include/eigen3/Eigen/src/Core/arch/AltiVec/Complex.h +417 -0
  293. casadi/include/eigen3/Eigen/src/Core/arch/AltiVec/MathFunctions.h +90 -0
  294. casadi/include/eigen3/Eigen/src/Core/arch/AltiVec/MatrixProduct.h +2937 -0
  295. casadi/include/eigen3/Eigen/src/Core/arch/AltiVec/MatrixProductCommon.h +221 -0
  296. casadi/include/eigen3/Eigen/src/Core/arch/AltiVec/MatrixProductMMA.h +629 -0
  297. casadi/include/eigen3/Eigen/src/Core/arch/AltiVec/PacketMath.h +2711 -0
  298. casadi/include/eigen3/Eigen/src/Core/arch/CUDA/Complex.h +258 -0
  299. casadi/include/eigen3/Eigen/src/Core/arch/Default/BFloat16.h +700 -0
  300. casadi/include/eigen3/Eigen/src/Core/arch/Default/ConjHelper.h +117 -0
  301. casadi/include/eigen3/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +1649 -0
  302. casadi/include/eigen3/Eigen/src/Core/arch/Default/GenericPacketMathFunctionsFwd.h +110 -0
  303. casadi/include/eigen3/Eigen/src/Core/arch/Default/Half.h +942 -0
  304. casadi/include/eigen3/Eigen/src/Core/arch/Default/Settings.h +49 -0
  305. casadi/include/eigen3/Eigen/src/Core/arch/Default/TypeCasting.h +120 -0
  306. casadi/include/eigen3/Eigen/src/Core/arch/GPU/MathFunctions.h +103 -0
  307. casadi/include/eigen3/Eigen/src/Core/arch/GPU/PacketMath.h +1685 -0
  308. casadi/include/eigen3/Eigen/src/Core/arch/GPU/TypeCasting.h +80 -0
  309. casadi/include/eigen3/Eigen/src/Core/arch/HIP/hcc/math_constants.h +23 -0
  310. casadi/include/eigen3/Eigen/src/Core/arch/MSA/Complex.h +648 -0
  311. casadi/include/eigen3/Eigen/src/Core/arch/MSA/MathFunctions.h +387 -0
  312. casadi/include/eigen3/Eigen/src/Core/arch/MSA/PacketMath.h +1233 -0
  313. casadi/include/eigen3/Eigen/src/Core/arch/NEON/Complex.h +584 -0
  314. casadi/include/eigen3/Eigen/src/Core/arch/NEON/GeneralBlockPanelKernel.h +183 -0
  315. casadi/include/eigen3/Eigen/src/Core/arch/NEON/MathFunctions.h +75 -0
  316. casadi/include/eigen3/Eigen/src/Core/arch/NEON/PacketMath.h +4587 -0
  317. casadi/include/eigen3/Eigen/src/Core/arch/NEON/TypeCasting.h +1419 -0
  318. casadi/include/eigen3/Eigen/src/Core/arch/SSE/Complex.h +351 -0
  319. casadi/include/eigen3/Eigen/src/Core/arch/SSE/MathFunctions.h +199 -0
  320. casadi/include/eigen3/Eigen/src/Core/arch/SSE/PacketMath.h +1505 -0
  321. casadi/include/eigen3/Eigen/src/Core/arch/SSE/TypeCasting.h +142 -0
  322. casadi/include/eigen3/Eigen/src/Core/arch/SVE/MathFunctions.h +44 -0
  323. casadi/include/eigen3/Eigen/src/Core/arch/SVE/PacketMath.h +752 -0
  324. casadi/include/eigen3/Eigen/src/Core/arch/SVE/TypeCasting.h +49 -0
  325. casadi/include/eigen3/Eigen/src/Core/arch/SYCL/InteropHeaders.h +232 -0
  326. casadi/include/eigen3/Eigen/src/Core/arch/SYCL/MathFunctions.h +301 -0
  327. casadi/include/eigen3/Eigen/src/Core/arch/SYCL/PacketMath.h +670 -0
  328. casadi/include/eigen3/Eigen/src/Core/arch/SYCL/SyclMemoryModel.h +694 -0
  329. casadi/include/eigen3/Eigen/src/Core/arch/SYCL/TypeCasting.h +85 -0
  330. casadi/include/eigen3/Eigen/src/Core/arch/ZVector/Complex.h +426 -0
  331. casadi/include/eigen3/Eigen/src/Core/arch/ZVector/MathFunctions.h +233 -0
  332. casadi/include/eigen3/Eigen/src/Core/arch/ZVector/PacketMath.h +1060 -0
  333. casadi/include/eigen3/Eigen/src/Core/functors/AssignmentFunctors.h +177 -0
  334. casadi/include/eigen3/Eigen/src/Core/functors/BinaryFunctors.h +541 -0
  335. casadi/include/eigen3/Eigen/src/Core/functors/NullaryFunctors.h +189 -0
  336. casadi/include/eigen3/Eigen/src/Core/functors/StlFunctors.h +166 -0
  337. casadi/include/eigen3/Eigen/src/Core/functors/TernaryFunctors.h +25 -0
  338. casadi/include/eigen3/Eigen/src/Core/functors/UnaryFunctors.h +1131 -0
  339. casadi/include/eigen3/Eigen/src/Core/products/GeneralBlockPanelKernel.h +2645 -0
  340. casadi/include/eigen3/Eigen/src/Core/products/GeneralMatrixMatrix.h +517 -0
  341. casadi/include/eigen3/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h +317 -0
  342. casadi/include/eigen3/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h +145 -0
  343. casadi/include/eigen3/Eigen/src/Core/products/GeneralMatrixMatrix_BLAS.h +124 -0
  344. casadi/include/eigen3/Eigen/src/Core/products/GeneralMatrixVector.h +518 -0
  345. casadi/include/eigen3/Eigen/src/Core/products/GeneralMatrixVector_BLAS.h +136 -0
  346. casadi/include/eigen3/Eigen/src/Core/products/Parallelizer.h +180 -0
  347. casadi/include/eigen3/Eigen/src/Core/products/SelfadjointMatrixMatrix.h +544 -0
  348. casadi/include/eigen3/Eigen/src/Core/products/SelfadjointMatrixMatrix_BLAS.h +295 -0
  349. casadi/include/eigen3/Eigen/src/Core/products/SelfadjointMatrixVector.h +262 -0
  350. casadi/include/eigen3/Eigen/src/Core/products/SelfadjointMatrixVector_BLAS.h +118 -0
  351. casadi/include/eigen3/Eigen/src/Core/products/SelfadjointProduct.h +133 -0
  352. casadi/include/eigen3/Eigen/src/Core/products/SelfadjointRank2Update.h +94 -0
  353. casadi/include/eigen3/Eigen/src/Core/products/TriangularMatrixMatrix.h +472 -0
  354. casadi/include/eigen3/Eigen/src/Core/products/TriangularMatrixMatrix_BLAS.h +317 -0
  355. casadi/include/eigen3/Eigen/src/Core/products/TriangularMatrixVector.h +350 -0
  356. casadi/include/eigen3/Eigen/src/Core/products/TriangularMatrixVector_BLAS.h +255 -0
  357. casadi/include/eigen3/Eigen/src/Core/products/TriangularSolverMatrix.h +337 -0
  358. casadi/include/eigen3/Eigen/src/Core/products/TriangularSolverMatrix_BLAS.h +167 -0
  359. casadi/include/eigen3/Eigen/src/Core/products/TriangularSolverVector.h +148 -0
  360. casadi/include/eigen3/Eigen/src/Core/util/BlasUtil.h +583 -0
  361. casadi/include/eigen3/Eigen/src/Core/util/ConfigureVectorization.h +512 -0
  362. casadi/include/eigen3/Eigen/src/Core/util/Constants.h +563 -0
  363. casadi/include/eigen3/Eigen/src/Core/util/DisableStupidWarnings.h +106 -0
  364. casadi/include/eigen3/Eigen/src/Core/util/ForwardDeclarations.h +322 -0
  365. casadi/include/eigen3/Eigen/src/Core/util/IndexedViewHelper.h +186 -0
  366. casadi/include/eigen3/Eigen/src/Core/util/IntegralConstant.h +272 -0
  367. casadi/include/eigen3/Eigen/src/Core/util/MKL_support.h +137 -0
  368. casadi/include/eigen3/Eigen/src/Core/util/Macros.h +1464 -0
  369. casadi/include/eigen3/Eigen/src/Core/util/Memory.h +1163 -0
  370. casadi/include/eigen3/Eigen/src/Core/util/Meta.h +812 -0
  371. casadi/include/eigen3/Eigen/src/Core/util/NonMPL2.h +3 -0
  372. casadi/include/eigen3/Eigen/src/Core/util/ReenableStupidWarnings.h +31 -0
  373. casadi/include/eigen3/Eigen/src/Core/util/ReshapedHelper.h +51 -0
  374. casadi/include/eigen3/Eigen/src/Core/util/StaticAssert.h +221 -0
  375. casadi/include/eigen3/Eigen/src/Core/util/SymbolicIndex.h +293 -0
  376. casadi/include/eigen3/Eigen/src/Core/util/XprHelper.h +856 -0
  377. casadi/include/eigen3/Eigen/src/Eigenvalues/ComplexEigenSolver.h +346 -0
  378. casadi/include/eigen3/Eigen/src/Eigenvalues/ComplexSchur.h +462 -0
  379. casadi/include/eigen3/Eigen/src/Eigenvalues/ComplexSchur_LAPACKE.h +91 -0
  380. casadi/include/eigen3/Eigen/src/Eigenvalues/EigenSolver.h +622 -0
  381. casadi/include/eigen3/Eigen/src/Eigenvalues/GeneralizedEigenSolver.h +418 -0
  382. casadi/include/eigen3/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h +226 -0
  383. casadi/include/eigen3/Eigen/src/Eigenvalues/HessenbergDecomposition.h +374 -0
  384. casadi/include/eigen3/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h +158 -0
  385. casadi/include/eigen3/Eigen/src/Eigenvalues/RealQZ.h +657 -0
  386. casadi/include/eigen3/Eigen/src/Eigenvalues/RealSchur.h +558 -0
  387. casadi/include/eigen3/Eigen/src/Eigenvalues/RealSchur_LAPACKE.h +77 -0
  388. casadi/include/eigen3/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h +904 -0
  389. casadi/include/eigen3/Eigen/src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.h +87 -0
  390. casadi/include/eigen3/Eigen/src/Eigenvalues/Tridiagonalization.h +561 -0
  391. casadi/include/eigen3/Eigen/src/Geometry/AlignedBox.h +486 -0
  392. casadi/include/eigen3/Eigen/src/Geometry/AngleAxis.h +247 -0
  393. casadi/include/eigen3/Eigen/src/Geometry/EulerAngles.h +114 -0
  394. casadi/include/eigen3/Eigen/src/Geometry/Homogeneous.h +501 -0
  395. casadi/include/eigen3/Eigen/src/Geometry/Hyperplane.h +282 -0
  396. casadi/include/eigen3/Eigen/src/Geometry/OrthoMethods.h +235 -0
  397. casadi/include/eigen3/Eigen/src/Geometry/ParametrizedLine.h +232 -0
  398. casadi/include/eigen3/Eigen/src/Geometry/Quaternion.h +870 -0
  399. casadi/include/eigen3/Eigen/src/Geometry/Rotation2D.h +199 -0
  400. casadi/include/eigen3/Eigen/src/Geometry/RotationBase.h +206 -0
  401. casadi/include/eigen3/Eigen/src/Geometry/Scaling.h +188 -0
  402. casadi/include/eigen3/Eigen/src/Geometry/Transform.h +1563 -0
  403. casadi/include/eigen3/Eigen/src/Geometry/Translation.h +202 -0
  404. casadi/include/eigen3/Eigen/src/Geometry/Umeyama.h +166 -0
  405. casadi/include/eigen3/Eigen/src/Geometry/arch/Geometry_SIMD.h +168 -0
  406. casadi/include/eigen3/Eigen/src/Householder/BlockHouseholder.h +110 -0
  407. casadi/include/eigen3/Eigen/src/Householder/Householder.h +176 -0
  408. casadi/include/eigen3/Eigen/src/Householder/HouseholderSequence.h +545 -0
  409. casadi/include/eigen3/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h +226 -0
  410. casadi/include/eigen3/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h +212 -0
  411. casadi/include/eigen3/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h +229 -0
  412. casadi/include/eigen3/Eigen/src/IterativeLinearSolvers/IncompleteCholesky.h +394 -0
  413. casadi/include/eigen3/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h +453 -0
  414. casadi/include/eigen3/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +444 -0
  415. casadi/include/eigen3/Eigen/src/IterativeLinearSolvers/LeastSquareConjugateGradient.h +198 -0
  416. casadi/include/eigen3/Eigen/src/IterativeLinearSolvers/SolveWithGuess.h +117 -0
  417. casadi/include/eigen3/Eigen/src/Jacobi/Jacobi.h +483 -0
  418. casadi/include/eigen3/Eigen/src/KLUSupport/KLUSupport.h +358 -0
  419. casadi/include/eigen3/Eigen/src/LU/Determinant.h +117 -0
  420. casadi/include/eigen3/Eigen/src/LU/FullPivLU.h +877 -0
  421. casadi/include/eigen3/Eigen/src/LU/InverseImpl.h +432 -0
  422. casadi/include/eigen3/Eigen/src/LU/PartialPivLU.h +624 -0
  423. casadi/include/eigen3/Eigen/src/LU/PartialPivLU_LAPACKE.h +83 -0
  424. casadi/include/eigen3/Eigen/src/LU/arch/InverseSize4.h +351 -0
  425. casadi/include/eigen3/Eigen/src/MetisSupport/MetisSupport.h +137 -0
  426. casadi/include/eigen3/Eigen/src/OrderingMethods/Amd.h +435 -0
  427. casadi/include/eigen3/Eigen/src/OrderingMethods/Eigen_Colamd.h +1863 -0
  428. casadi/include/eigen3/Eigen/src/OrderingMethods/Ordering.h +153 -0
  429. casadi/include/eigen3/Eigen/src/PaStiXSupport/PaStiXSupport.h +678 -0
  430. casadi/include/eigen3/Eigen/src/PardisoSupport/PardisoSupport.h +545 -0
  431. casadi/include/eigen3/Eigen/src/QR/ColPivHouseholderQR.h +674 -0
  432. casadi/include/eigen3/Eigen/src/QR/ColPivHouseholderQR_LAPACKE.h +97 -0
  433. casadi/include/eigen3/Eigen/src/QR/CompleteOrthogonalDecomposition.h +635 -0
  434. casadi/include/eigen3/Eigen/src/QR/FullPivHouseholderQR.h +713 -0
  435. casadi/include/eigen3/Eigen/src/QR/HouseholderQR.h +434 -0
  436. casadi/include/eigen3/Eigen/src/QR/HouseholderQR_LAPACKE.h +68 -0
  437. casadi/include/eigen3/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h +335 -0
  438. casadi/include/eigen3/Eigen/src/SVD/BDCSVD.h +1366 -0
  439. casadi/include/eigen3/Eigen/src/SVD/JacobiSVD.h +812 -0
  440. casadi/include/eigen3/Eigen/src/SVD/JacobiSVD_LAPACKE.h +91 -0
  441. casadi/include/eigen3/Eigen/src/SVD/SVDBase.h +376 -0
  442. casadi/include/eigen3/Eigen/src/SVD/UpperBidiagonalization.h +414 -0
  443. casadi/include/eigen3/Eigen/src/SparseCholesky/SimplicialCholesky.h +697 -0
  444. casadi/include/eigen3/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h +174 -0
  445. casadi/include/eigen3/Eigen/src/SparseCore/AmbiVector.h +378 -0
  446. casadi/include/eigen3/Eigen/src/SparseCore/CompressedStorage.h +274 -0
  447. casadi/include/eigen3/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h +352 -0
  448. casadi/include/eigen3/Eigen/src/SparseCore/MappedSparseMatrix.h +67 -0
  449. casadi/include/eigen3/Eigen/src/SparseCore/SparseAssign.h +270 -0
  450. casadi/include/eigen3/Eigen/src/SparseCore/SparseBlock.h +571 -0
  451. casadi/include/eigen3/Eigen/src/SparseCore/SparseColEtree.h +206 -0
  452. casadi/include/eigen3/Eigen/src/SparseCore/SparseCompressedBase.h +370 -0
  453. casadi/include/eigen3/Eigen/src/SparseCore/SparseCwiseBinaryOp.h +722 -0
  454. casadi/include/eigen3/Eigen/src/SparseCore/SparseCwiseUnaryOp.h +150 -0
  455. casadi/include/eigen3/Eigen/src/SparseCore/SparseDenseProduct.h +342 -0
  456. casadi/include/eigen3/Eigen/src/SparseCore/SparseDiagonalProduct.h +138 -0
  457. casadi/include/eigen3/Eigen/src/SparseCore/SparseDot.h +98 -0
  458. casadi/include/eigen3/Eigen/src/SparseCore/SparseFuzzy.h +29 -0
  459. casadi/include/eigen3/Eigen/src/SparseCore/SparseMap.h +305 -0
  460. casadi/include/eigen3/Eigen/src/SparseCore/SparseMatrix.h +1518 -0
  461. casadi/include/eigen3/Eigen/src/SparseCore/SparseMatrixBase.h +398 -0
  462. casadi/include/eigen3/Eigen/src/SparseCore/SparsePermutation.h +178 -0
  463. casadi/include/eigen3/Eigen/src/SparseCore/SparseProduct.h +181 -0
  464. casadi/include/eigen3/Eigen/src/SparseCore/SparseRedux.h +49 -0
  465. casadi/include/eigen3/Eigen/src/SparseCore/SparseRef.h +397 -0
  466. casadi/include/eigen3/Eigen/src/SparseCore/SparseSelfAdjointView.h +659 -0
  467. casadi/include/eigen3/Eigen/src/SparseCore/SparseSolverBase.h +124 -0
  468. casadi/include/eigen3/Eigen/src/SparseCore/SparseSparseProductWithPruning.h +198 -0
  469. casadi/include/eigen3/Eigen/src/SparseCore/SparseTranspose.h +92 -0
  470. casadi/include/eigen3/Eigen/src/SparseCore/SparseTriangularView.h +189 -0
  471. casadi/include/eigen3/Eigen/src/SparseCore/SparseUtil.h +186 -0
  472. casadi/include/eigen3/Eigen/src/SparseCore/SparseVector.h +478 -0
  473. casadi/include/eigen3/Eigen/src/SparseCore/SparseView.h +254 -0
  474. casadi/include/eigen3/Eigen/src/SparseCore/TriangularSolver.h +315 -0
  475. casadi/include/eigen3/Eigen/src/SparseLU/SparseLU.h +923 -0
  476. casadi/include/eigen3/Eigen/src/SparseLU/SparseLUImpl.h +66 -0
  477. casadi/include/eigen3/Eigen/src/SparseLU/SparseLU_Memory.h +226 -0
  478. casadi/include/eigen3/Eigen/src/SparseLU/SparseLU_Structs.h +110 -0
  479. casadi/include/eigen3/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h +375 -0
  480. casadi/include/eigen3/Eigen/src/SparseLU/SparseLU_Utils.h +80 -0
  481. casadi/include/eigen3/Eigen/src/SparseLU/SparseLU_column_bmod.h +181 -0
  482. casadi/include/eigen3/Eigen/src/SparseLU/SparseLU_column_dfs.h +179 -0
  483. casadi/include/eigen3/Eigen/src/SparseLU/SparseLU_copy_to_ucol.h +107 -0
  484. casadi/include/eigen3/Eigen/src/SparseLU/SparseLU_gemm_kernel.h +280 -0
  485. casadi/include/eigen3/Eigen/src/SparseLU/SparseLU_heap_relax_snode.h +126 -0
  486. casadi/include/eigen3/Eigen/src/SparseLU/SparseLU_kernel_bmod.h +130 -0
  487. casadi/include/eigen3/Eigen/src/SparseLU/SparseLU_panel_bmod.h +223 -0
  488. casadi/include/eigen3/Eigen/src/SparseLU/SparseLU_panel_dfs.h +258 -0
  489. casadi/include/eigen3/Eigen/src/SparseLU/SparseLU_pivotL.h +137 -0
  490. casadi/include/eigen3/Eigen/src/SparseLU/SparseLU_pruneL.h +136 -0
  491. casadi/include/eigen3/Eigen/src/SparseLU/SparseLU_relax_snode.h +83 -0
  492. casadi/include/eigen3/Eigen/src/SparseQR/SparseQR.h +758 -0
  493. casadi/include/eigen3/Eigen/src/StlSupport/StdDeque.h +116 -0
  494. casadi/include/eigen3/Eigen/src/StlSupport/StdList.h +106 -0
  495. casadi/include/eigen3/Eigen/src/StlSupport/StdVector.h +131 -0
  496. casadi/include/eigen3/Eigen/src/StlSupport/details.h +84 -0
  497. casadi/include/eigen3/Eigen/src/SuperLUSupport/SuperLUSupport.h +1025 -0
  498. casadi/include/eigen3/Eigen/src/UmfPackSupport/UmfPackSupport.h +642 -0
  499. casadi/include/eigen3/Eigen/src/misc/Image.h +82 -0
  500. casadi/include/eigen3/Eigen/src/misc/Kernel.h +79 -0
  501. casadi/include/eigen3/Eigen/src/misc/RealSvd2x2.h +55 -0
  502. casadi/include/eigen3/Eigen/src/misc/blas.h +440 -0
  503. casadi/include/eigen3/Eigen/src/misc/lapack.h +152 -0
  504. casadi/include/eigen3/Eigen/src/misc/lapacke.h +16292 -0
  505. casadi/include/eigen3/Eigen/src/misc/lapacke_mangling.h +17 -0
  506. casadi/include/eigen3/Eigen/src/plugins/ArrayCwiseBinaryOps.h +358 -0
  507. casadi/include/eigen3/Eigen/src/plugins/ArrayCwiseUnaryOps.h +696 -0
  508. casadi/include/eigen3/Eigen/src/plugins/BlockMethods.h +1442 -0
  509. casadi/include/eigen3/Eigen/src/plugins/CommonCwiseBinaryOps.h +115 -0
  510. casadi/include/eigen3/Eigen/src/plugins/CommonCwiseUnaryOps.h +177 -0
  511. casadi/include/eigen3/Eigen/src/plugins/IndexedViewMethods.h +262 -0
  512. casadi/include/eigen3/Eigen/src/plugins/MatrixCwiseBinaryOps.h +152 -0
  513. casadi/include/eigen3/Eigen/src/plugins/MatrixCwiseUnaryOps.h +95 -0
  514. casadi/include/eigen3/Eigen/src/plugins/ReshapedMethods.h +149 -0
  515. casadi/include/eigen3/signature_of_eigen3_matrix_library +1 -0
  516. casadi/include/eigen3/unsupported/Eigen/AdolcForward +159 -0
  517. casadi/include/eigen3/unsupported/Eigen/AlignedVector3 +234 -0
  518. casadi/include/eigen3/unsupported/Eigen/ArpackSupport +30 -0
  519. casadi/include/eigen3/unsupported/Eigen/AutoDiff +46 -0
  520. casadi/include/eigen3/unsupported/Eigen/BVH +95 -0
  521. casadi/include/eigen3/unsupported/Eigen/CXX11/Tensor +137 -0
  522. casadi/include/eigen3/unsupported/Eigen/CXX11/TensorSymmetry +42 -0
  523. casadi/include/eigen3/unsupported/Eigen/CXX11/ThreadPool +74 -0
  524. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/Tensor.h +554 -0
  525. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorArgMax.h +329 -0
  526. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorAssign.h +247 -0
  527. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorBase.h +1176 -0
  528. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorBlock.h +1559 -0
  529. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorBroadcasting.h +1093 -0
  530. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorChipping.h +518 -0
  531. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorConcatenation.h +377 -0
  532. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorContraction.h +1023 -0
  533. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorContractionBlocking.h +73 -0
  534. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorContractionCuda.h +6 -0
  535. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorContractionGpu.h +1413 -0
  536. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorContractionMapper.h +575 -0
  537. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorContractionSycl.h +1650 -0
  538. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorContractionThreadPool.h +1679 -0
  539. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorConversion.h +456 -0
  540. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorConvolution.h +1132 -0
  541. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorConvolutionSycl.h +544 -0
  542. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorCostModel.h +214 -0
  543. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorCustomOp.h +347 -0
  544. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDevice.h +137 -0
  545. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceCuda.h +6 -0
  546. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceDefault.h +104 -0
  547. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceGpu.h +389 -0
  548. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceSycl.h +1048 -0
  549. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h +409 -0
  550. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDimensionList.h +236 -0
  551. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h +490 -0
  552. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorEvalTo.h +236 -0
  553. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorEvaluator.h +983 -0
  554. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorExecutor.h +703 -0
  555. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorExpr.h +388 -0
  556. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorFFT.h +669 -0
  557. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorFixedSize.h +379 -0
  558. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorForcedEval.h +237 -0
  559. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorForwardDeclarations.h +191 -0
  560. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorFunctors.h +488 -0
  561. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorGenerator.h +302 -0
  562. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorGlobalFunctions.h +33 -0
  563. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorGpuHipCudaDefines.h +99 -0
  564. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorGpuHipCudaUndefines.h +44 -0
  565. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorIO.h +79 -0
  566. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorImagePatch.h +603 -0
  567. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorIndexList.h +738 -0
  568. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorInflation.h +247 -0
  569. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorInitializer.h +82 -0
  570. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorIntDiv.h +263 -0
  571. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorLayoutSwap.h +216 -0
  572. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorMacros.h +98 -0
  573. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorMap.h +327 -0
  574. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorMeta.h +311 -0
  575. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorMorphing.h +1102 -0
  576. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorPadding.h +708 -0
  577. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorPatch.h +291 -0
  578. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorRandom.h +322 -0
  579. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorReduction.h +998 -0
  580. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorReductionCuda.h +6 -0
  581. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorReductionGpu.h +966 -0
  582. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorReductionSycl.h +582 -0
  583. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorRef.h +454 -0
  584. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorReverse.h +465 -0
  585. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorScan.h +528 -0
  586. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorScanSycl.h +513 -0
  587. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorShuffling.h +471 -0
  588. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorStorage.h +161 -0
  589. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorStriding.h +346 -0
  590. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorTrace.h +303 -0
  591. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h +264 -0
  592. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorUInt128.h +249 -0
  593. casadi/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorVolumePatch.h +629 -0
  594. casadi/include/eigen3/unsupported/Eigen/CXX11/src/TensorSymmetry/DynamicSymmetry.h +293 -0
  595. casadi/include/eigen3/unsupported/Eigen/CXX11/src/TensorSymmetry/StaticSymmetry.h +236 -0
  596. casadi/include/eigen3/unsupported/Eigen/CXX11/src/TensorSymmetry/Symmetry.h +338 -0
  597. casadi/include/eigen3/unsupported/Eigen/CXX11/src/TensorSymmetry/util/TemplateGroupTheory.h +669 -0
  598. casadi/include/eigen3/unsupported/Eigen/CXX11/src/ThreadPool/Barrier.h +67 -0
  599. casadi/include/eigen3/unsupported/Eigen/CXX11/src/ThreadPool/EventCount.h +249 -0
  600. casadi/include/eigen3/unsupported/Eigen/CXX11/src/ThreadPool/NonBlockingThreadPool.h +486 -0
  601. casadi/include/eigen3/unsupported/Eigen/CXX11/src/ThreadPool/RunQueue.h +236 -0
  602. casadi/include/eigen3/unsupported/Eigen/CXX11/src/ThreadPool/ThreadCancel.h +23 -0
  603. casadi/include/eigen3/unsupported/Eigen/CXX11/src/ThreadPool/ThreadEnvironment.h +40 -0
  604. casadi/include/eigen3/unsupported/Eigen/CXX11/src/ThreadPool/ThreadLocal.h +301 -0
  605. casadi/include/eigen3/unsupported/Eigen/CXX11/src/ThreadPool/ThreadPoolInterface.h +48 -0
  606. casadi/include/eigen3/unsupported/Eigen/CXX11/src/ThreadPool/ThreadYield.h +20 -0
  607. casadi/include/eigen3/unsupported/Eigen/CXX11/src/util/CXX11Meta.h +537 -0
  608. casadi/include/eigen3/unsupported/Eigen/CXX11/src/util/CXX11Workarounds.h +88 -0
  609. casadi/include/eigen3/unsupported/Eigen/CXX11/src/util/EmulateArray.h +261 -0
  610. casadi/include/eigen3/unsupported/Eigen/CXX11/src/util/MaxSizeVector.h +158 -0
  611. casadi/include/eigen3/unsupported/Eigen/EulerAngles +43 -0
  612. casadi/include/eigen3/unsupported/Eigen/FFT +419 -0
  613. casadi/include/eigen3/unsupported/Eigen/IterativeSolvers +51 -0
  614. casadi/include/eigen3/unsupported/Eigen/KroneckerProduct +36 -0
  615. casadi/include/eigen3/unsupported/Eigen/LevenbergMarquardt +49 -0
  616. casadi/include/eigen3/unsupported/Eigen/MPRealSupport +213 -0
  617. casadi/include/eigen3/unsupported/Eigen/MatrixFunctions +504 -0
  618. casadi/include/eigen3/unsupported/Eigen/MoreVectorization +24 -0
  619. casadi/include/eigen3/unsupported/Eigen/NonLinearOptimization +140 -0
  620. casadi/include/eigen3/unsupported/Eigen/NumericalDiff +56 -0
  621. casadi/include/eigen3/unsupported/Eigen/OpenGLSupport +322 -0
  622. casadi/include/eigen3/unsupported/Eigen/Polynomials +137 -0
  623. casadi/include/eigen3/unsupported/Eigen/Skyline +39 -0
  624. casadi/include/eigen3/unsupported/Eigen/SparseExtra +54 -0
  625. casadi/include/eigen3/unsupported/Eigen/SpecialFunctions +103 -0
  626. casadi/include/eigen3/unsupported/Eigen/Splines +35 -0
  627. casadi/include/eigen3/unsupported/Eigen/src/AutoDiff/AutoDiffJacobian.h +108 -0
  628. casadi/include/eigen3/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h +730 -0
  629. casadi/include/eigen3/unsupported/Eigen/src/AutoDiff/AutoDiffVector.h +220 -0
  630. casadi/include/eigen3/unsupported/Eigen/src/BVH/BVAlgorithms.h +293 -0
  631. casadi/include/eigen3/unsupported/Eigen/src/BVH/KdBVH.h +223 -0
  632. casadi/include/eigen3/unsupported/Eigen/src/Eigenvalues/ArpackSelfAdjointEigenSolver.h +790 -0
  633. casadi/include/eigen3/unsupported/Eigen/src/EulerAngles/EulerAngles.h +355 -0
  634. casadi/include/eigen3/unsupported/Eigen/src/EulerAngles/EulerSystem.h +305 -0
  635. casadi/include/eigen3/unsupported/Eigen/src/FFT/ei_fftw_impl.h +261 -0
  636. casadi/include/eigen3/unsupported/Eigen/src/FFT/ei_kissfft_impl.h +449 -0
  637. casadi/include/eigen3/unsupported/Eigen/src/IterativeSolvers/ConstrainedConjGrad.h +187 -0
  638. casadi/include/eigen3/unsupported/Eigen/src/IterativeSolvers/DGMRES.h +511 -0
  639. casadi/include/eigen3/unsupported/Eigen/src/IterativeSolvers/GMRES.h +335 -0
  640. casadi/include/eigen3/unsupported/Eigen/src/IterativeSolvers/IDRS.h +436 -0
  641. casadi/include/eigen3/unsupported/Eigen/src/IterativeSolvers/IncompleteLU.h +90 -0
  642. casadi/include/eigen3/unsupported/Eigen/src/IterativeSolvers/IterationController.h +154 -0
  643. casadi/include/eigen3/unsupported/Eigen/src/IterativeSolvers/MINRES.h +267 -0
  644. casadi/include/eigen3/unsupported/Eigen/src/IterativeSolvers/Scaling.h +193 -0
  645. casadi/include/eigen3/unsupported/Eigen/src/KroneckerProduct/KroneckerTensorProduct.h +305 -0
  646. casadi/include/eigen3/unsupported/Eigen/src/LevenbergMarquardt/LMcovar.h +84 -0
  647. casadi/include/eigen3/unsupported/Eigen/src/LevenbergMarquardt/LMonestep.h +202 -0
  648. casadi/include/eigen3/unsupported/Eigen/src/LevenbergMarquardt/LMpar.h +160 -0
  649. casadi/include/eigen3/unsupported/Eigen/src/LevenbergMarquardt/LMqrsolv.h +188 -0
  650. casadi/include/eigen3/unsupported/Eigen/src/LevenbergMarquardt/LevenbergMarquardt.h +396 -0
  651. casadi/include/eigen3/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h +441 -0
  652. casadi/include/eigen3/unsupported/Eigen/src/MatrixFunctions/MatrixFunction.h +569 -0
  653. casadi/include/eigen3/unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h +373 -0
  654. casadi/include/eigen3/unsupported/Eigen/src/MatrixFunctions/MatrixPower.h +705 -0
  655. casadi/include/eigen3/unsupported/Eigen/src/MatrixFunctions/MatrixSquareRoot.h +368 -0
  656. casadi/include/eigen3/unsupported/Eigen/src/MatrixFunctions/StemFunction.h +117 -0
  657. casadi/include/eigen3/unsupported/Eigen/src/MoreVectorization/MathFunctions.h +95 -0
  658. casadi/include/eigen3/unsupported/Eigen/src/NonLinearOptimization/HybridNonLinearSolver.h +601 -0
  659. casadi/include/eigen3/unsupported/Eigen/src/NonLinearOptimization/LevenbergMarquardt.h +657 -0
  660. casadi/include/eigen3/unsupported/Eigen/src/NonLinearOptimization/chkder.h +66 -0
  661. casadi/include/eigen3/unsupported/Eigen/src/NonLinearOptimization/covar.h +70 -0
  662. casadi/include/eigen3/unsupported/Eigen/src/NonLinearOptimization/dogleg.h +107 -0
  663. casadi/include/eigen3/unsupported/Eigen/src/NonLinearOptimization/fdjac1.h +79 -0
  664. casadi/include/eigen3/unsupported/Eigen/src/NonLinearOptimization/lmpar.h +298 -0
  665. casadi/include/eigen3/unsupported/Eigen/src/NonLinearOptimization/qrsolv.h +91 -0
  666. casadi/include/eigen3/unsupported/Eigen/src/NonLinearOptimization/r1mpyq.h +30 -0
  667. casadi/include/eigen3/unsupported/Eigen/src/NonLinearOptimization/r1updt.h +99 -0
  668. casadi/include/eigen3/unsupported/Eigen/src/NonLinearOptimization/rwupdt.h +49 -0
  669. casadi/include/eigen3/unsupported/Eigen/src/NumericalDiff/NumericalDiff.h +130 -0
  670. casadi/include/eigen3/unsupported/Eigen/src/Polynomials/Companion.h +280 -0
  671. casadi/include/eigen3/unsupported/Eigen/src/Polynomials/PolynomialSolver.h +428 -0
  672. casadi/include/eigen3/unsupported/Eigen/src/Polynomials/PolynomialUtils.h +143 -0
  673. casadi/include/eigen3/unsupported/Eigen/src/Skyline/SkylineInplaceLU.h +352 -0
  674. casadi/include/eigen3/unsupported/Eigen/src/Skyline/SkylineMatrix.h +862 -0
  675. casadi/include/eigen3/unsupported/Eigen/src/Skyline/SkylineMatrixBase.h +212 -0
  676. casadi/include/eigen3/unsupported/Eigen/src/Skyline/SkylineProduct.h +295 -0
  677. casadi/include/eigen3/unsupported/Eigen/src/Skyline/SkylineStorage.h +259 -0
  678. casadi/include/eigen3/unsupported/Eigen/src/Skyline/SkylineUtil.h +89 -0
  679. casadi/include/eigen3/unsupported/Eigen/src/SparseExtra/BlockOfDynamicSparseMatrix.h +122 -0
  680. casadi/include/eigen3/unsupported/Eigen/src/SparseExtra/BlockSparseMatrix.h +1079 -0
  681. casadi/include/eigen3/unsupported/Eigen/src/SparseExtra/DynamicSparseMatrix.h +404 -0
  682. casadi/include/eigen3/unsupported/Eigen/src/SparseExtra/MarketIO.h +282 -0
  683. casadi/include/eigen3/unsupported/Eigen/src/SparseExtra/MatrixMarketIterator.h +247 -0
  684. casadi/include/eigen3/unsupported/Eigen/src/SparseExtra/RandomSetter.h +349 -0
  685. casadi/include/eigen3/unsupported/Eigen/src/SpecialFunctions/BesselFunctionsArrayAPI.h +286 -0
  686. casadi/include/eigen3/unsupported/Eigen/src/SpecialFunctions/BesselFunctionsBFloat16.h +68 -0
  687. casadi/include/eigen3/unsupported/Eigen/src/SpecialFunctions/BesselFunctionsFunctors.h +357 -0
  688. casadi/include/eigen3/unsupported/Eigen/src/SpecialFunctions/BesselFunctionsHalf.h +66 -0
  689. casadi/include/eigen3/unsupported/Eigen/src/SpecialFunctions/BesselFunctionsImpl.h +1959 -0
  690. casadi/include/eigen3/unsupported/Eigen/src/SpecialFunctions/BesselFunctionsPacketMath.h +118 -0
  691. casadi/include/eigen3/unsupported/Eigen/src/SpecialFunctions/HipVectorCompatibility.h +67 -0
  692. casadi/include/eigen3/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsArrayAPI.h +167 -0
  693. casadi/include/eigen3/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsBFloat16.h +58 -0
  694. casadi/include/eigen3/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsFunctors.h +330 -0
  695. casadi/include/eigen3/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsHalf.h +58 -0
  696. casadi/include/eigen3/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsImpl.h +2045 -0
  697. casadi/include/eigen3/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsPacketMath.h +79 -0
  698. casadi/include/eigen3/unsupported/Eigen/src/SpecialFunctions/arch/AVX/BesselFunctions.h +46 -0
  699. casadi/include/eigen3/unsupported/Eigen/src/SpecialFunctions/arch/AVX/SpecialFunctions.h +16 -0
  700. casadi/include/eigen3/unsupported/Eigen/src/SpecialFunctions/arch/AVX512/BesselFunctions.h +46 -0
  701. casadi/include/eigen3/unsupported/Eigen/src/SpecialFunctions/arch/AVX512/SpecialFunctions.h +16 -0
  702. casadi/include/eigen3/unsupported/Eigen/src/SpecialFunctions/arch/GPU/SpecialFunctions.h +369 -0
  703. casadi/include/eigen3/unsupported/Eigen/src/SpecialFunctions/arch/NEON/BesselFunctions.h +54 -0
  704. casadi/include/eigen3/unsupported/Eigen/src/SpecialFunctions/arch/NEON/SpecialFunctions.h +34 -0
  705. casadi/include/eigen3/unsupported/Eigen/src/Splines/Spline.h +507 -0
  706. casadi/include/eigen3/unsupported/Eigen/src/Splines/SplineFitting.h +431 -0
  707. casadi/include/eigen3/unsupported/Eigen/src/Splines/SplineFwd.h +93 -0
  708. casadi/include/highs/HConfig.h +20 -0
  709. casadi/include/highs/Highs.h +1459 -0
  710. casadi/include/highs/filereaderlp/builder.hpp +25 -0
  711. casadi/include/highs/filereaderlp/model.hpp +68 -0
  712. casadi/include/highs/filereaderlp/reader.hpp +10 -0
  713. casadi/include/highs/fortran/highs_fortran_api.mod +0 -0
  714. casadi/include/highs/interfaces/highs_c_api.h +2107 -0
  715. casadi/include/highs/io/Filereader.h +47 -0
  716. casadi/include/highs/io/FilereaderEms.h +33 -0
  717. casadi/include/highs/io/FilereaderLp.h +54 -0
  718. casadi/include/highs/io/FilereaderMps.h +30 -0
  719. casadi/include/highs/io/HMPSIO.h +81 -0
  720. casadi/include/highs/io/HMpsFF.h +233 -0
  721. casadi/include/highs/io/HighsIO.h +99 -0
  722. casadi/include/highs/io/LoadOptions.h +27 -0
  723. casadi/include/highs/ipm/IpxWrapper.h +73 -0
  724. casadi/include/highs/lp_data/HConst.h +295 -0
  725. casadi/include/highs/lp_data/HStruct.h +124 -0
  726. casadi/include/highs/lp_data/HighsAnalysis.h +26 -0
  727. casadi/include/highs/lp_data/HighsCallback.h +33 -0
  728. casadi/include/highs/lp_data/HighsCallbackStruct.h +36 -0
  729. casadi/include/highs/lp_data/HighsDebug.h +37 -0
  730. casadi/include/highs/lp_data/HighsInfo.h +304 -0
  731. casadi/include/highs/lp_data/HighsInfoDebug.h +30 -0
  732. casadi/include/highs/lp_data/HighsLp.h +85 -0
  733. casadi/include/highs/lp_data/HighsLpSolverObject.h +48 -0
  734. casadi/include/highs/lp_data/HighsLpUtils.h +266 -0
  735. casadi/include/highs/lp_data/HighsModelUtils.h +109 -0
  736. casadi/include/highs/lp_data/HighsOptions.h +1130 -0
  737. casadi/include/highs/lp_data/HighsRanging.h +46 -0
  738. casadi/include/highs/lp_data/HighsRuntimeOptions.h +276 -0
  739. casadi/include/highs/lp_data/HighsSolution.h +137 -0
  740. casadi/include/highs/lp_data/HighsSolutionDebug.h +90 -0
  741. casadi/include/highs/lp_data/HighsSolve.h +24 -0
  742. casadi/include/highs/lp_data/HighsStatus.h +32 -0
  743. casadi/include/highs/mip/HighsCliqueTable.h +318 -0
  744. casadi/include/highs/mip/HighsConflictPool.h +112 -0
  745. casadi/include/highs/mip/HighsCutGeneration.h +96 -0
  746. casadi/include/highs/mip/HighsCutPool.h +171 -0
  747. casadi/include/highs/mip/HighsDebugSol.h +142 -0
  748. casadi/include/highs/mip/HighsDomain.h +633 -0
  749. casadi/include/highs/mip/HighsDomainChange.h +51 -0
  750. casadi/include/highs/mip/HighsDynamicRowMatrix.h +105 -0
  751. casadi/include/highs/mip/HighsGFkSolve.h +441 -0
  752. casadi/include/highs/mip/HighsImplications.h +146 -0
  753. casadi/include/highs/mip/HighsLpAggregator.h +53 -0
  754. casadi/include/highs/mip/HighsLpRelaxation.h +355 -0
  755. casadi/include/highs/mip/HighsMipSolver.h +103 -0
  756. casadi/include/highs/mip/HighsMipSolverData.h +193 -0
  757. casadi/include/highs/mip/HighsModkSeparator.h +63 -0
  758. casadi/include/highs/mip/HighsNodeQueue.h +312 -0
  759. casadi/include/highs/mip/HighsObjectiveFunction.h +74 -0
  760. casadi/include/highs/mip/HighsPathSeparator.h +42 -0
  761. casadi/include/highs/mip/HighsPrimalHeuristics.h +68 -0
  762. casadi/include/highs/mip/HighsPseudocost.h +351 -0
  763. casadi/include/highs/mip/HighsRedcostFixing.h +45 -0
  764. casadi/include/highs/mip/HighsSearch.h +243 -0
  765. casadi/include/highs/mip/HighsSeparation.h +44 -0
  766. casadi/include/highs/mip/HighsSeparator.h +56 -0
  767. casadi/include/highs/mip/HighsTableauSeparator.h +37 -0
  768. casadi/include/highs/mip/HighsTransformedLp.h +66 -0
  769. casadi/include/highs/model/HighsHessian.h +49 -0
  770. casadi/include/highs/model/HighsHessianUtils.h +47 -0
  771. casadi/include/highs/model/HighsModel.h +43 -0
  772. casadi/include/highs/parallel/HighsBinarySemaphore.h +113 -0
  773. casadi/include/highs/parallel/HighsCacheAlign.h +87 -0
  774. casadi/include/highs/parallel/HighsCombinable.h +121 -0
  775. casadi/include/highs/parallel/HighsMutex.h +128 -0
  776. casadi/include/highs/parallel/HighsParallel.h +128 -0
  777. casadi/include/highs/parallel/HighsRaceTimer.h +43 -0
  778. casadi/include/highs/parallel/HighsSchedulerConstants.h +24 -0
  779. casadi/include/highs/parallel/HighsSpinMutex.h +53 -0
  780. casadi/include/highs/parallel/HighsSplitDeque.h +583 -0
  781. casadi/include/highs/parallel/HighsTask.h +176 -0
  782. casadi/include/highs/parallel/HighsTaskExecutor.h +209 -0
  783. casadi/include/highs/presolve/HPresolve.h +352 -0
  784. casadi/include/highs/presolve/HPresolveAnalysis.h +54 -0
  785. casadi/include/highs/presolve/HighsPostsolveStack.h +883 -0
  786. casadi/include/highs/presolve/HighsSymmetry.h +283 -0
  787. casadi/include/highs/presolve/ICrash.h +121 -0
  788. casadi/include/highs/presolve/ICrashUtil.h +65 -0
  789. casadi/include/highs/presolve/ICrashX.h +26 -0
  790. casadi/include/highs/presolve/PresolveComponent.h +93 -0
  791. casadi/include/highs/qpsolver/a_asm.hpp +56 -0
  792. casadi/include/highs/qpsolver/a_quass.hpp +12 -0
  793. casadi/include/highs/qpsolver/perturbation.hpp +8 -0
  794. casadi/include/highs/qpsolver/quass.hpp +20 -0
  795. casadi/include/highs/qpsolver/scaling.hpp +8 -0
  796. casadi/include/highs/qpsolver/vector.hpp +235 -0
  797. casadi/include/highs/simplex/HApp.h +422 -0
  798. casadi/include/highs/simplex/HEkk.h +369 -0
  799. casadi/include/highs/simplex/HEkkDual.h +515 -0
  800. casadi/include/highs/simplex/HEkkDualRHS.h +138 -0
  801. casadi/include/highs/simplex/HEkkDualRow.h +204 -0
  802. casadi/include/highs/simplex/HEkkPrimal.h +190 -0
  803. casadi/include/highs/simplex/HSimplex.h +47 -0
  804. casadi/include/highs/simplex/HSimplexDebug.h +51 -0
  805. casadi/include/highs/simplex/HSimplexNla.h +184 -0
  806. casadi/include/highs/simplex/HSimplexReport.h +24 -0
  807. casadi/include/highs/simplex/HighsSimplexAnalysis.h +375 -0
  808. casadi/include/highs/simplex/SimplexConst.h +274 -0
  809. casadi/include/highs/simplex/SimplexStruct.h +264 -0
  810. casadi/include/highs/simplex/SimplexTimer.h +427 -0
  811. casadi/include/highs/test/DevKkt.h +146 -0
  812. casadi/include/highs/test/KktCh2.h +82 -0
  813. casadi/include/highs/util/FactorTimer.h +224 -0
  814. casadi/include/highs/util/HFactor.h +558 -0
  815. casadi/include/highs/util/HFactorConst.h +84 -0
  816. casadi/include/highs/util/HFactorDebug.h +58 -0
  817. casadi/include/highs/util/HSet.h +92 -0
  818. casadi/include/highs/util/HVector.h +25 -0
  819. casadi/include/highs/util/HVectorBase.h +105 -0
  820. casadi/include/highs/util/HighsCDouble.h +310 -0
  821. casadi/include/highs/util/HighsComponent.h +56 -0
  822. casadi/include/highs/util/HighsDataStack.h +86 -0
  823. casadi/include/highs/util/HighsDisjointSets.h +110 -0
  824. casadi/include/highs/util/HighsHash.h +1270 -0
  825. casadi/include/highs/util/HighsHashTree.h +1443 -0
  826. casadi/include/highs/util/HighsInt.h +39 -0
  827. casadi/include/highs/util/HighsIntegers.h +216 -0
  828. casadi/include/highs/util/HighsLinearSumBounds.h +160 -0
  829. casadi/include/highs/util/HighsMatrixPic.h +40 -0
  830. casadi/include/highs/util/HighsMatrixSlice.h +561 -0
  831. casadi/include/highs/util/HighsMatrixUtils.h +57 -0
  832. casadi/include/highs/util/HighsRandom.h +233 -0
  833. casadi/include/highs/util/HighsRbTree.h +455 -0
  834. casadi/include/highs/util/HighsSort.h +134 -0
  835. casadi/include/highs/util/HighsSparseMatrix.h +144 -0
  836. casadi/include/highs/util/HighsSparseVectorSum.h +98 -0
  837. casadi/include/highs/util/HighsSplay.h +138 -0
  838. casadi/include/highs/util/HighsTimer.h +334 -0
  839. casadi/include/highs/util/HighsUtils.h +203 -0
  840. casadi/include/highs/util/stringutil.h +39 -0
  841. casadi/include/licenses/FMI-Standard-2.0.2/LICENSE.txt +473 -0
  842. casadi/include/licenses/FMI-Standard-3.0/LICENSE.txt +464 -0
  843. casadi/include/licenses/alpaqa-external/LICENSE +165 -0
  844. casadi/include/licenses/bonmin-external/Bonmin/LICENSE +87 -0
  845. casadi/include/licenses/bonmin-external/LICENSE +3 -0
  846. casadi/include/licenses/casadi/LICENSE/LICENSE.txt +165 -0
  847. casadi/include/licenses/casadi-sundials/LICENSE +64 -0
  848. casadi/include/licenses/casadi-sundials/cvodes/LICENSE +60 -0
  849. casadi/include/licenses/casadi-sundials/idas/LICENSE +59 -0
  850. casadi/include/licenses/casadi-sundials/kinsol/LICENSE +59 -0
  851. casadi/include/licenses/casadi-sundials/sundials/LICENSE +67 -0
  852. casadi/include/licenses/cbc-external/Cbc/LICENSE +239 -0
  853. casadi/include/licenses/cbc-external/LICENSE +245 -0
  854. casadi/include/licenses/cgl-external/Cgl/LICENSE +239 -0
  855. casadi/include/licenses/cgl-external/LICENSE +245 -0
  856. casadi/include/licenses/clp-external/Clp/LICENSE +239 -0
  857. casadi/include/licenses/clp-external/LICENSE +245 -0
  858. casadi/include/licenses/coinutils-external/CoinUtils/LICENSE +239 -0
  859. casadi/include/licenses/coinutils-external/LICENSE +245 -0
  860. casadi/include/licenses/highs-external/LICENSE +21 -0
  861. casadi/include/licenses/highs-external/extern/filereaderlp/LICENSE +19 -0
  862. casadi/include/licenses/ipopt-external/LICENSE +260 -0
  863. casadi/include/licenses/metis-external/LICENSE +87 -0
  864. casadi/include/licenses/metis-external/metis-4.0/LICENSE +18 -0
  865. casadi/include/licenses/mockups-external/LICENSE +21 -0
  866. casadi/include/licenses/mumps-external/LICENSE +87 -0
  867. casadi/include/licenses/mumps-external/MUMPS/LICENSE +50 -0
  868. casadi/include/licenses/openblas-external/LICENSE +29 -0
  869. casadi/include/licenses/openblas-external/ctest/LICENSE +23 -0
  870. casadi/include/licenses/openblas-external/lapack-netlib/LAPACKE/LICENSE +26 -0
  871. casadi/include/licenses/openblas-external/lapack-netlib/LICENSE +48 -0
  872. casadi/include/licenses/openblas-external/reference/LICENSE +23 -0
  873. casadi/include/licenses/openblas-external/relapack/LICENSE +22 -0
  874. casadi/include/licenses/openblas-external/test/LICENSE +23 -0
  875. casadi/include/licenses/osi-external/LICENSE +245 -0
  876. casadi/include/licenses/osi-external/Osi/LICENSE +239 -0
  877. casadi/include/licenses/osqp-external/LICENSE +201 -0
  878. casadi/include/licenses/osqp-external/lin_sys/direct/qdldl/amd/LICENSE +36 -0
  879. casadi/include/licenses/osqp-external/lin_sys/direct/qdldl/qdldl_sources/LICENSE +201 -0
  880. casadi/include/licenses/proxqp-external/LICENSE +25 -0
  881. casadi/include/licenses/proxqp-external/bindings/python/external/pybind11/LICENSE +29 -0
  882. casadi/include/licenses/proxqp-external/cmake-module/LICENSE +4 -0
  883. casadi/include/licenses/proxqp-external/cmake-module/doxygen/MathJax/LICENSE +202 -0
  884. casadi/include/licenses/proxqp-external/external/cereal/LICENSE +24 -0
  885. casadi/include/licenses/proxqp-external/external/cereal/include/cereal/external/LICENSE +21 -0
  886. casadi/include/licenses/proxqp-external/external/cereal/include/cereal/external/rapidjson/LICENSE +13 -0
  887. casadi/include/licenses/proxqp-external/external/cereal/include/cereal/external/rapidjson/msinttypes/LICENSE +29 -0
  888. casadi/include/licenses/qpOASES/LICENSE.txt +503 -0
  889. casadi/include/licenses/sleqp-external/LICENSE +165 -0
  890. casadi/include/licenses/superscs-external/LICENSE.txt +24 -0
  891. casadi/include/licenses/tinyxml2-9.0.0/LICENSE.txt +18 -0
  892. casadi/include/licenses/trlib-external/LICENSE +21 -0
  893. casadi/include/osqp/auxil.h +181 -0
  894. casadi/include/osqp/constants.h +129 -0
  895. casadi/include/osqp/cs.h +180 -0
  896. casadi/include/osqp/ctrlc.h +56 -0
  897. casadi/include/osqp/error.h +38 -0
  898. casadi/include/osqp/glob_opts.h +167 -0
  899. casadi/include/osqp/lin_alg.h +216 -0
  900. casadi/include/osqp/lin_sys.h +54 -0
  901. casadi/include/osqp/osqp.h +430 -0
  902. casadi/include/osqp/osqp_configure.h +49 -0
  903. casadi/include/osqp/polish.h +25 -0
  904. casadi/include/osqp/proj.h +37 -0
  905. casadi/include/osqp/scaling.h +44 -0
  906. casadi/include/osqp/types.h +326 -0
  907. casadi/include/osqp/util.h +222 -0
  908. casadi/include/proxsuite/config.hpp +68 -0
  909. casadi/include/proxsuite/deprecated.hpp +56 -0
  910. casadi/include/proxsuite/fwd.hpp +52 -0
  911. casadi/include/proxsuite/helpers/common.hpp +70 -0
  912. casadi/include/proxsuite/helpers/instruction-set.hpp +275 -0
  913. casadi/include/proxsuite/helpers/optional.hpp +46 -0
  914. casadi/include/proxsuite/helpers/tl-optional.hpp +2472 -0
  915. casadi/include/proxsuite/helpers/version.hpp +39 -0
  916. casadi/include/proxsuite/linalg/dense/core.hpp +863 -0
  917. casadi/include/proxsuite/linalg/dense/factorize.hpp +375 -0
  918. casadi/include/proxsuite/linalg/dense/ldlt.hpp +817 -0
  919. casadi/include/proxsuite/linalg/dense/modify.hpp +333 -0
  920. casadi/include/proxsuite/linalg/dense/solve.hpp +38 -0
  921. casadi/include/proxsuite/linalg/dense/update.hpp +330 -0
  922. casadi/include/proxsuite/linalg/sparse/core.hpp +531 -0
  923. casadi/include/proxsuite/linalg/sparse/factorize.hpp +1303 -0
  924. casadi/include/proxsuite/linalg/sparse/rowmod.hpp +443 -0
  925. casadi/include/proxsuite/linalg/sparse/update.hpp +348 -0
  926. casadi/include/proxsuite/linalg/veg/internal/assert_impl.hpp +20 -0
  927. casadi/include/proxsuite/linalg/veg/internal/collection_algo.hpp +93 -0
  928. casadi/include/proxsuite/linalg/veg/internal/dbg.hpp +15 -0
  929. casadi/include/proxsuite/linalg/veg/internal/delete_special_members.hpp +77 -0
  930. casadi/include/proxsuite/linalg/veg/internal/dyn_index.hpp +292 -0
  931. casadi/include/proxsuite/linalg/veg/internal/epilogue.hpp +31 -0
  932. casadi/include/proxsuite/linalg/veg/internal/external/hedley.ext.hpp +2074 -0
  933. casadi/include/proxsuite/linalg/veg/internal/external/unhedley.ext.hpp +148 -0
  934. casadi/include/proxsuite/linalg/veg/internal/fix_index.hpp +339 -0
  935. casadi/include/proxsuite/linalg/veg/internal/has_asan.hpp +17 -0
  936. casadi/include/proxsuite/linalg/veg/internal/integer_seq.hpp +248 -0
  937. casadi/include/proxsuite/linalg/veg/internal/macros.hpp +1312 -0
  938. casadi/include/proxsuite/linalg/veg/internal/narrow.hpp +46 -0
  939. casadi/include/proxsuite/linalg/veg/internal/preprocessor.hpp +434 -0
  940. casadi/include/proxsuite/linalg/veg/internal/prologue.hpp +157 -0
  941. casadi/include/proxsuite/linalg/veg/internal/std.hpp +13 -0
  942. casadi/include/proxsuite/linalg/veg/internal/terminate.hpp +22 -0
  943. casadi/include/proxsuite/linalg/veg/internal/typedefs.hpp +58 -0
  944. casadi/include/proxsuite/linalg/veg/memory/address.hpp +97 -0
  945. casadi/include/proxsuite/linalg/veg/memory/alloc.hpp +352 -0
  946. casadi/include/proxsuite/linalg/veg/memory/dynamic_stack.hpp +504 -0
  947. casadi/include/proxsuite/linalg/veg/memory/placement.hpp +202 -0
  948. casadi/include/proxsuite/linalg/veg/memory/stack_alloc.hpp +239 -0
  949. casadi/include/proxsuite/linalg/veg/ref.hpp +148 -0
  950. casadi/include/proxsuite/linalg/veg/slice.hpp +240 -0
  951. casadi/include/proxsuite/linalg/veg/tuple.hpp +876 -0
  952. casadi/include/proxsuite/linalg/veg/type_traits/alloc.hpp +169 -0
  953. casadi/include/proxsuite/linalg/veg/type_traits/assignable.hpp +53 -0
  954. casadi/include/proxsuite/linalg/veg/type_traits/constructible.hpp +217 -0
  955. casadi/include/proxsuite/linalg/veg/type_traits/core.hpp +298 -0
  956. casadi/include/proxsuite/linalg/veg/type_traits/invocable.hpp +47 -0
  957. casadi/include/proxsuite/linalg/veg/type_traits/primitives.hpp +43 -0
  958. casadi/include/proxsuite/linalg/veg/type_traits/tags.hpp +47 -0
  959. casadi/include/proxsuite/linalg/veg/util/assert.hpp +48 -0
  960. casadi/include/proxsuite/linalg/veg/util/dbg.hpp +6 -0
  961. casadi/include/proxsuite/linalg/veg/util/defer.hpp +57 -0
  962. casadi/include/proxsuite/linalg/veg/util/dynstack_alloc.hpp +19 -0
  963. casadi/include/proxsuite/linalg/veg/util/get.hpp +153 -0
  964. casadi/include/proxsuite/linalg/veg/util/index.hpp +6 -0
  965. casadi/include/proxsuite/linalg/veg/util/unreachable.hpp +41 -0
  966. casadi/include/proxsuite/linalg/veg/vec.hpp +1034 -0
  967. casadi/include/proxsuite/proxqp/dense/dense.hpp +10 -0
  968. casadi/include/proxsuite/proxqp/dense/fwd.hpp +55 -0
  969. casadi/include/proxsuite/proxqp/dense/helpers.hpp +520 -0
  970. casadi/include/proxsuite/proxqp/dense/linesearch.hpp +517 -0
  971. casadi/include/proxsuite/proxqp/dense/model.hpp +147 -0
  972. casadi/include/proxsuite/proxqp/dense/preconditioner/identity.hpp +113 -0
  973. casadi/include/proxsuite/proxqp/dense/preconditioner/ruiz.hpp +571 -0
  974. casadi/include/proxsuite/proxqp/dense/solver.hpp +1330 -0
  975. casadi/include/proxsuite/proxqp/dense/utils.hpp +415 -0
  976. casadi/include/proxsuite/proxqp/dense/views.hpp +1466 -0
  977. casadi/include/proxsuite/proxqp/dense/workspace.hpp +264 -0
  978. casadi/include/proxsuite/proxqp/dense/wrapper.hpp +491 -0
  979. casadi/include/proxsuite/proxqp/results.hpp +212 -0
  980. casadi/include/proxsuite/proxqp/settings.hpp +302 -0
  981. casadi/include/proxsuite/proxqp/sparse/fwd.hpp +58 -0
  982. casadi/include/proxsuite/proxqp/sparse/helpers.hpp +309 -0
  983. casadi/include/proxsuite/proxqp/sparse/model.hpp +228 -0
  984. casadi/include/proxsuite/proxqp/sparse/preconditioner/identity.hpp +64 -0
  985. casadi/include/proxsuite/proxqp/sparse/preconditioner/ruiz.hpp +569 -0
  986. casadi/include/proxsuite/proxqp/sparse/solver.hpp +1441 -0
  987. casadi/include/proxsuite/proxqp/sparse/sparse.hpp +10 -0
  988. casadi/include/proxsuite/proxqp/sparse/utils.hpp +815 -0
  989. casadi/include/proxsuite/proxqp/sparse/views.hpp +63 -0
  990. casadi/include/proxsuite/proxqp/sparse/workspace.hpp +790 -0
  991. casadi/include/proxsuite/proxqp/sparse/wrapper.hpp +772 -0
  992. casadi/include/proxsuite/proxqp/status.hpp +46 -0
  993. casadi/include/proxsuite/proxqp/timings.hpp +101 -0
  994. casadi/include/proxsuite/proxqp/utils/prints.hpp +47 -0
  995. casadi/include/proxsuite/proxqp/utils/random_qp_problems.hpp +669 -0
  996. casadi/include/proxsuite/serialization/archive.hpp +231 -0
  997. casadi/include/proxsuite/serialization/eigen.hpp +107 -0
  998. casadi/include/proxsuite/serialization/model.hpp +34 -0
  999. casadi/include/proxsuite/serialization/results.hpp +74 -0
  1000. casadi/include/proxsuite/serialization/settings.hpp +60 -0
  1001. casadi/include/proxsuite/serialization/wrapper.hpp +24 -0
  1002. casadi/include/proxsuite/warning.hpp +35 -0
  1003. casadi/include/simde/arm/neon/aba.h +208 -0
  1004. casadi/include/simde/arm/neon/abd.h +384 -0
  1005. casadi/include/simde/arm/neon/abdl.h +147 -0
  1006. casadi/include/simde/arm/neon/abs.h +408 -0
  1007. casadi/include/simde/arm/neon/add.h +681 -0
  1008. casadi/include/simde/arm/neon/addl.h +127 -0
  1009. casadi/include/simde/arm/neon/addl_high.h +127 -0
  1010. casadi/include/simde/arm/neon/addlv.h +317 -0
  1011. casadi/include/simde/arm/neon/addv.h +447 -0
  1012. casadi/include/simde/arm/neon/addw.h +222 -0
  1013. casadi/include/simde/arm/neon/addw_high.h +193 -0
  1014. casadi/include/simde/arm/neon/and.h +552 -0
  1015. casadi/include/simde/arm/neon/bic.h +472 -0
  1016. casadi/include/simde/arm/neon/bsl.h +448 -0
  1017. casadi/include/simde/arm/neon/cagt.h +168 -0
  1018. casadi/include/simde/arm/neon/ceq.h +711 -0
  1019. casadi/include/simde/arm/neon/ceqz.h +335 -0
  1020. casadi/include/simde/arm/neon/cge.h +677 -0
  1021. casadi/include/simde/arm/neon/cgez.h +378 -0
  1022. casadi/include/simde/arm/neon/cgt.h +686 -0
  1023. casadi/include/simde/arm/neon/cgtz.h +380 -0
  1024. casadi/include/simde/arm/neon/cle.h +677 -0
  1025. casadi/include/simde/arm/neon/clez.h +378 -0
  1026. casadi/include/simde/arm/neon/cls.h +148 -0
  1027. casadi/include/simde/arm/neon/clt.h +679 -0
  1028. casadi/include/simde/arm/neon/cltz.h +263 -0
  1029. casadi/include/simde/arm/neon/clz.h +423 -0
  1030. casadi/include/simde/arm/neon/cnt.h +145 -0
  1031. casadi/include/simde/arm/neon/combine.h +343 -0
  1032. casadi/include/simde/arm/neon/create.h +186 -0
  1033. casadi/include/simde/arm/neon/cvt.h +492 -0
  1034. casadi/include/simde/arm/neon/dot.h +171 -0
  1035. casadi/include/simde/arm/neon/dot_lane.h +196 -0
  1036. casadi/include/simde/arm/neon/dup_lane.h +702 -0
  1037. casadi/include/simde/arm/neon/dup_n.h +534 -0
  1038. casadi/include/simde/arm/neon/eor.h +552 -0
  1039. casadi/include/simde/arm/neon/ext.h +887 -0
  1040. casadi/include/simde/arm/neon/get_high.h +260 -0
  1041. casadi/include/simde/arm/neon/get_lane.h +499 -0
  1042. casadi/include/simde/arm/neon/get_low.h +276 -0
  1043. casadi/include/simde/arm/neon/hadd.h +287 -0
  1044. casadi/include/simde/arm/neon/hsub.h +287 -0
  1045. casadi/include/simde/arm/neon/ld1.h +399 -0
  1046. casadi/include/simde/arm/neon/ld3.h +609 -0
  1047. casadi/include/simde/arm/neon/ld4.h +448 -0
  1048. casadi/include/simde/arm/neon/max.h +614 -0
  1049. casadi/include/simde/arm/neon/maxnm.h +215 -0
  1050. casadi/include/simde/arm/neon/maxv.h +400 -0
  1051. casadi/include/simde/arm/neon/min.h +660 -0
  1052. casadi/include/simde/arm/neon/minnm.h +215 -0
  1053. casadi/include/simde/arm/neon/minv.h +424 -0
  1054. casadi/include/simde/arm/neon/mla.h +530 -0
  1055. casadi/include/simde/arm/neon/mla_n.h +333 -0
  1056. casadi/include/simde/arm/neon/mlal.h +156 -0
  1057. casadi/include/simde/arm/neon/mlal_high.h +156 -0
  1058. casadi/include/simde/arm/neon/mlal_n.h +128 -0
  1059. casadi/include/simde/arm/neon/mls.h +264 -0
  1060. casadi/include/simde/arm/neon/mlsl.h +124 -0
  1061. casadi/include/simde/arm/neon/mlsl_high.h +124 -0
  1062. casadi/include/simde/arm/neon/mlsl_n.h +96 -0
  1063. casadi/include/simde/arm/neon/movl.h +208 -0
  1064. casadi/include/simde/arm/neon/movl_high.h +126 -0
  1065. casadi/include/simde/arm/neon/movn.h +195 -0
  1066. casadi/include/simde/arm/neon/movn_high.h +125 -0
  1067. casadi/include/simde/arm/neon/mul.h +594 -0
  1068. casadi/include/simde/arm/neon/mul_lane.h +472 -0
  1069. casadi/include/simde/arm/neon/mul_n.h +383 -0
  1070. casadi/include/simde/arm/neon/mull.h +236 -0
  1071. casadi/include/simde/arm/neon/mull_high.h +125 -0
  1072. casadi/include/simde/arm/neon/mull_n.h +158 -0
  1073. casadi/include/simde/arm/neon/mvn.h +426 -0
  1074. casadi/include/simde/arm/neon/neg.h +393 -0
  1075. casadi/include/simde/arm/neon/orn.h +505 -0
  1076. casadi/include/simde/arm/neon/orr.h +552 -0
  1077. casadi/include/simde/arm/neon/padal.h +211 -0
  1078. casadi/include/simde/arm/neon/padd.h +293 -0
  1079. casadi/include/simde/arm/neon/paddl.h +239 -0
  1080. casadi/include/simde/arm/neon/pmax.h +253 -0
  1081. casadi/include/simde/arm/neon/pmin.h +260 -0
  1082. casadi/include/simde/arm/neon/qabs.h +281 -0
  1083. casadi/include/simde/arm/neon/qadd.h +553 -0
  1084. casadi/include/simde/arm/neon/qdmulh.h +125 -0
  1085. casadi/include/simde/arm/neon/qdmull.h +125 -0
  1086. casadi/include/simde/arm/neon/qmovn.h +273 -0
  1087. casadi/include/simde/arm/neon/qmovn_high.h +127 -0
  1088. casadi/include/simde/arm/neon/qmovun.h +159 -0
  1089. casadi/include/simde/arm/neon/qneg.h +301 -0
  1090. casadi/include/simde/arm/neon/qrdmulh.h +165 -0
  1091. casadi/include/simde/arm/neon/qrdmulh_n.h +136 -0
  1092. casadi/include/simde/arm/neon/qshl.h +732 -0
  1093. casadi/include/simde/arm/neon/qsub.h +549 -0
  1094. casadi/include/simde/arm/neon/qtbl.h +455 -0
  1095. casadi/include/simde/arm/neon/qtbx.h +470 -0
  1096. casadi/include/simde/arm/neon/rbit.h +165 -0
  1097. casadi/include/simde/arm/neon/reinterpret.h +3101 -0
  1098. casadi/include/simde/arm/neon/rev16.h +137 -0
  1099. casadi/include/simde/arm/neon/rev32.h +235 -0
  1100. casadi/include/simde/arm/neon/rev64.h +358 -0
  1101. casadi/include/simde/arm/neon/rhadd.h +406 -0
  1102. casadi/include/simde/arm/neon/rnd.h +143 -0
  1103. casadi/include/simde/arm/neon/rndi.h +135 -0
  1104. casadi/include/simde/arm/neon/rndm.h +143 -0
  1105. casadi/include/simde/arm/neon/rndn.h +135 -0
  1106. casadi/include/simde/arm/neon/rndp.h +143 -0
  1107. casadi/include/simde/arm/neon/rshl.h +903 -0
  1108. casadi/include/simde/arm/neon/rshr_n.h +471 -0
  1109. casadi/include/simde/arm/neon/rsra_n.h +209 -0
  1110. casadi/include/simde/arm/neon/set_lane.h +422 -0
  1111. casadi/include/simde/arm/neon/shl.h +805 -0
  1112. casadi/include/simde/arm/neon/shl_n.h +560 -0
  1113. casadi/include/simde/arm/neon/shr_n.h +612 -0
  1114. casadi/include/simde/arm/neon/sra_n.h +202 -0
  1115. casadi/include/simde/arm/neon/st1.h +353 -0
  1116. casadi/include/simde/arm/neon/st1_lane.h +363 -0
  1117. casadi/include/simde/arm/neon/st3.h +426 -0
  1118. casadi/include/simde/arm/neon/st4.h +445 -0
  1119. casadi/include/simde/arm/neon/sub.h +659 -0
  1120. casadi/include/simde/arm/neon/subl.h +127 -0
  1121. casadi/include/simde/arm/neon/subw.h +221 -0
  1122. casadi/include/simde/arm/neon/subw_high.h +222 -0
  1123. casadi/include/simde/arm/neon/tbl.h +224 -0
  1124. casadi/include/simde/arm/neon/tbx.h +247 -0
  1125. casadi/include/simde/arm/neon/trn.h +252 -0
  1126. casadi/include/simde/arm/neon/trn1.h +500 -0
  1127. casadi/include/simde/arm/neon/trn2.h +499 -0
  1128. casadi/include/simde/arm/neon/tst.h +540 -0
  1129. casadi/include/simde/arm/neon/types.h +683 -0
  1130. casadi/include/simde/arm/neon/uqadd.h +325 -0
  1131. casadi/include/simde/arm/neon/uzp.h +252 -0
  1132. casadi/include/simde/arm/neon/uzp1.h +643 -0
  1133. casadi/include/simde/arm/neon/uzp2.h +647 -0
  1134. casadi/include/simde/arm/neon/zip.h +252 -0
  1135. casadi/include/simde/arm/neon/zip1.h +625 -0
  1136. casadi/include/simde/arm/neon/zip2.h +625 -0
  1137. casadi/include/simde/arm/neon.h +166 -0
  1138. casadi/include/simde/check.h +276 -0
  1139. casadi/include/simde/debug-trap.h +85 -0
  1140. casadi/include/simde/hedley.h +1971 -0
  1141. casadi/include/simde/simde-align.h +449 -0
  1142. casadi/include/simde/simde-arch.h +532 -0
  1143. casadi/include/simde/simde-common.h +890 -0
  1144. casadi/include/simde/simde-complex.h +148 -0
  1145. casadi/include/simde/simde-constify.h +397 -0
  1146. casadi/include/simde/simde-detect-clang.h +109 -0
  1147. casadi/include/simde/simde-diagnostic.h +428 -0
  1148. casadi/include/simde/simde-features.h +522 -0
  1149. casadi/include/simde/simde-math.h +1805 -0
  1150. casadi/include/simde/x86/avx.h +6193 -0
  1151. casadi/include/simde/x86/avx2.h +5660 -0
  1152. casadi/include/simde/x86/avx512/2intersect.h +250 -0
  1153. casadi/include/simde/x86/avx512/abs.h +562 -0
  1154. casadi/include/simde/x86/avx512/add.h +641 -0
  1155. casadi/include/simde/x86/avx512/adds.h +390 -0
  1156. casadi/include/simde/x86/avx512/and.h +305 -0
  1157. casadi/include/simde/x86/avx512/andnot.h +193 -0
  1158. casadi/include/simde/x86/avx512/avg.h +258 -0
  1159. casadi/include/simde/x86/avx512/blend.h +293 -0
  1160. casadi/include/simde/x86/avx512/broadcast.h +897 -0
  1161. casadi/include/simde/x86/avx512/cast.h +324 -0
  1162. casadi/include/simde/x86/avx512/cmp.h +587 -0
  1163. casadi/include/simde/x86/avx512/cmpeq.h +179 -0
  1164. casadi/include/simde/x86/avx512/cmpge.h +104 -0
  1165. casadi/include/simde/x86/avx512/cmpgt.h +189 -0
  1166. casadi/include/simde/x86/avx512/cmple.h +103 -0
  1167. casadi/include/simde/x86/avx512/cmplt.h +123 -0
  1168. casadi/include/simde/x86/avx512/copysign.h +86 -0
  1169. casadi/include/simde/x86/avx512/cvt.h +122 -0
  1170. casadi/include/simde/x86/avx512/cvts.h +723 -0
  1171. casadi/include/simde/x86/avx512/div.h +162 -0
  1172. casadi/include/simde/x86/avx512/extract.h +198 -0
  1173. casadi/include/simde/x86/avx512/fmadd.h +136 -0
  1174. casadi/include/simde/x86/avx512/fmsub.h +108 -0
  1175. casadi/include/simde/x86/avx512/fnmadd.h +108 -0
  1176. casadi/include/simde/x86/avx512/fnmsub.h +108 -0
  1177. casadi/include/simde/x86/avx512/insert.h +193 -0
  1178. casadi/include/simde/x86/avx512/kshift.h +152 -0
  1179. casadi/include/simde/x86/avx512/load.h +67 -0
  1180. casadi/include/simde/x86/avx512/loadu.h +113 -0
  1181. casadi/include/simde/x86/avx512/lzcnt.h +209 -0
  1182. casadi/include/simde/x86/avx512/madd.h +155 -0
  1183. casadi/include/simde/x86/avx512/maddubs.h +159 -0
  1184. casadi/include/simde/x86/avx512/max.h +587 -0
  1185. casadi/include/simde/x86/avx512/min.h +587 -0
  1186. casadi/include/simde/x86/avx512/mov.h +859 -0
  1187. casadi/include/simde/x86/avx512/mov_mask.h +372 -0
  1188. casadi/include/simde/x86/avx512/movm.h +460 -0
  1189. casadi/include/simde/x86/avx512/mul.h +279 -0
  1190. casadi/include/simde/x86/avx512/mulhi.h +65 -0
  1191. casadi/include/simde/x86/avx512/mulhrs.h +65 -0
  1192. casadi/include/simde/x86/avx512/mullo.h +117 -0
  1193. casadi/include/simde/x86/avx512/negate.h +88 -0
  1194. casadi/include/simde/x86/avx512/or.h +252 -0
  1195. casadi/include/simde/x86/avx512/packs.h +122 -0
  1196. casadi/include/simde/x86/avx512/packus.h +122 -0
  1197. casadi/include/simde/x86/avx512/permutex2var.h +1645 -0
  1198. casadi/include/simde/x86/avx512/permutexvar.h +1180 -0
  1199. casadi/include/simde/x86/avx512/sad.h +77 -0
  1200. casadi/include/simde/x86/avx512/set.h +477 -0
  1201. casadi/include/simde/x86/avx512/set1.h +331 -0
  1202. casadi/include/simde/x86/avx512/set4.h +140 -0
  1203. casadi/include/simde/x86/avx512/setone.h +66 -0
  1204. casadi/include/simde/x86/avx512/setr.h +144 -0
  1205. casadi/include/simde/x86/avx512/setr4.h +140 -0
  1206. casadi/include/simde/x86/avx512/setzero.h +90 -0
  1207. casadi/include/simde/x86/avx512/shuffle.h +176 -0
  1208. casadi/include/simde/x86/avx512/sll.h +247 -0
  1209. casadi/include/simde/x86/avx512/slli.h +179 -0
  1210. casadi/include/simde/x86/avx512/sllv.h +68 -0
  1211. casadi/include/simde/x86/avx512/sqrt.h +127 -0
  1212. casadi/include/simde/x86/avx512/sra.h +81 -0
  1213. casadi/include/simde/x86/avx512/srai.h +70 -0
  1214. casadi/include/simde/x86/avx512/srav.h +67 -0
  1215. casadi/include/simde/x86/avx512/srl.h +216 -0
  1216. casadi/include/simde/x86/avx512/srli.h +180 -0
  1217. casadi/include/simde/x86/avx512/srlv.h +282 -0
  1218. casadi/include/simde/x86/avx512/store.h +93 -0
  1219. casadi/include/simde/x86/avx512/storeu.h +93 -0
  1220. casadi/include/simde/x86/avx512/sub.h +351 -0
  1221. casadi/include/simde/x86/avx512/subs.h +222 -0
  1222. casadi/include/simde/x86/avx512/test.h +193 -0
  1223. casadi/include/simde/x86/avx512/types.h +380 -0
  1224. casadi/include/simde/x86/avx512/unpackhi.h +380 -0
  1225. casadi/include/simde/x86/avx512/unpacklo.h +104 -0
  1226. casadi/include/simde/x86/avx512/xor.h +263 -0
  1227. casadi/include/simde/x86/avx512/xorsign.h +72 -0
  1228. casadi/include/simde/x86/avx512.h +108 -0
  1229. casadi/include/simde/x86/clmul.h +414 -0
  1230. casadi/include/simde/x86/fma.h +724 -0
  1231. casadi/include/simde/x86/gfni.h +802 -0
  1232. casadi/include/simde/x86/mmx.h +2399 -0
  1233. casadi/include/simde/x86/sse.h +4471 -0
  1234. casadi/include/simde/x86/sse2.h +7389 -0
  1235. casadi/include/simde/x86/sse3.h +499 -0
  1236. casadi/include/simde/x86/sse4.1.h +2216 -0
  1237. casadi/include/simde/x86/sse4.2.h +347 -0
  1238. casadi/include/simde/x86/ssse3.h +1032 -0
  1239. casadi/include/simde/x86/svml.h +12139 -0
  1240. casadi/include/simde/x86/xop.h +3644 -0
  1241. casadi/include/superscs/cones.h +185 -0
  1242. casadi/include/superscs/constants.h +144 -0
  1243. casadi/include/superscs/cs.h +109 -0
  1244. casadi/include/superscs/ctrlc.h +77 -0
  1245. casadi/include/superscs/directions.h +125 -0
  1246. casadi/include/superscs/glbopts.h +240 -0
  1247. casadi/include/superscs/linAlg.h +437 -0
  1248. casadi/include/superscs/linSys.h +205 -0
  1249. casadi/include/superscs/linsys/amatrix.h +77 -0
  1250. casadi/include/superscs/linsys/common.h +49 -0
  1251. casadi/include/superscs/normalize.h +138 -0
  1252. casadi/include/superscs/scs.h +656 -0
  1253. casadi/include/superscs/scs_blas.h +79 -0
  1254. casadi/include/superscs/scs_parser.h +187 -0
  1255. casadi/include/superscs/unit_test_util.h +210 -0
  1256. casadi/include/superscs/util.h +354 -0
  1257. casadi/include/tinyxml2.h +2380 -0
  1258. casadi/include/trlib/trlib_eigen_inverse.h +118 -0
  1259. casadi/include/trlib/trlib_krylov.h +493 -0
  1260. casadi/include/trlib/trlib_leftmost.h +181 -0
  1261. casadi/include/trlib/trlib_private.h +109 -0
  1262. casadi/include/trlib/trlib_quadratic_zero.h +57 -0
  1263. casadi/include/trlib/trlib_tri_factor.h +409 -0
  1264. casadi/include/trlib/trlib_types.h +36 -0
  1265. casadi/lib/cmake/tinyxml2/tinyxml2-config-version.cmake +70 -0
  1266. casadi/lib/cmake/tinyxml2/tinyxml2-config.cmake +57 -0
  1267. casadi/lib/cmake/tinyxml2/tinyxml2-static-targets-release.cmake +19 -0
  1268. casadi/lib/cmake/tinyxml2/tinyxml2-static-targets.cmake +103 -0
  1269. casadi/lib/libtinyxml2.a +0 -0
  1270. casadi/lib/pkgconfig/tinyxml2.pc +10 -0
  1271. casadi/libCbc.la +35 -0
  1272. casadi/libCbc.so +0 -0
  1273. casadi/libCbc.so.3 +0 -0
  1274. casadi/libCbc.so.3.10.11 +0 -0
  1275. casadi/libCbcSolver.la +35 -0
  1276. casadi/libCbcSolver.so +0 -0
  1277. casadi/libCbcSolver.so.3 +0 -0
  1278. casadi/libCbcSolver.so.3.10.11 +0 -0
  1279. casadi/libCgl.la +35 -0
  1280. casadi/libCgl.so +0 -0
  1281. casadi/libCgl.so.1 +0 -0
  1282. casadi/libCgl.so.1.10.8 +0 -0
  1283. casadi/libClp.la +35 -0
  1284. casadi/libClp.so +0 -0
  1285. casadi/libClp.so.1 +0 -0
  1286. casadi/libClp.so.1.14.9 +0 -0
  1287. casadi/libClpSolver.la +35 -0
  1288. casadi/libClpSolver.so +0 -0
  1289. casadi/libClpSolver.so.1 +0 -0
  1290. casadi/libClpSolver.so.1.14.9 +0 -0
  1291. casadi/libCoinUtils.la +35 -0
  1292. casadi/libCoinUtils.so +0 -0
  1293. casadi/libCoinUtils.so.3 +0 -0
  1294. casadi/libCoinUtils.so.3.11.10 +0 -0
  1295. casadi/libFortranHighs.so +0 -0
  1296. casadi/libOsi.la +35 -0
  1297. casadi/libOsi.so +0 -0
  1298. casadi/libOsi.so.1 +0 -0
  1299. casadi/libOsi.so.1.13.9 +0 -0
  1300. casadi/libOsiCbc.la +35 -0
  1301. casadi/libOsiCbc.so +0 -0
  1302. casadi/libOsiCbc.so.3 +0 -0
  1303. casadi/libOsiCbc.so.3.10.11 +0 -0
  1304. casadi/libOsiClp.la +35 -0
  1305. casadi/libOsiClp.so +0 -0
  1306. casadi/libOsiClp.so.1 +0 -0
  1307. casadi/libOsiClp.so.1.14.9 +0 -0
  1308. casadi/libOsiCommonTests.la +35 -0
  1309. casadi/libOsiCommonTests.so +0 -0
  1310. casadi/libOsiCommonTests.so.1 +0 -0
  1311. casadi/libOsiCommonTests.so.1.13.9 +0 -0
  1312. casadi/libalpaqa-dl-loader.so +0 -0
  1313. casadi/libalpaqa-dl-loader.so.1.0.0 +0 -0
  1314. casadi/libalpaqa.so +0 -0
  1315. casadi/libalpaqa.so.1.0.0 +0 -0
  1316. casadi/libbonmin.la +35 -0
  1317. casadi/libbonmin.so +0 -0
  1318. casadi/libbonmin.so.4 +0 -0
  1319. casadi/libbonmin.so.4.8.9 +0 -0
  1320. casadi/libcasadi-tp-openblas.so +0 -0
  1321. casadi/libcasadi-tp-openblas.so.0 +0 -0
  1322. casadi/libcasadi-tp-openblas.so.0.3 +0 -0
  1323. casadi/libcasadi.so +0 -0
  1324. casadi/libcasadi.so.3.7 +0 -0
  1325. casadi/libcasadi_conic_cbc.so +0 -0
  1326. casadi/libcasadi_conic_cbc.so.3.7 +0 -0
  1327. casadi/libcasadi_conic_clp.so +0 -0
  1328. casadi/libcasadi_conic_clp.so.3.7 +0 -0
  1329. casadi/libcasadi_conic_gurobi.so +0 -0
  1330. casadi/libcasadi_conic_gurobi.so.3.7 +0 -0
  1331. casadi/libcasadi_conic_highs.so +0 -0
  1332. casadi/libcasadi_conic_highs.so.3.7 +0 -0
  1333. casadi/libcasadi_conic_ipqp.so +0 -0
  1334. casadi/libcasadi_conic_ipqp.so.3.7 +0 -0
  1335. casadi/libcasadi_conic_nlpsol.so +0 -0
  1336. casadi/libcasadi_conic_nlpsol.so.3.7 +0 -0
  1337. casadi/libcasadi_conic_osqp.so +0 -0
  1338. casadi/libcasadi_conic_osqp.so.3.7 +0 -0
  1339. casadi/libcasadi_conic_proxqp.so +0 -0
  1340. casadi/libcasadi_conic_proxqp.so.3.7 +0 -0
  1341. casadi/libcasadi_conic_qpoases.so +0 -0
  1342. casadi/libcasadi_conic_qpoases.so.3.7 +0 -0
  1343. casadi/libcasadi_conic_qrqp.so +0 -0
  1344. casadi/libcasadi_conic_qrqp.so.3.7 +0 -0
  1345. casadi/libcasadi_conic_superscs.so +0 -0
  1346. casadi/libcasadi_conic_superscs.so.3.7 +0 -0
  1347. casadi/libcasadi_importer_shell.so +0 -0
  1348. casadi/libcasadi_importer_shell.so.3.7 +0 -0
  1349. casadi/libcasadi_integrator_collocation.so +0 -0
  1350. casadi/libcasadi_integrator_collocation.so.3.7 +0 -0
  1351. casadi/libcasadi_integrator_cvodes.so +0 -0
  1352. casadi/libcasadi_integrator_cvodes.so.3.7 +0 -0
  1353. casadi/libcasadi_integrator_idas.so +0 -0
  1354. casadi/libcasadi_integrator_idas.so.3.7 +0 -0
  1355. casadi/libcasadi_integrator_rk.so +0 -0
  1356. casadi/libcasadi_integrator_rk.so.3.7 +0 -0
  1357. casadi/libcasadi_interpolant_bspline.so +0 -0
  1358. casadi/libcasadi_interpolant_bspline.so.3.7 +0 -0
  1359. casadi/libcasadi_interpolant_linear.so +0 -0
  1360. casadi/libcasadi_interpolant_linear.so.3.7 +0 -0
  1361. casadi/libcasadi_linsol_csparse.so +0 -0
  1362. casadi/libcasadi_linsol_csparse.so.3.7 +0 -0
  1363. casadi/libcasadi_linsol_csparsecholesky.so +0 -0
  1364. casadi/libcasadi_linsol_csparsecholesky.so.3.7 +0 -0
  1365. casadi/libcasadi_linsol_lapacklu.so +0 -0
  1366. casadi/libcasadi_linsol_lapacklu.so.3.7 +0 -0
  1367. casadi/libcasadi_linsol_lapackqr.so +0 -0
  1368. casadi/libcasadi_linsol_lapackqr.so.3.7 +0 -0
  1369. casadi/libcasadi_linsol_ldl.so +0 -0
  1370. casadi/libcasadi_linsol_ldl.so.3.7 +0 -0
  1371. casadi/libcasadi_linsol_lsqr.so +0 -0
  1372. casadi/libcasadi_linsol_lsqr.so.3.7 +0 -0
  1373. casadi/libcasadi_linsol_ma27.so +0 -0
  1374. casadi/libcasadi_linsol_ma27.so.3.7 +0 -0
  1375. casadi/libcasadi_linsol_mumps.so +0 -0
  1376. casadi/libcasadi_linsol_mumps.so.3.7 +0 -0
  1377. casadi/libcasadi_linsol_qr.so +0 -0
  1378. casadi/libcasadi_linsol_qr.so.3.7 +0 -0
  1379. casadi/libcasadi_linsol_symbolicqr.so +0 -0
  1380. casadi/libcasadi_linsol_symbolicqr.so.3.7 +0 -0
  1381. casadi/libcasadi_linsol_tridiag.so +0 -0
  1382. casadi/libcasadi_linsol_tridiag.so.3.7 +0 -0
  1383. casadi/libcasadi_nlpsol_alpaqa.so +0 -0
  1384. casadi/libcasadi_nlpsol_alpaqa.so.3.7 +0 -0
  1385. casadi/libcasadi_nlpsol_ampl.so +0 -0
  1386. casadi/libcasadi_nlpsol_ampl.so.3.7 +0 -0
  1387. casadi/libcasadi_nlpsol_blocksqp.so +0 -0
  1388. casadi/libcasadi_nlpsol_blocksqp.so.3.7 +0 -0
  1389. casadi/libcasadi_nlpsol_bonmin.so +0 -0
  1390. casadi/libcasadi_nlpsol_bonmin.so.3.7 +0 -0
  1391. casadi/libcasadi_nlpsol_feasiblesqpmethod.so +0 -0
  1392. casadi/libcasadi_nlpsol_feasiblesqpmethod.so.3.7 +0 -0
  1393. casadi/libcasadi_nlpsol_ipopt.so +0 -0
  1394. casadi/libcasadi_nlpsol_ipopt.so.3.7 +0 -0
  1395. casadi/libcasadi_nlpsol_knitro.so +0 -0
  1396. casadi/libcasadi_nlpsol_knitro.so.3.7 +0 -0
  1397. casadi/libcasadi_nlpsol_qrsqp.so +0 -0
  1398. casadi/libcasadi_nlpsol_qrsqp.so.3.7 +0 -0
  1399. casadi/libcasadi_nlpsol_scpgen.so +0 -0
  1400. casadi/libcasadi_nlpsol_scpgen.so.3.7 +0 -0
  1401. casadi/libcasadi_nlpsol_sleqp.so +0 -0
  1402. casadi/libcasadi_nlpsol_sleqp.so.3.7 +0 -0
  1403. casadi/libcasadi_nlpsol_snopt.so +0 -0
  1404. casadi/libcasadi_nlpsol_snopt.so.3.7 +0 -0
  1405. casadi/libcasadi_nlpsol_sqpmethod.so +0 -0
  1406. casadi/libcasadi_nlpsol_sqpmethod.so.3.7 +0 -0
  1407. casadi/libcasadi_nlpsol_worhp.so +0 -0
  1408. casadi/libcasadi_nlpsol_worhp.so.3.7 +0 -0
  1409. casadi/libcasadi_rootfinder_fast_newton.so +0 -0
  1410. casadi/libcasadi_rootfinder_fast_newton.so.3.7 +0 -0
  1411. casadi/libcasadi_rootfinder_kinsol.so +0 -0
  1412. casadi/libcasadi_rootfinder_kinsol.so.3.7 +0 -0
  1413. casadi/libcasadi_rootfinder_newton.so +0 -0
  1414. casadi/libcasadi_rootfinder_newton.so.3.7 +0 -0
  1415. casadi/libcasadi_rootfinder_nlpsol.so +0 -0
  1416. casadi/libcasadi_rootfinder_nlpsol.so.3.7 +0 -0
  1417. casadi/libcasadi_sundials_common.so +0 -0
  1418. casadi/libcasadi_sundials_common.so.3.7 +0 -0
  1419. casadi/libcasadi_xmlfile_tinyxml.so +0 -0
  1420. casadi/libcasadi_xmlfile_tinyxml.so.3.7 +0 -0
  1421. casadi/libcoinmetis.la +41 -0
  1422. casadi/libcoinmetis.so +0 -0
  1423. casadi/libcoinmetis.so.2 +0 -0
  1424. casadi/libcoinmetis.so.2.0.0 +0 -0
  1425. casadi/libcoinmumps.la +41 -0
  1426. casadi/libcoinmumps.so +0 -0
  1427. casadi/libcoinmumps.so.3 +0 -0
  1428. casadi/libcoinmumps.so.3.0.1 +0 -0
  1429. casadi/libgfortran-a8535147.so.5.0.0 +0 -0
  1430. casadi/libgurobi_adaptor.so +0 -0
  1431. casadi/libhighs.so +0 -0
  1432. casadi/libhighs.so.1.6 +0 -0
  1433. casadi/libhighs.so.1.6.0 +0 -0
  1434. casadi/libindirect.a +0 -0
  1435. casadi/libipopt.la +41 -0
  1436. casadi/libipopt.so +0 -0
  1437. casadi/libipopt.so.3 +0 -0
  1438. casadi/libipopt.so.3.14.11 +0 -0
  1439. casadi/liblinsys.a +0 -0
  1440. casadi/libosqp.a +0 -0
  1441. casadi/libosqp.so +0 -0
  1442. casadi/libqdldl.a +0 -0
  1443. casadi/libqdldl.so +0 -0
  1444. casadi/libquadmath-e2ac3af2.so.0.0.0 +0 -0
  1445. casadi/libsipopt.la +41 -0
  1446. casadi/libsipopt.so +0 -0
  1447. casadi/libsipopt.so.3 +0 -0
  1448. casadi/libsipopt.so.3.14.11 +0 -0
  1449. casadi/libsleqp.so +0 -0
  1450. casadi/libsleqp.so.1.0.1 +0 -0
  1451. casadi/libspral.a +0 -0
  1452. casadi/libsuperscs.a +0 -0
  1453. casadi/libtrlib.so +0 -0
  1454. casadi/libtrlib.so.0.4 +0 -0
  1455. casadi/pkgconfig/blas.pc +11 -0
  1456. casadi/pkgconfig/bonmin.pc +12 -0
  1457. casadi/pkgconfig/casadi.pc +12 -0
  1458. casadi/pkgconfig/cbc.pc +12 -0
  1459. casadi/pkgconfig/cgl.pc +12 -0
  1460. casadi/pkgconfig/clp.pc +12 -0
  1461. casadi/pkgconfig/coinmetis.pc +13 -0
  1462. casadi/pkgconfig/coinmumps.pc +15 -0
  1463. casadi/pkgconfig/coinutils.pc +12 -0
  1464. casadi/pkgconfig/highs.pc +12 -0
  1465. casadi/pkgconfig/ipopt.pc +15 -0
  1466. casadi/pkgconfig/lapack.pc +11 -0
  1467. casadi/pkgconfig/openblas.pc +11 -0
  1468. casadi/pkgconfig/osi-cbc.pc +12 -0
  1469. casadi/pkgconfig/osi-clp.pc +12 -0
  1470. casadi/pkgconfig/osi-unittests.pc +12 -0
  1471. casadi/pkgconfig/osi.pc +12 -0
  1472. casadi/pkgconfig/proxsuite.pc +22 -0
  1473. casadi/pkgconfig/sleqp.pc +10 -0
  1474. casadi/tools/__init__.py +48 -0
  1475. casadi/tools/bounds.py +107 -0
  1476. casadi/tools/graph/__init__.py +35 -0
  1477. casadi/tools/graph/graph.py +747 -0
  1478. casadi/tools/in_out.py +89 -0
  1479. casadi/tools/structure.py +1446 -0
  1480. casadi/tools/structure3.py +1441 -0
  1481. casadi-3.6.4.dist-info/METADATA +37 -0
  1482. casadi-3.6.4.dist-info/RECORD +1484 -0
  1483. casadi-3.6.4.dist-info/WHEEL +4 -0
  1484. dummy.txt +1 -0
@@ -0,0 +1,4673 @@
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
+
27
+ %module(package="casadi",directors=1) casadi
28
+
29
+ #ifdef CASADI_WITH_COPYSIGN_UNDEF
30
+ %{
31
+ #ifdef copysign
32
+ #undef copysign
33
+ #endif
34
+ %}
35
+ #endif // CASADI_WITH_COPYSIGN_UNDEF
36
+
37
+ // Include all public CasADi C++
38
+ %{
39
+ #include <casadi/casadi.hpp>
40
+ #include <casadi/core/casadi_interrupt.hpp>
41
+ %}
42
+
43
+ // casadi_int type
44
+ %include <casadi/core/casadi_types.hpp>
45
+
46
+ /// Data structure in the target language holding data
47
+ #ifdef SWIGPYTHON
48
+ #define GUESTOBJECT PyObject
49
+ #elif defined(SWIGMATLAB)
50
+ #define GUESTOBJECT mxArray
51
+ #else
52
+ #define GUESTOBJECT void
53
+ #endif
54
+
55
+ // Define printing routine
56
+
57
+ #ifdef SWIGPYTHON
58
+ %{
59
+ namespace casadi {
60
+ // Redirect printout
61
+ static void pythonlogger(const char* s, std::streamsize num, bool error) {
62
+ if (!casadi::InterruptHandler::is_main_thread()) {
63
+ casadi::Logger::writeDefault(s, num, error);
64
+ return;
65
+ }
66
+ int n = num;
67
+ while (n>0) {
68
+ if (error) {
69
+ PySys_WriteStderr("%.*s", std::min(n, 1000), s);
70
+ } else {
71
+ PySys_WriteStdout("%.*s", std::min(n, 1000), s);
72
+ }
73
+ n -= 1000;
74
+ s += 1000;
75
+ }
76
+ }
77
+
78
+ static bool pythoncheckinterrupted() {
79
+ if (!casadi::InterruptHandler::is_main_thread()) return false;
80
+ return PyErr_CheckSignals();
81
+ }
82
+
83
+ void handle_director_exception() {
84
+ std::string msg = "Exception in SWIG director ";
85
+ SWIG_PYTHON_THREAD_BEGIN_BLOCK;
86
+ if (PyErr_ExceptionMatches(PyExc_KeyboardInterrupt)) {
87
+ PyErr_Clear();
88
+ SWIG_PYTHON_THREAD_END_BLOCK;
89
+ throw casadi::KeyboardInterruptException();
90
+ }
91
+ PyObject *ptype, *pvalue, *ptraceback;
92
+ PyErr_Fetch(&ptype, &pvalue, &ptraceback);
93
+ PyObject* msg_py = PyObject_Str(pvalue);
94
+ char *msg_char = SWIG_Python_str_AsChar(msg_py);
95
+ msg = msg_char;
96
+ SWIG_Python_str_DelForPy3(msg_char);
97
+ Py_DECREF(msg_py);
98
+ PyErr_Restore(ptype, pvalue, ptraceback);
99
+ PyErr_Print();
100
+ SWIG_PYTHON_THREAD_END_BLOCK;
101
+ casadi_error(msg.c_str());
102
+ }
103
+ }
104
+
105
+ %}
106
+ %init %{
107
+ // Set logger functions
108
+ casadi::Logger::writeFun = casadi::pythonlogger;
109
+
110
+ // @jgillis: please document
111
+ casadi::InterruptHandler::checkInterrupted = casadi::pythoncheckinterrupted;
112
+
113
+ casadi::InterruptHandler::is_main_thread();
114
+
115
+ %}
116
+ #elif defined(SWIGMATLAB)
117
+ %{
118
+ namespace casadi {
119
+ // Redirect printout to mexPrintf
120
+ static void mexlogger(const char* s, std::streamsize num, bool error) {
121
+ if (!casadi::InterruptHandler::is_main_thread()) {
122
+ casadi::Logger::writeDefault(s, num, error);
123
+ return;
124
+ }
125
+ mexPrintf("%.*s", static_cast<int>(num), s);
126
+ }
127
+
128
+ #ifdef HAVE_OCTAVE
129
+ // Flush the command window buffer (needed in gui mode)
130
+ static void mexflush(bool error) {
131
+ }
132
+ // Never for Octave
133
+ static bool mexcheckinterrupted() {
134
+ return false;
135
+ }
136
+ void mexclearinterrupted() {
137
+
138
+ }
139
+ #else
140
+ // Undocumented matlab feature
141
+ extern "C" bool utIsInterruptPending(void);
142
+ extern "C" void utSetInterruptPending(bool);
143
+
144
+ static bool mexcheckinterrupted() {
145
+ if (!casadi::InterruptHandler::is_main_thread()) return false;
146
+ return utIsInterruptPending();
147
+ }
148
+
149
+ void mexclearinterrupted() {
150
+ utSetInterruptPending(false);
151
+ }
152
+
153
+ // Flush the command window buffer (needed in gui mode)
154
+ static void mexflush(bool error) {
155
+ if (!casadi::InterruptHandler::is_main_thread()) {
156
+ casadi::Logger::flushDefault(error);
157
+ return;
158
+ }
159
+ if (!mexcheckinterrupted()) {
160
+ if (mexEvalString("drawnow('update');pause(0.0001);")) {
161
+ utSetInterruptPending(true);
162
+ }
163
+ }
164
+ }
165
+ #endif
166
+
167
+ }
168
+ %}
169
+ %init %{
170
+ // Get full path
171
+ mxArray *fullpath, *fullpath_cmd = mxCreateString("fullpath");
172
+ mexCallMATLAB(1, &fullpath, 1, &fullpath_cmd, "mfilename");
173
+ mxDestroyArray(fullpath_cmd);
174
+ std::string path = mxArrayToString(fullpath);
175
+ mxDestroyArray(fullpath);
176
+
177
+ // Get file separator
178
+ mxArray *filesep;
179
+ mexCallMATLAB(1, &filesep, 0, 0, "filesep");
180
+ std::string sep = mxArrayToString(filesep);
181
+ mxDestroyArray(filesep);
182
+
183
+ // Truncate at separator
184
+ path = path.substr(0, path.rfind(sep));
185
+
186
+ // Octave-on-Windows seems to pick up superfluous +casadi
187
+ // Make sure we exclude it
188
+ if (path.rfind(sep)!=std::string::npos && path.substr(path.rfind(sep)+1)=="+casadi")
189
+ path = path.substr(0, path.rfind(sep));
190
+
191
+ // Set library path
192
+ casadi::GlobalOptions::setCasadiPath(path);
193
+ casadi::GlobalOptions::setCasadiIncludePath(path+sep+"include");
194
+
195
+ // Matlab is index-one based
196
+ casadi::GlobalOptions::start_index = 1;
197
+
198
+ // @jgillis: please document
199
+ mxArray *warning_rhs[] = {mxCreateString("error"),
200
+
201
+ mxCreateString("SWIG:OverloadError")};
202
+ mexCallMATLAB(0, 0, 2, warning_rhs, "warning");
203
+ mxDestroyArray(warning_rhs[0]);
204
+ mxDestroyArray(warning_rhs[1]);
205
+
206
+
207
+ // Set logger functions
208
+ casadi::Logger::writeFun = casadi::mexlogger;
209
+ casadi::Logger::flush = casadi::mexflush;
210
+
211
+ // @jgillis: please document
212
+ casadi::InterruptHandler::checkInterrupted = casadi::mexcheckinterrupted;
213
+ casadi::InterruptHandler::clearInterrupted = casadi::mexclearinterrupted;
214
+
215
+ casadi::InterruptHandler::is_main_thread();
216
+
217
+ %}
218
+ #endif
219
+
220
+ // Turn off the warnings that certain methods are effectively ignored, this seams to be a false warning,
221
+ // for example vertcat(SXVector), vertcat(DMVector) and vertcat(MXVector) appears to work fine
222
+ #pragma SWIG nowarn=509,303,302
223
+
224
+ #define CASADI_EXPORT
225
+
226
+ // Incude cmath early on, see #622
227
+ %begin %{
228
+ #include <cmath>
229
+ #ifdef _XOPEN_SOURCE
230
+ #undef _XOPEN_SOURCE
231
+ #endif
232
+ #ifdef _POSIX_C_SOURCE
233
+ #undef _POSIX_C_SOURCE
234
+ #endif
235
+ %}
236
+
237
+ %ignore *::operator->;
238
+
239
+ %rename(str) get_str;
240
+
241
+ %begin %{
242
+ #define SWIG_PYTHON_OUTPUT_TUPLE
243
+ %}
244
+
245
+ #ifdef SWIGPYTHON
246
+ %pythoncode %{
247
+
248
+ import contextlib
249
+
250
+ class _copyableObject(object):
251
+ def __copy__(self):
252
+ return self.__class__(self)
253
+
254
+ def __deepcopy__(self,dummy=None):
255
+ return self.__class__(self)
256
+
257
+ _object = object = _copyableObject
258
+
259
+ _swig_repr_default = _swig_repr
260
+ def _swig_repr(self):
261
+ if hasattr(self,'repr'):
262
+ return self.repr()
263
+ else:
264
+ return _swig_repr_default(self)
265
+
266
+ def DM_from_array(m, check_only=True):
267
+ import numpy as np
268
+ if isinstance(m, np.ndarray):
269
+ if len(m.shape)>2:
270
+ return False
271
+ try:
272
+ m = m.astype(float,casting="same_kind",copy=False)
273
+ except:
274
+ return False
275
+ if check_only:
276
+ return True
277
+ else:
278
+ shape = m.shape + (1, 1)
279
+ nrow, ncol = shape[0], shape[1]
280
+ return (nrow,ncol,m.flat)
281
+ return False
282
+
283
+ def IM_from_array(m, check_only=True):
284
+ import numpy as np
285
+ if isinstance(m, np.ndarray):
286
+ if len(m.shape)>2:
287
+ return False
288
+ try:
289
+ m = m.astype(int,casting="same_kind",copy=False)
290
+ except:
291
+ return False
292
+ if check_only:
293
+ return True
294
+ else:
295
+ shape = m.shape + (1, 1)
296
+ nrow, ncol = shape[0], shape[1]
297
+ return (nrow,ncol,m.flat)
298
+ return False
299
+
300
+ def SX_from_array(m, check_only=True):
301
+ import numpy as np
302
+ if isinstance(m, np.ndarray):
303
+ if len(m.shape)>2:
304
+ return False
305
+ if m.dtype!=object: return None
306
+ shape = m.shape + (1, 1)
307
+ nrow, ncol = shape[0], shape[1]
308
+ return (nrow,ncol,m.flat)
309
+ return False
310
+
311
+ def DM_from_csc(m, check_only=True):
312
+ if hasattr(m,"tocsc"):
313
+ m = m.tocsc()
314
+ if m.__class__.__name__ == "csc_matrix":
315
+ if len(m.shape)!=2: return False
316
+ if check_only: return True
317
+ return m.shape + (m.indptr.flat,m.indices.flat,m.data.flat)
318
+ return False
319
+
320
+ %}
321
+ #endif // WITH_SWIGPYTHON
322
+
323
+
324
+ // These are the following styles
325
+ // error
326
+ // overview
327
+ // group
328
+
329
+ %feature("autodoc", "1");
330
+
331
+ %feature("customdoc", "1");
332
+
333
+ %feature("customdoc:arg:self", "self");
334
+
335
+ #if defined(SWIGMATLAB) || defined(SWIGOCTAVE)
336
+ #define MNAME "$NAME"
337
+ %feature("customdoc:proto:constructor", "new_obj = $NAME($in)");
338
+ %feature("customdoc:proto:single_out", "$out = $NAME($in)");
339
+ %feature("customdoc:proto:normal", "[$out] = $NAME($in)");
340
+ %feature("customdoc:main", " $NAME $brief\n\n$overview\n$main");
341
+ #else
342
+ #define MNAME "$name"
343
+ %feature("customdoc:proto:constructor", "$name($in)");
344
+ %feature("customdoc:proto:single_out", "$name($in) -> $out");
345
+ %feature("customdoc:proto:normal", "$name($in) -> ($out)");
346
+ %feature("customdoc:main", " $brief\n\n::\n\n$overview\n$main");
347
+ #endif
348
+
349
+ %feature("customdoc:arg:normal:style_error", "$type");
350
+ %feature("customdoc:arg:only:style_error", "$type");
351
+ %feature("customdoc:arg:separator:style_error", ",");
352
+ %feature("customdoc:proto:void:style_error", MNAME "($in)");
353
+ %feature("customdoc:proto:single_out:style_error", MNAME "($in)");
354
+ %feature("customdoc:proto:normal:style_error", MNAME "($in)");
355
+ %feature("customdoc:proto:constructor:style_error", MNAME "($in)");
356
+
357
+ %feature("customdoc:arg:normal", "$type $name");
358
+ %feature("customdoc:arg:only", "$type $name");
359
+ %feature("customdoc:arg:only:out", "$type");
360
+ %feature("customdoc:arg:no_name", "out$ip");
361
+ %feature("customdoc:arg:separator", ", ");
362
+
363
+
364
+ %feature("customdoc:proto:void", MNAME "($in)");
365
+ %feature("customdoc:proto:single_out:style_group", MNAME "($in)");
366
+ %feature("customdoc:proto:normal:style_group", MNAME "($in)");
367
+ %feature("customdoc:proto:constructor:style_group", MNAME "($in)");
368
+
369
+ %feature("customdoc:protoline", " $proto");
370
+ %feature("customdoc:protoline:style_overview", " $proto");
371
+ %feature("customdoc:protoline:nobrief:style_overview", " $proto");
372
+
373
+ %feature("customdoc:protoline:style_group", " $proto");
374
+
375
+ %feature("customdoc:group", "\n.......\n\n::\n\n$group\n$main\n\n.............\n\n");
376
+
377
+ // append works for strings
378
+
379
+ %naturalvar;
380
+
381
+ // Make data members read-only
382
+ %immutable;
383
+
384
+ // Make sure that a copy constructor is created
385
+ %copyctor;
386
+
387
+ #ifndef SWIGXML
388
+ %feature("compactdefaultargs","1");
389
+ //%feature("compactdefaultargs","0") casadi::taylor; // taylor function has a default argument for which the namespace is not recognised by SWIG
390
+ %feature("compactdefaultargs","0") casadi::Function::generateCode; // buggy
391
+ #endif //SWIGXML
392
+
393
+ // STL
394
+ #ifdef SWIGXML
395
+ namespace std {
396
+ template<class T> class vector {};
397
+ template<class A, class B> class pair {};
398
+ template<class A, class B> class map {};
399
+ }
400
+ #else // SWIGXML
401
+ %include "stl.i"
402
+ #endif // SWIGXML
403
+
404
+ %include "doc.i"
405
+
406
+
407
+ // Note: Only from 3.0.0 onwards,
408
+ // DirectorException inherits from std::exception
409
+ #if SWIG_VERSION >= 0x030000
410
+ // Exceptions handling
411
+ %include "exception.i"
412
+ %exception {
413
+ try {
414
+ $action
415
+ } catch(const std::exception& e) {
416
+ SWIG_exception(SWIG_RuntimeError, e.what());
417
+ }
418
+ }
419
+
420
+ // Python sometimes takes an approach to not check, but just try.
421
+ // It expects a python error to be thrown.
422
+ %exception __int__ {
423
+ try {
424
+ $action
425
+ } catch (const std::exception& e) {
426
+ SWIG_exception(SWIG_RuntimeError, e.what());
427
+ }
428
+ }
429
+
430
+ #ifdef WITH_PYTHON3
431
+ // See https://github.com/casadi/casadi/issues/701
432
+ // Recent numpys will only catch TypeError or ValueError in printing logic
433
+ %exception __bool__ {
434
+ try {
435
+ $action
436
+ } catch (const std::exception& e) {
437
+ SWIG_exception(SWIG_TypeError, e.what());
438
+ }
439
+ }
440
+ #else
441
+ %exception __nonzero__ {
442
+ try {
443
+ $action
444
+ } catch (const std::exception& e) {
445
+ SWIG_exception(SWIG_TypeError, e.what());
446
+ }
447
+ }
448
+ #endif
449
+ #else
450
+ // Exceptions handling
451
+ %include "exception.i"
452
+ %exception {
453
+ try {
454
+ $action
455
+ } catch(const std::exception& e) {
456
+ SWIG_exception(SWIG_RuntimeError, e.what());
457
+ } catch (const Swig::DirectorException& e) {
458
+ SWIG_exception(SWIG_TypeError, e.getMessage());
459
+ }
460
+ }
461
+
462
+ // Python sometimes takes an approach to not check, but just try.
463
+ // It expects a python error to be thrown.
464
+ %exception __int__ {
465
+ try {
466
+ $action
467
+ } catch (const std::exception& e) {
468
+ SWIG_exception(SWIG_RuntimeError, e.what());
469
+ } catch (const Swig::DirectorException& e) {
470
+ SWIG_exception(SWIG_TypeError, e.getMessage());
471
+ }
472
+ }
473
+
474
+ #ifdef WITH_PYTHON3
475
+ // See https://github.com/casadi/casadi/issues/701
476
+ // Recent numpys will only catch TypeError or ValueError in printing logic
477
+ %exception __bool__ {
478
+ try {
479
+ $action
480
+ } catch (const std::exception& e) {
481
+ SWIG_exception(SWIG_TypeError, e.what());
482
+ } catch (const Swig::DirectorException& e) {
483
+ SWIG_exception(SWIG_TypeError, e.getMessage());
484
+ }
485
+ }
486
+ #else
487
+ %exception __nonzero__ {
488
+ try {
489
+ $action
490
+ } catch (const std::exception& e) {
491
+ SWIG_exception(SWIG_TypeError, e.what());
492
+ }
493
+ catch (const Swig::DirectorException& e) {
494
+ SWIG_exception(SWIG_TypeError, e.getMessage());
495
+ }
496
+ }
497
+ #endif
498
+ #endif
499
+
500
+ #ifdef SWIGPYTHON
501
+ %feature("director:except") {
502
+ if ($error != NULL) casadi::handle_director_exception();
503
+ }
504
+ #endif //SWIGPYTHON
505
+
506
+
507
+ #ifdef SWIGPYTHON
508
+
509
+ %{
510
+ #define SWIG_FILE_WITH_INIT
511
+ %}
512
+
513
+ #endif // SWIGPYTHON
514
+
515
+ %{
516
+ #define SWIG_Error_return(code, msg) { std::cerr << "Error occured in CasADi SWIG interface code:" << std::endl << " "<< msg << std::endl;SWIG_Error(code, msg); return 0; }
517
+ %}
518
+
519
+ #ifndef SWIGXML
520
+
521
+ // Can be overloaded by specifying before importing casadi.i
522
+ %fragment("casadi_extra_decl", "header") {}
523
+
524
+ %fragment("casadi_decl", "header",fragment="casadi_extra_decl") {
525
+ namespace casadi {
526
+ /* Check if Null or None */
527
+ bool is_null(GUESTOBJECT *p);
528
+
529
+ /* Typemaps from CasADi types to types in the interfaced language:
530
+ *
531
+ * to_ptr: Converts a pointer in interfaced language to C++:
532
+ * Input: GUESTOBJECT pointer p
533
+ * Output: Pointer to pointer: At input, pointer to pointer to temporary
534
+ * The routine will either:
535
+ * - Do nothing, if 0
536
+ * - Change the pointer
537
+ * - Change the temporary object
538
+ * Returns true upon success, else false
539
+ *
540
+ * from_ptr: Converts result from CasADi to interfaced language
541
+ */
542
+
543
+ // Basic types
544
+ bool to_ptr(GUESTOBJECT *p, bool** m);
545
+ GUESTOBJECT* from_ptr(const bool *a);
546
+ bool to_ptr(GUESTOBJECT *p, casadi_int** m);
547
+ GUESTOBJECT* from_ptr(const casadi_int *a);
548
+ bool to_ptr(GUESTOBJECT *p, double** m);
549
+ GUESTOBJECT* from_ptr(const double *a);
550
+ bool to_ptr(GUESTOBJECT *p, std::string** m);
551
+ GUESTOBJECT* from_ptr(const std::string *a);
552
+
553
+ // std::vector
554
+ #ifdef SWIGMATLAB
555
+ bool to_ptr(GUESTOBJECT *p, std::vector<double> **m);
556
+ GUESTOBJECT* from_ptr(const std::vector<double> *a);
557
+ bool to_ptr(GUESTOBJECT *p, std::vector<casadi_int>** m);
558
+ GUESTOBJECT* from_ptr(const std::vector<casadi_int> *a);
559
+ bool to_ptr(GUESTOBJECT *p, const std::vector<bool> **m);
560
+ GUESTOBJECT* from_ptr(const std::vector<bool> *a);
561
+ bool to_ptr(GUESTOBJECT *p, std::vector<std::string>** m);
562
+ GUESTOBJECT* from_ptr(const std::vector<std::string> *a);
563
+ #endif // SWIGMATLAB
564
+ template<typename M> bool to_ptr(GUESTOBJECT *p, std::vector<M>** m);
565
+ template<typename M> bool to_ptr(GUESTOBJECT *p, std::vector< std::vector<M> >** m);
566
+ template<typename M> GUESTOBJECT* from_ptr(const std::vector<M> *a);
567
+
568
+ // std::pair
569
+ #ifdef SWIGMATLAB
570
+ bool to_ptr(GUESTOBJECT *p, std::pair<casadi_int, casadi_int>** m);
571
+ GUESTOBJECT* from_ptr(const std::pair<casadi_int, casadi_int>* a);
572
+ #endif // SWIGMATLAB
573
+ template<typename M1, typename M2> bool to_ptr(GUESTOBJECT *p, std::pair<M1, M2>** m);
574
+ template<typename M1, typename M2> GUESTOBJECT* from_ptr(const std::pair<M1, M2>* a);
575
+
576
+ // std::map
577
+ template<typename M> bool to_ptr(GUESTOBJECT *p, std::map<std::string, M>** m);
578
+ template<typename M> GUESTOBJECT* from_ptr(const std::map<std::string, M> *a);
579
+
580
+ // Slice
581
+ bool to_ptr(GUESTOBJECT *p, casadi::Slice** m);
582
+ GUESTOBJECT* from_ptr(const casadi::Slice *a);
583
+
584
+ // Sparsity
585
+ bool to_ptr(GUESTOBJECT *p, casadi::Sparsity** m);
586
+ GUESTOBJECT* from_ptr(const casadi::Sparsity *a);
587
+
588
+ // Matrix<>
589
+ bool to_ptr(GUESTOBJECT *p, casadi::DM** m);
590
+ GUESTOBJECT* from_ptr(const casadi::DM *a);
591
+ bool to_ptr(GUESTOBJECT *p, casadi::IM** m);
592
+ GUESTOBJECT* from_ptr(const casadi::IM *a);
593
+ bool to_ptr(GUESTOBJECT *p, casadi::SX** m);
594
+ GUESTOBJECT* from_ptr(const casadi::SX *a);
595
+
596
+ // MX
597
+ bool to_ptr(GUESTOBJECT *p, casadi::MX** m);
598
+ GUESTOBJECT* from_ptr(const casadi::MX *a);
599
+
600
+ // Function
601
+ bool to_ptr(GUESTOBJECT *p, casadi::Function** m);
602
+ GUESTOBJECT* from_ptr(const casadi::Function *a);
603
+
604
+ // SXElem
605
+ bool to_ptr(GUESTOBJECT *p, casadi::SXElem** m);
606
+ GUESTOBJECT* from_ptr(const casadi::SXElem *a);
607
+
608
+ // GenericType
609
+ bool to_ptr(GUESTOBJECT *p, casadi::GenericType** m);
610
+ GUESTOBJECT* from_ptr(const casadi::GenericType *a);
611
+
612
+ // Same as to_ptr, but with pointer instead of pointer to pointer
613
+ template<typename M> bool to_val(GUESTOBJECT *p, M* m);
614
+
615
+ // Check if conversion is possible
616
+ template<typename M> bool can_convert(GUESTOBJECT *p) { return to_ptr(p, static_cast<M**>(0));}
617
+
618
+ // Same as the above, but with reference instead of pointer
619
+ template<typename M> GUESTOBJECT* from_ref(const M& m) { return from_ptr(&m);}
620
+
621
+ // Specialization for std::vectors of booleans
622
+ GUESTOBJECT* from_ref(std::vector<bool>::const_reference m) {
623
+ bool tmp = m;
624
+ return from_ptr(&tmp);
625
+ }
626
+
627
+ // Same as the above, but with a temporary object
628
+ template<typename M> GUESTOBJECT* from_tmp(M m) { return from_ptr(&m);}
629
+ #ifdef SWIGMATLAB
630
+ // Get sparsity pattern
631
+ Sparsity get_sparsity(const mxArray* p);
632
+
633
+ // Number of nonzeros
634
+ size_t getNNZ(const mxArray* p);
635
+ #endif // SWIGMATLAB
636
+
637
+ GUESTOBJECT* full(const DM& m, bool simplify=false) {
638
+ #ifdef SWIGPYTHON
639
+ PyObject *p = from_ptr(&m);
640
+ PyObject *method_name = PyString_FromString("toarray");
641
+ PyObject *cr = PyObject_CallMethodObjArgs(p, method_name, (simplify? Py_True: Py_False), 0);
642
+ Py_DECREF(method_name);
643
+ Py_DECREF(p);
644
+ if (cr) return cr;
645
+ return Py_None;
646
+ #elif defined(SWIGMATLAB)
647
+ mxArray *p = mxCreateDoubleMatrix(m.size1(), m.size2(), mxREAL);
648
+ double* d = static_cast<double*>(mxGetData(p));
649
+ casadi_densify(m.ptr(), m.sparsity(), d, false); // Column-major
650
+ return p;
651
+ #else
652
+ return 0;
653
+ #endif
654
+ }
655
+
656
+
657
+ // Convert to a sparse matrix
658
+ GUESTOBJECT* sparse(const DM& m) {
659
+ #ifdef SWIGPYTHON
660
+ PyObject *p = from_ptr(&m);
661
+ PyObject *cr = PyObject_CallMethod(p, (char*) "tocsc", 0);
662
+ Py_DECREF(p);
663
+ if (cr) return cr;
664
+ return Py_None;
665
+ #elif defined(SWIGMATLAB)
666
+ mxArray *p = mxCreateSparse(m.size1(), m.size2(), m.nnz(), mxREAL);
667
+ casadi::casadi_copy(m.ptr(), m.nnz(), static_cast<double*>(mxGetData(p)));
668
+ std::copy(m.colind(), m.colind()+m.size2()+1, mxGetJc(p));
669
+ std::copy(m.row(), m.row()+m.nnz(), mxGetIr(p));
670
+ return p;
671
+ #else
672
+ return 0;
673
+ #endif
674
+
675
+ }
676
+
677
+ GUESTOBJECT* full_or_sparse(const DM& m, bool simplify=false) {
678
+ if (m.is_dense()) {
679
+ return full(m, simplify);
680
+ } else {
681
+ GUESTOBJECT* p = sparse(m);
682
+ if (is_null(p)) return from_ptr(&m);
683
+ return p;
684
+ }
685
+ }
686
+ #ifdef SWIGPYTHON
687
+
688
+
689
+ PyObject* get_Python_helper(const std::string& name) {
690
+ %#if PY_VERSION_HEX < 0x03070000
691
+ PyObject* module = PyImport_AddModule("casadi");
692
+ %#else
693
+ PyObject* c_name = PyString_FromString("casadi");
694
+ PyObject* module = PyImport_GetModule(c_name);
695
+ Py_DECREF(c_name);
696
+ %#endif
697
+ if (!module) {
698
+ if (PyErr_Occurred()) {
699
+ PyErr_Clear();
700
+ }
701
+ }
702
+ PyObject* dict = PyModule_GetDict(module);
703
+ return PyDict_GetItemString(dict, (char*) name.c_str());
704
+ }
705
+
706
+ template<class T>
707
+ bool casadi_object_from_fun(GUESTOBJECT *p, T** m, const std::string& fun, const std::function<bool(PyObject*, T**)> & conv) {
708
+ PyObject* dm = get_Python_helper(fun);
709
+ if (!dm) return false;
710
+ PyObject *check_only = m? Py_False : Py_True;
711
+ PyObject *cr = PyObject_CallFunctionObjArgs(dm, p, check_only, NULL);
712
+ if (!cr) return false;
713
+ bool ret;
714
+ if (PyBool_Check(cr)) {
715
+ ret = PyObject_IsTrue(cr);
716
+ } else {
717
+ ret = conv(cr, m);
718
+ }
719
+ Py_DECREF(cr);
720
+ return ret;
721
+ }
722
+
723
+ bool SX_from_array_conv(GUESTOBJECT *p, casadi::SX** m) {
724
+ std::vector<SXElem> data;
725
+ if (!to_val(PyTuple_GetItem(p, 2), &data)) return false;
726
+ casadi_int nrow; to_val(PyTuple_GetItem(p, 0), &nrow);
727
+ casadi_int ncol; to_val(PyTuple_GetItem(p, 1), &ncol);
728
+ if (m) {
729
+ **m = casadi::SX::zeros(nrow, ncol);
730
+ casadi_densify(get_ptr(data), (**m).sparsity().T(), (**m).ptr(), true);
731
+ }
732
+ return true;
733
+ }
734
+
735
+ bool IM_from_array_conv(GUESTOBJECT *p, casadi::IM** m) {
736
+ if (!m) return true;
737
+ std::vector<casadi_int> data;
738
+ if (!to_val(PyTuple_GetItem(p, 2), &data)) return false;
739
+ casadi_int nrow; to_val(PyTuple_GetItem(p, 0), &nrow);
740
+ casadi_int ncol; to_val(PyTuple_GetItem(p, 1), &ncol);
741
+ **m = IM::zeros(nrow, ncol);
742
+ casadi_densify(get_ptr(data), (**m).sparsity().T(), (**m).ptr(), true);
743
+ return true;
744
+ }
745
+
746
+ bool DM_from_array_conv(GUESTOBJECT *p, casadi::DM** m) {
747
+ if (!m) return true;
748
+ std::vector<double> data;
749
+ if (!to_val(PyTuple_GetItem(p, 2), &data)) return false;
750
+ casadi_int nrow; to_val(PyTuple_GetItem(p, 0), &nrow);
751
+ casadi_int ncol; to_val(PyTuple_GetItem(p, 1), &ncol);
752
+ **m = DM::zeros(nrow, ncol);
753
+ casadi_densify(get_ptr(data), (**m).sparsity().T(), (**m).ptr(), true);
754
+ return true;
755
+ }
756
+
757
+ bool DM_from_csc_conv(GUESTOBJECT *p, casadi::DM** m) {
758
+ std::vector<double> data;
759
+ std::vector<casadi_int> colind, row;
760
+ if (!to_val(PyTuple_GetItem(p, 4), &data)) return false;
761
+ if (!to_val(PyTuple_GetItem(p, 3), &row)) return false;
762
+ if (!to_val(PyTuple_GetItem(p, 2), &colind)) return false;
763
+ casadi_int nrow; to_val(PyTuple_GetItem(p, 0), &nrow);
764
+ casadi_int ncol; to_val(PyTuple_GetItem(p, 1), &ncol);
765
+ **m = casadi::Matrix<double>(casadi::Sparsity(nrow,ncol,colind,row), data, false);
766
+ return true;
767
+ }
768
+
769
+ bool SX_from_array(GUESTOBJECT *p, casadi::SX** m) {
770
+ return casadi_object_from_fun<casadi::SX>(p, m, "SX_from_array", SX_from_array_conv);
771
+ }
772
+
773
+ bool IM_from_array(GUESTOBJECT *p, casadi::IM** m) {
774
+ return casadi_object_from_fun<casadi::IM>(p, m, "IM_from_array", IM_from_array_conv);
775
+ }
776
+
777
+ bool DM_from_array(GUESTOBJECT *p, casadi::DM** m) {
778
+ return casadi_object_from_fun<casadi::DM>(p, m, "DM_from_array", DM_from_array_conv);
779
+ }
780
+
781
+ bool DM_from_csc(GUESTOBJECT *p, casadi::DM** m) {
782
+ return casadi_object_from_fun<casadi::DM>(p, m, "DM_from_csc", DM_from_csc_conv);
783
+ }
784
+
785
+ bool is_scalar_np_array(GUESTOBJECT *p) {
786
+ if (PyObject_HasAttrString(p, "__array__")) {
787
+ PyObject *cr = PyObject_GetAttrString(p, (char*) "size");
788
+ if (cr) {
789
+ casadi_int size;
790
+ casadi_int res = to_val(cr, &size);
791
+ Py_DECREF(cr);
792
+ if (!res) return false;
793
+ return size==1;
794
+ } else {
795
+ PyErr_Clear();
796
+ return false;
797
+ }
798
+ }
799
+ return false;
800
+ }
801
+
802
+ #endif
803
+
804
+
805
+ } // namespace CasADi
806
+ }
807
+
808
+ %fragment("casadi_aux", "header", fragment="casadi_decl") {
809
+ namespace casadi {
810
+ template<typename M> bool to_val(GUESTOBJECT *p, M* m) {
811
+ // Copy the pointer
812
+ M *m2 = m;
813
+ bool ret = to_ptr(p, m ? &m2 : 0);
814
+ // If pointer changed, copy the object
815
+ if (m!=m2) *m=*m2;
816
+ return ret;
817
+ }
818
+
819
+ // Same as to_ptr, but with GenericType
820
+ template<typename M> bool to_generic(GUESTOBJECT *p, GenericType** m) {
821
+ if (m) {
822
+ // Temporary
823
+ M tmp, *tmp_ptr=&tmp;
824
+ bool ret = to_ptr(p, &tmp_ptr);
825
+ if (!ret) return ret;
826
+ **m = GenericType(*tmp_ptr);
827
+ return ret;
828
+ } else {
829
+ return to_ptr(p, static_cast<M**>(0));
830
+ }
831
+ }
832
+
833
+ // Check if casadi_int
834
+ template<typename T> struct is_int {
835
+ static inline bool check() {return false;}
836
+ };
837
+
838
+ template<> struct is_int<casadi_int> {
839
+ static inline bool check() {return true;}
840
+ };
841
+
842
+ bool is_null(GUESTOBJECT *p) {
843
+ #ifdef SWIGPYTHON
844
+ if (p == Py_None) return true;
845
+ #endif
846
+ #ifdef SWIGMATLAB
847
+ if (p == 0) return true;
848
+ #endif
849
+ return false;
850
+ }
851
+
852
+ #ifdef SWIGMATLAB
853
+ Sparsity get_sparsity(const mxArray* p) {
854
+ // Get sparsity pattern
855
+ size_t nrow = mxGetM(p);
856
+ size_t ncol = mxGetN(p);
857
+
858
+ if (mxIsSparse(p)) {
859
+ // Sparse storage in MATLAB
860
+ mwIndex *Jc = mxGetJc(p);
861
+ mwIndex *Ir = mxGetIr(p);
862
+
863
+ // Store in vectors
864
+ std::vector<casadi_int> colind(ncol+1);
865
+ std::copy(Jc, Jc+colind.size(), colind.begin());
866
+ std::vector<casadi_int> row(colind.back());
867
+ std::copy(Ir, Ir+row.size(), row.begin());
868
+
869
+ // Create pattern and return
870
+ return Sparsity(nrow, ncol, colind, row);
871
+ } else {
872
+ return Sparsity::dense(nrow, ncol);
873
+ }
874
+ }
875
+
876
+ size_t getNNZ(const mxArray* p) {
877
+ // Dimensions
878
+ size_t nrow = mxGetM(p);
879
+ size_t ncol = mxGetN(p);
880
+ if (mxIsSparse(p)) {
881
+ // Sparse storage in MATLAB
882
+ mwIndex *Jc = mxGetJc(p);
883
+ return Jc[ncol];
884
+ } else {
885
+ return nrow*ncol;
886
+ }
887
+ }
888
+ #endif // SWIGMATLAB
889
+ } // namespace casadi
890
+ }
891
+
892
+
893
+ %fragment("casadi_bool", "header", fragment="casadi_aux", fragment=SWIG_AsVal_frag(bool)) {
894
+ namespace casadi {
895
+ bool to_ptr(GUESTOBJECT *p, bool** m) {
896
+ // Treat Null
897
+ if (is_null(p)) return false;
898
+
899
+ // Standard typemaps
900
+ if (SWIG_IsOK(SWIG_AsVal(bool)(p, m ? *m : 0))) return true;
901
+
902
+ #ifdef SWIGMATLAB
903
+ if (mxIsLogicalScalar(p)) {
904
+ if (m) **m = mxIsLogicalScalarTrue(p);
905
+ return true;
906
+ }
907
+ #endif
908
+
909
+ // No match
910
+ return false;
911
+ }
912
+
913
+ GUESTOBJECT * from_ptr(const bool *a) {
914
+ #ifdef SWIGPYTHON
915
+ return PyBool_FromLong(*a);
916
+ #elif defined(SWIGMATLAB)
917
+ return mxCreateLogicalScalar(*a);
918
+ #else
919
+ return 0;
920
+ #endif
921
+ }
922
+ } // namespace casadi
923
+ }
924
+
925
+ %fragment("casadi_int", "header", fragment="casadi_aux", fragment=SWIG_AsVal_frag(int), fragment=SWIG_AsVal_frag(long), fragment=SWIG_AsVal_frag(long long)) {
926
+ namespace casadi {
927
+ bool to_ptr(GUESTOBJECT *p, casadi_int** m) {
928
+ // Treat Null
929
+ if (is_null(p)) return false;
930
+
931
+ // long long
932
+ {
933
+ long long tmp;
934
+ if (SWIG_IsOK(SWIG_AsVal(long long)(p, &tmp))) {
935
+ if (m) **m = static_cast<casadi_int>(tmp);
936
+ return true;
937
+ }
938
+ }
939
+
940
+ #ifdef SWIGPYTHON
941
+ if (is_scalar_np_array(p)) {
942
+ PyObject *cr = PyObject_CallMethod(p, (char*) "item", 0);
943
+ if (cr) {
944
+ casadi_int res = to_ptr(cr, m);
945
+ Py_DECREF(cr);
946
+ if (!res) return false;
947
+ return true;
948
+ } else {
949
+ PyErr_Clear();
950
+ return false;
951
+ }
952
+ }
953
+ #endif // SWIGPYTHON
954
+
955
+ bool tmp;
956
+ if (to_val(p, m? &tmp : 0)) {
957
+ if (m) **m = tmp;
958
+ return true;
959
+ }
960
+
961
+ // No match
962
+ return false;
963
+ }
964
+
965
+ GUESTOBJECT * from_ptr(const casadi_int *a) {
966
+ #ifdef SWIGPYTHON
967
+ #ifdef WITH_PYTHON3
968
+ return PyLong_FromLongLong(*a);
969
+ #else
970
+ // For python on Windows
971
+ if (*a > PyInt_GetMax() || *a < -(PyInt_GetMax()-1)) return PyLong_FromLongLong(*a);
972
+ return PyInt_FromLong(*a);
973
+ #endif
974
+
975
+ #elif defined(SWIGMATLAB)
976
+ return mxCreateDoubleScalar(static_cast<double>(*a));
977
+ #else
978
+ return 0;
979
+ #endif
980
+ }
981
+ } // namespace casadi
982
+ }
983
+
984
+ %fragment("casadi_double", "header", fragment="casadi_aux", fragment=SWIG_AsVal_frag(double)) {
985
+ namespace casadi {
986
+ bool to_ptr(GUESTOBJECT *p, double** m) {
987
+ // Treat Null
988
+ if (is_null(p)) return false;
989
+
990
+ // Standard typemaps
991
+ if (SWIG_IsOK(SWIG_AsVal(double)(p, m ? *m : 0))) return true;
992
+
993
+ #ifdef SWIGPYTHON
994
+ if (is_scalar_np_array(p)) {
995
+ PyObject *cr = PyObject_CallMethod(p, (char*) "item", 0);
996
+ if (cr) {
997
+ casadi_int res = to_ptr(cr, m);
998
+ Py_DECREF(cr);
999
+ if (!res) return false;
1000
+ return true;
1001
+ } else {
1002
+ PyErr_Clear();
1003
+ return false;
1004
+ }
1005
+ }
1006
+ #endif // SWIGPYTHON
1007
+
1008
+ casadi_int tmp;
1009
+ if (to_val(p, m? &tmp: 0)) {
1010
+ if (m) **m = tmp;
1011
+ return true;
1012
+ }
1013
+
1014
+ // No match
1015
+ return false;
1016
+ }
1017
+
1018
+ GUESTOBJECT * from_ptr(const double *a) {
1019
+ #ifdef SWIGPYTHON
1020
+ return PyFloat_FromDouble(*a);
1021
+ #elif defined(SWIGMATLAB)
1022
+ return mxCreateDoubleScalar(*a);
1023
+ #else
1024
+ return 0;
1025
+ #endif
1026
+ }
1027
+ } // namespace casadi
1028
+ }
1029
+
1030
+
1031
+ %fragment("casadi_vector", "header", fragment="casadi_aux") {
1032
+ namespace casadi {
1033
+
1034
+ #ifdef SWIGMATLAB
1035
+
1036
+ // Cell array
1037
+ template<typename M> bool to_ptr_cell(GUESTOBJECT *p, std::vector<M>** m) {
1038
+ // Cell arrays (only row vectors)
1039
+ if (mxGetClassID(p)==mxCELL_CLASS) {
1040
+ casadi_int nrow = mxGetM(p), ncol = mxGetN(p);
1041
+ if (nrow==1 || (nrow==0 && ncol==0) || ncol==1) {
1042
+ casadi_int n = (nrow==0 || ncol==0) ? 0 : std::max(nrow, ncol);
1043
+ // Allocate elements
1044
+ if (m) {
1045
+ (**m).clear();
1046
+ (**m).reserve(n);
1047
+ }
1048
+
1049
+ // Temporary
1050
+ M tmp;
1051
+
1052
+ // Loop over elements
1053
+ for (casadi_int i=0; i<n; ++i) {
1054
+ // Get element
1055
+ mxArray* pe = mxGetCell(p, i);
1056
+ if (pe==0) return false;
1057
+
1058
+ // Convert element
1059
+ M *m_i = m ? &tmp : 0;
1060
+ if (!to_ptr(pe, m_i ? &m_i : 0)) {
1061
+ return false;
1062
+ }
1063
+ if (m) (**m).push_back(*m_i);
1064
+ }
1065
+ return true;
1066
+ }
1067
+ }
1068
+ return false;
1069
+ }
1070
+
1071
+ // MATLAB row/column vector maps to std::vector<double>
1072
+ bool to_ptr(GUESTOBJECT *p, std::vector<double> **m) {
1073
+ // Treat Null
1074
+ if (is_null(p)) return false;
1075
+
1076
+ if (mxIsDouble(p) && mxGetNumberOfDimensions(p)==2
1077
+ && (mxGetM(p)<=1 || mxGetN(p)<=1)) {
1078
+ if (m) {
1079
+ double* data = static_cast<double*>(mxGetData(p));
1080
+ casadi_int n = mxGetM(p)*mxGetN(p);
1081
+ (**m).resize(n);
1082
+ std::copy(data, data+n, (**m).begin());
1083
+ }
1084
+ return true;
1085
+ }
1086
+
1087
+ // Cell array
1088
+ if (to_ptr_cell(p, m)) return true;
1089
+
1090
+ // No match
1091
+ return false;
1092
+ }
1093
+
1094
+ bool to_ptr(GUESTOBJECT *p, std::vector<casadi_int>** m) {
1095
+ if (mxIsDouble(p) && mxGetNumberOfDimensions(p)==2
1096
+ && (mxGetM(p)<=1 || mxGetN(p)<=1)) {
1097
+ double* data = static_cast<double*>(mxGetData(p));
1098
+ casadi_int n = mxGetM(p)*mxGetN(p);
1099
+
1100
+ // Check if all integers
1101
+ bool all_integers=true;
1102
+ for (casadi_int i=0; all_integers && i<n; ++i) {
1103
+ if (data[i]!=static_cast<casadi_int>(data[i])) {
1104
+ all_integers = false;
1105
+ break;
1106
+ }
1107
+ }
1108
+
1109
+ // Successful conversion
1110
+ if (all_integers) {
1111
+ if (m) {
1112
+ (**m).resize(n);
1113
+ std::copy(data, data+n, (**m).begin());
1114
+ }
1115
+ return true;
1116
+ }
1117
+ }
1118
+
1119
+ if (mxIsLogical(p) && !mxIsLogicalScalar(p) &&mxGetNumberOfDimensions(p)==2
1120
+ && (mxGetM(p)<=1 || mxGetN(p)<=1) ) {
1121
+ casadi_int n = mxGetM(p)*mxGetN(p);
1122
+ mxLogical* data = static_cast<mxLogical*>(mxGetData(p));
1123
+ if (m) {
1124
+ (**m).resize(n);
1125
+ std::copy(data, data+n, (**m).begin());
1126
+ }
1127
+ return true;
1128
+ }
1129
+
1130
+ // Cell array
1131
+ if (to_ptr_cell(p, m)) return true;
1132
+
1133
+ return false;
1134
+ }
1135
+
1136
+ bool to_ptr(GUESTOBJECT *p, std::vector<bool>** m) {
1137
+ if (mxIsDouble(p) && mxGetNumberOfDimensions(p)==2
1138
+ && (mxGetM(p)<=1 || mxGetN(p)<=1)) {
1139
+ double* data = static_cast<double*>(mxGetData(p));
1140
+ casadi_int n = mxGetM(p)*mxGetN(p);
1141
+
1142
+ // Check if all integers
1143
+ bool all_0_or_1 = true;
1144
+ for (casadi_int i=0; all_0_or_1 && i<n; ++i) {
1145
+ double d = data[i];
1146
+ all_0_or_1 = all_0_or_1 && (d==1 || d==0);
1147
+ }
1148
+
1149
+ // Successful conversion
1150
+ if (all_0_or_1) {
1151
+ if (m) {
1152
+ (**m).resize(n);
1153
+ std::copy(data, data+n, (**m).begin());
1154
+ }
1155
+ return true;
1156
+ }
1157
+ }
1158
+
1159
+ if (mxIsLogical(p) && !mxIsLogicalScalar(p) &&mxGetNumberOfDimensions(p)==2
1160
+ && (mxGetM(p)<=1 || mxGetN(p)<=1) ) {
1161
+ casadi_int n = mxGetM(p)*mxGetN(p);
1162
+ mxLogical* data = static_cast<mxLogical*>(mxGetData(p));
1163
+ if (m) {
1164
+ (**m).resize(n);
1165
+ std::copy(data, data+n, (**m).begin());
1166
+ }
1167
+ return true;
1168
+ }
1169
+
1170
+ // Cell array
1171
+ if (to_ptr_cell(p, m)) return true;
1172
+
1173
+ return false;
1174
+ }
1175
+
1176
+ // MATLAB n-by-m char array mapped to vector of length m
1177
+ bool to_ptr(GUESTOBJECT *p, std::vector<std::string>** m) {
1178
+ if (mxIsChar(p)) {
1179
+ if (m) {
1180
+ // Get data
1181
+ size_t nrow = mxGetM(p);
1182
+ size_t ncol = mxGetN(p);
1183
+ mxChar *data = mxGetChars(p);
1184
+
1185
+ // Allocate space for output
1186
+ (**m).resize(nrow);
1187
+ std::vector<std::string> &m_ref = **m;
1188
+
1189
+ // For all strings
1190
+ for (size_t j=0; j!=nrow; ++j) {
1191
+ // Get length without trailing spaces
1192
+ size_t len = ncol;
1193
+ while (len!=0 && data[j + nrow*(len-1)]==' ') --len;
1194
+
1195
+ // Check if null-terminated
1196
+ for (size_t i=0; i!=len; ++i) {
1197
+ if (data[j + nrow*i]=='\0') {
1198
+ len = i;
1199
+ break;
1200
+ }
1201
+ }
1202
+
1203
+ // Create a string of the desired length
1204
+ m_ref[j] = std::string(len, ' ');
1205
+
1206
+ // Get string content
1207
+ for (size_t i=0; i!=len; ++i) {
1208
+ m_ref[j][i] = data[j + nrow*i];
1209
+ }
1210
+ }
1211
+ }
1212
+ return true;
1213
+ }
1214
+
1215
+ // Cell array
1216
+ if (to_ptr_cell(p, m)) return true;
1217
+
1218
+ // No match
1219
+ return false;
1220
+ }
1221
+ #endif // SWIGMATLAB
1222
+
1223
+ template<typename M> bool to_ptr(GUESTOBJECT *p, std::vector<M>** m) {
1224
+ // Treat Null
1225
+ if (is_null(p)) return false;
1226
+ #ifdef SWIGPYTHON
1227
+
1228
+ // Some built-in types are iterable
1229
+ if (PyDict_Check(p) || PyString_Check(p) || PySet_Check(p) || PyUnicode_Check(p)) return false;
1230
+
1231
+ // Make sure shape is 1D, if defined.
1232
+ if (PyObject_HasAttrString(p, "shape")) {
1233
+ PyObject * shape = PyObject_GetAttrString(p, "shape");
1234
+ if(!PyTuple_Check(shape) || PyTuple_Size(shape)!=1) {
1235
+ Py_DECREF(shape);
1236
+ return false;
1237
+ }
1238
+ }
1239
+
1240
+ // Iterator to the sequence
1241
+ PyObject *it = PyObject_GetIter(p);
1242
+ if (!it) {
1243
+ PyErr_Clear();
1244
+ return false;
1245
+ }
1246
+
1247
+ // Allocate elements
1248
+ if (m) (**m).clear();
1249
+
1250
+ // Temporary
1251
+ M tmp;
1252
+
1253
+ PyObject *pe;
1254
+ // Iterate over sequence
1255
+ while ((pe=PyIter_Next(it))) {
1256
+ // Convert element
1257
+ M *m_i = m ? &tmp : 0;
1258
+ if (!to_ptr(pe, m_i ? &m_i : 0)) {
1259
+ // Failure
1260
+ Py_DECREF(pe);
1261
+ Py_DECREF(it);
1262
+ return false;
1263
+ }
1264
+ if (m) (**m).push_back(*m_i);
1265
+ Py_DECREF(pe);
1266
+ }
1267
+ Py_DECREF(it);
1268
+ return true;
1269
+ #endif // SWIGPYTHON
1270
+ #ifdef SWIGMATLAB
1271
+ // Cell array
1272
+ if (to_ptr_cell(p, m)) return true;
1273
+ #endif // SWIGMATLAB
1274
+ // No match
1275
+ return false;
1276
+ }
1277
+
1278
+ #ifdef SWIGMATLAB
1279
+ GUESTOBJECT* from_ptr(const std::vector<double> *a) {
1280
+ mxArray* ret = mxCreateDoubleMatrix(1, a->size(), mxREAL);
1281
+ std::copy(a->begin(), a->end(), static_cast<double*>(mxGetData(ret)));
1282
+ return ret;
1283
+ }
1284
+ GUESTOBJECT* from_ptr(const std::vector<casadi_int> *a) {
1285
+ mxArray* ret = mxCreateDoubleMatrix(1, a->size(), mxREAL);
1286
+ std::copy(a->begin(), a->end(), static_cast<double*>(mxGetData(ret)));
1287
+ return ret;
1288
+ }
1289
+ GUESTOBJECT* from_ptr(const std::vector<bool> *a) {
1290
+ mxArray* ret = mxCreateLogicalMatrix(1, a->size());
1291
+ std::copy(a->begin(), a->end(), static_cast<bool*>(mxGetData(ret)));
1292
+ return ret;
1293
+ }
1294
+ GUESTOBJECT* from_ptr(const std::vector<std::string> *a) {
1295
+ // Collect arguments as char arrays
1296
+ std::vector<const char*> str(a->size());
1297
+ for (size_t i=0; i<str.size(); ++i) str[i] = (*a)[i].c_str();
1298
+
1299
+ // std::vector<string> maps to MATLAB char array with multiple columns
1300
+ return mxCreateCharMatrixFromStrings(str.size(), str.empty() ? 0 : &str[0]);
1301
+ }
1302
+ #endif // SWIGMATLAB
1303
+
1304
+ template<typename M> GUESTOBJECT* from_ptr(const std::vector<M> *a) {
1305
+ #ifdef SWIGPYTHON
1306
+ // std::vector maps to Python list
1307
+ PyObject* ret = PyList_New(a->size());
1308
+ if (!ret) return 0;
1309
+ for (casadi_int k=0; k<a->size(); ++k) {
1310
+ PyObject* el = from_ref(a->at(k));
1311
+ if (!el) {
1312
+ Py_DECREF(ret);
1313
+ return 0;
1314
+ }
1315
+ PyList_SetItem(ret, k, el);
1316
+ }
1317
+ return ret;
1318
+ #elif defined(SWIGMATLAB)
1319
+ // std::vector maps to MATLAB cell array
1320
+ mxArray* ret = mxCreateCellMatrix(1, a->size());
1321
+ if (!ret) return 0;
1322
+ for (casadi_int k=0; k<a->size(); ++k) {
1323
+ mxArray* el = from_ref(a->at(k));
1324
+ if (!el) return 0;
1325
+ mxSetCell(ret, k, el);
1326
+ }
1327
+ return ret;
1328
+ #else
1329
+ return 0;
1330
+ #endif
1331
+ }
1332
+ } // namespace casadi
1333
+ }
1334
+
1335
+
1336
+ %fragment("casadi_vectorvector", "header", fragment="casadi_aux") {
1337
+ namespace casadi {
1338
+
1339
+ #ifdef SWIGMATLAB
1340
+
1341
+ // Cell array
1342
+ template<typename M> bool to_ptr_cell2(GUESTOBJECT *p, std::vector< std::vector<M> >** m) {
1343
+ // Cell arrays (only row vectors)
1344
+ if (mxGetClassID(p)==mxCELL_CLASS) {
1345
+ casadi_int nrow = mxGetM(p), ncol = mxGetN(p);
1346
+ if (true) {
1347
+ // Allocate elements
1348
+ if (m) {
1349
+ (**m).clear();
1350
+ (**m).resize(nrow, std::vector<M>(ncol));
1351
+ }
1352
+
1353
+ // Temporary
1354
+ M tmp;
1355
+
1356
+ // Loop over elements
1357
+ for (casadi_int i=0; i<nrow*ncol; ++i) {
1358
+ // Get element
1359
+ mxArray* pe = mxGetCell(p, i);
1360
+ if (pe==0) return false;
1361
+
1362
+ // Convert element
1363
+ M *m_i = m ? &tmp : 0;
1364
+ if (!to_ptr(pe, m_i ? &m_i : 0)) {
1365
+ return false;
1366
+ }
1367
+
1368
+ if (m) (**m)[i % nrow][i / nrow] = tmp;
1369
+ }
1370
+ return true;
1371
+ }
1372
+ }
1373
+ return false;
1374
+ }
1375
+
1376
+ #endif // SWIGMATLAB
1377
+
1378
+ template<typename M> bool to_ptr(GUESTOBJECT *p, std::vector< std::vector<M> >** m) {
1379
+ // Treat Null
1380
+ if (is_null(p)) return false;
1381
+
1382
+ // Pass on to to_ptr(GUESTOBJECT *p, std::vector<M>** m)
1383
+ if (to_ptr< std::vector<M> >(p, m)) return true;
1384
+
1385
+ #ifdef SWIGMATLAB
1386
+ // Cell array
1387
+ if (to_ptr_cell2(p, m)) return true;
1388
+ #endif // SWIGMATLAB
1389
+ return false;
1390
+ }
1391
+
1392
+ } // namespace casadi
1393
+ }
1394
+
1395
+ %fragment("casadi_function", "header", fragment="casadi_aux") {
1396
+ namespace casadi {
1397
+ bool to_ptr(GUESTOBJECT *p, Function** m) {
1398
+ // Treat Null
1399
+ if (is_null(p)) return false;
1400
+
1401
+ // Function already?
1402
+ if (SWIG_IsOK(SWIG_ConvertPtr(p, reinterpret_cast<void**>(m),
1403
+ $descriptor(casadi::Function*), 0))) {
1404
+ return true;
1405
+ }
1406
+
1407
+ // No match
1408
+ return false;
1409
+ }
1410
+
1411
+ GUESTOBJECT* from_ptr(const Function *a) {
1412
+ return SWIG_NewPointerObj(new Function(*a), $descriptor(casadi::Function *), SWIG_POINTER_OWN);
1413
+ }
1414
+ } // namespace casadi
1415
+ }
1416
+
1417
+ %fragment("casadi_generictype", "header", fragment="casadi_aux") {
1418
+ namespace casadi {
1419
+ bool to_ptr(GUESTOBJECT *p, GenericType** m) {
1420
+ #ifdef SWIGPYTHON
1421
+ if (p==Py_None) {
1422
+ if (m) **m=GenericType();
1423
+ return true;
1424
+ }
1425
+ #endif // SWIGPYTHON
1426
+
1427
+ // Treat Null
1428
+ if (is_null(p)) return false;
1429
+
1430
+ // GenericType already?
1431
+ if (SWIG_IsOK(SWIG_ConvertPtr(p, reinterpret_cast<void**>(m),
1432
+ $descriptor(casadi::GenericType*), 0))) {
1433
+ return true;
1434
+ }
1435
+
1436
+ // Try to convert to different types
1437
+ if (to_generic<casadi_int>(p, m)
1438
+ || to_generic<double>(p, m)
1439
+ || to_generic<std::string>(p, m)
1440
+ || to_generic<std::vector<casadi_int> >(p, m)
1441
+ || to_generic<std::vector<double> >(p, m)
1442
+ || to_generic<std::vector<bool> >(p, m)
1443
+ || to_generic<std::vector<std::string> >(p, m)
1444
+ || to_generic<std::vector<std::vector<casadi_int> > >(p, m)
1445
+ || to_generic<std::vector<std::vector<double> > >(p, m)
1446
+ || to_generic<casadi::Function>(p, m)
1447
+ || to_generic<std::vector<casadi::Function> >(p, m)
1448
+ || to_generic<casadi::GenericType::Dict>(p, m)) {
1449
+ return true;
1450
+ }
1451
+
1452
+ // Check if it can be converted to boolean (last as e.g. can be converted to boolean)
1453
+ if (to_generic<bool>(p, m)) return true;
1454
+
1455
+ // No match
1456
+ return false;
1457
+ }
1458
+
1459
+ GUESTOBJECT * from_ptr(const GenericType *a) {
1460
+ switch (a->getType()) {
1461
+ case OT_BOOL: return from_tmp(a->as_bool());
1462
+ case OT_INT: return from_tmp(a->as_int());
1463
+ case OT_DOUBLE: return from_tmp(a->as_double());
1464
+ case OT_STRING: return from_tmp(a->as_string());
1465
+ case OT_INTVECTOR: return from_tmp(a->as_int_vector());
1466
+ case OT_INTVECTORVECTOR: return from_tmp(a->as_int_vector_vector());
1467
+ case OT_BOOLVECTOR: return from_tmp(a->as_bool_vector());
1468
+ case OT_DOUBLEVECTOR: return from_tmp(a->as_double_vector());
1469
+ case OT_DOUBLEVECTORVECTOR: return from_tmp(a->as_double_vector_vector());
1470
+ case OT_STRINGVECTOR: return from_tmp(a->as_string_vector());
1471
+ case OT_DICT: return from_tmp(a->as_dict());
1472
+ case OT_FUNCTION: return from_tmp(a->as_function());
1473
+ case OT_FUNCTIONVECTOR: return from_tmp(a->as_function_vector());
1474
+ #ifdef SWIGPYTHON
1475
+ case OT_NULL:
1476
+ case OT_VOIDPTR:
1477
+ return Py_None;
1478
+ #endif // SWIGPYTHON
1479
+ #ifdef SWIGMATLAB
1480
+ case OT_VOIDPTR:
1481
+ return mxCreateDoubleScalar(0);
1482
+ #endif
1483
+ default: return 0;
1484
+ }
1485
+ }
1486
+ } // namespace casadi
1487
+ }
1488
+
1489
+ %fragment("casadi_string", "header", fragment="casadi_aux") {
1490
+ namespace casadi {
1491
+ bool to_ptr(GUESTOBJECT *p, std::string** m) {
1492
+ // Treat Null
1493
+ if (is_null(p)) return false;
1494
+
1495
+ // String already?
1496
+ if (SWIG_IsOK(SWIG_ConvertPtr(p, reinterpret_cast<void**>(m),
1497
+ $descriptor(std::string*), 0))) {
1498
+ return true;
1499
+ }
1500
+
1501
+ #ifdef SWIGPYTHON
1502
+ if (PyString_Check(p) || PyUnicode_Check(p)) {
1503
+ if (m) (*m)->clear();
1504
+ char* my_char = SWIG_Python_str_AsChar(p);
1505
+ if (m) (*m)->append(my_char);
1506
+ SWIG_Python_str_DelForPy3(my_char);
1507
+ return true;
1508
+ }
1509
+ #endif // SWIGPYTHON
1510
+ #ifdef SWIGMATLAB
1511
+ if (mxIsChar(p) && mxGetM(p)<=1) {
1512
+ if (m) {
1513
+ if (mxGetM(p)==0) return true;
1514
+ size_t len=mxGetN(p);
1515
+ std::vector<char> s(len+1);
1516
+ if (mxGetString(p, &s[0], (len+1)*sizeof(char))) return false;
1517
+ **m = std::string(&s[0], len);
1518
+ }
1519
+ return true;
1520
+ }
1521
+ #endif // SWIGMATLAB
1522
+
1523
+ // No match
1524
+ return false;
1525
+ }
1526
+
1527
+ GUESTOBJECT* from_ptr(const std::string *a) {
1528
+ #ifdef SWIGPYTHON
1529
+ return PyString_FromString(a->c_str());
1530
+ #elif defined(SWIGMATLAB)
1531
+ return mxCreateString(a->c_str());
1532
+ #else
1533
+ return 0;
1534
+ #endif
1535
+ }
1536
+ } // namespace casadi
1537
+ }
1538
+
1539
+ %fragment("casadi_slice", "header", fragment="casadi_aux") {
1540
+ namespace casadi {
1541
+ bool to_ptr(GUESTOBJECT *p, Slice** m) {
1542
+ // Treat Null
1543
+ if (is_null(p)) return false;
1544
+
1545
+ // Slice already?
1546
+ if (SWIG_IsOK(SWIG_ConvertPtr(p, reinterpret_cast<void**>(m),
1547
+ $descriptor(casadi::Slice*), 0))) {
1548
+ return true;
1549
+ }
1550
+
1551
+ #ifdef SWIGPYTHON
1552
+
1553
+ // Python casadi_int
1554
+ if (PyInt_Check(p)) {
1555
+ if (m) {
1556
+ (**m).start = PyInt_AsLong(p);
1557
+ (**m).stop = (**m).start+1;
1558
+ if ((**m).stop==0) (**m).stop = std::numeric_limits<casadi_int>::max();
1559
+ }
1560
+ return true;
1561
+ }
1562
+ // Python slice
1563
+ if (PySlice_Check(p)) {
1564
+ PySliceObject *r = (PySliceObject*)(p);
1565
+ if (m) {
1566
+ (**m).start = (r->start == Py_None || PyNumber_AsSsize_t(r->start, NULL) <= std::numeric_limits<int>::min())
1567
+ ? std::numeric_limits<casadi_int>::min() : PyInt_AsLong(r->start);
1568
+ (**m).stop = (r->stop ==Py_None || PyNumber_AsSsize_t(r->stop, NULL)>= std::numeric_limits<int>::max())
1569
+ ? std::numeric_limits<casadi_int>::max() : PyInt_AsLong(r->stop);
1570
+ if(r->step !=Py_None) (**m).step = PyInt_AsLong(r->step);
1571
+ }
1572
+ return true;
1573
+ }
1574
+ #endif // SWIGPYTHON
1575
+
1576
+ // No match
1577
+ return false;
1578
+ }
1579
+
1580
+ GUESTOBJECT* from_ptr(const Slice *a) {
1581
+ return SWIG_NewPointerObj(new Slice(*a), $descriptor(casadi::Slice *), SWIG_POINTER_OWN);
1582
+ }
1583
+
1584
+ } // namespace casadi
1585
+ }
1586
+
1587
+ %fragment("casadi_map", "header", fragment="casadi_aux") {
1588
+ namespace casadi {
1589
+ template<typename M> bool to_ptr(GUESTOBJECT *p, std::map<std::string, M>** m) {
1590
+ #ifdef SWIGPYTHON
1591
+ if (PyDict_Check(p)) {
1592
+ PyObject *key, *value;
1593
+ Py_ssize_t pos = 0;
1594
+ while (PyDict_Next(p, &pos, &key, &value)) {
1595
+ if (!(PyString_Check(key) || PyUnicode_Check(key))) return false;
1596
+ if (m) {
1597
+ char* c_key = SWIG_Python_str_AsChar(key);
1598
+ M *v=&(**m)[std::string(c_key)], *v2=v;
1599
+ SWIG_Python_str_DelForPy3(c_key);
1600
+ if (!casadi::to_ptr(value, &v)) return false;
1601
+ if (v!=v2) *v2=*v; // if only pointer changed
1602
+ } else {
1603
+ if (!casadi::to_ptr(value, static_cast<M**>(0))) return false;
1604
+ }
1605
+ }
1606
+ return true;
1607
+ }
1608
+ #elif defined(SWIGMATLAB)
1609
+ if (mxIsStruct(p) && mxGetM(p)==1 && mxGetN(p)==1) {
1610
+ casadi_int len = mxGetNumberOfFields(p);
1611
+ for (casadi_int k=0; k<len; ++k) {
1612
+ mxArray *value = mxGetFieldByNumber(p, 0, k);
1613
+ if (m) {
1614
+ M *v=&(**m)[std::string(mxGetFieldNameByNumber(p, k))], *v2=v;
1615
+ if (!casadi::to_ptr(value, &v)) return false;
1616
+ if (v!=v2) *v2=*v; // if only pointer changed
1617
+ } else {
1618
+ if (!casadi::to_ptr(value, static_cast<M**>(0))) return false;
1619
+ }
1620
+ }
1621
+ return true;
1622
+ }
1623
+ #endif
1624
+ return false;
1625
+ }
1626
+
1627
+ template<typename M> GUESTOBJECT* from_ptr(const std::map<std::string, M> *a) {
1628
+ #ifdef SWIGPYTHON
1629
+ PyObject *p = PyDict_New();
1630
+ for (typename std::map<std::string, M>::const_iterator it=a->begin(); it!=a->end(); ++it) {
1631
+ PyObject * e = from_ptr(&it->second);
1632
+ if (!e) {
1633
+ Py_DECREF(p);
1634
+ return 0;
1635
+ }
1636
+ PyDict_SetItemString(p, it->first.c_str(), e);
1637
+ Py_DECREF(e);
1638
+ }
1639
+ return p;
1640
+ #elif defined(SWIGMATLAB)
1641
+ // Get vectors of the field names and mxArrays
1642
+ std::vector<const char*> fieldnames;
1643
+ std::vector<mxArray*> fields;
1644
+ for (typename std::map<std::string, M>::const_iterator it=a->begin(); it!=a->end(); ++it) {
1645
+ fieldnames.push_back(it->first.c_str());
1646
+ mxArray* f = from_ptr(&it->second);
1647
+ if (!f) {
1648
+ // Deallocate elements created up to now
1649
+ for (casadi_int k=0; k<fields.size(); ++k) mxDestroyArray(fields[k]);
1650
+ return 0;
1651
+ }
1652
+ fields.push_back(f);
1653
+ }
1654
+
1655
+ // Create return object
1656
+ mxArray *p = mxCreateStructMatrix(1, 1, fields.size(),
1657
+ fieldnames.empty() ? 0 : &fieldnames[0]);
1658
+ for (casadi_int k=0; k<fields.size(); ++k) mxSetFieldByNumber(p, 0, k, fields[k]);
1659
+ return p;
1660
+ #else
1661
+ return 0;
1662
+ #endif
1663
+ }
1664
+ } // namespace casadi
1665
+ }
1666
+
1667
+ %fragment("casadi_pair", "header", fragment="casadi_aux") {
1668
+ namespace casadi {
1669
+ #ifdef SWIGMATLAB
1670
+ bool to_ptr(GUESTOBJECT *p, std::pair<casadi_int, casadi_int>** m) {
1671
+ // (casadi_int,casadi_int) mapped to 2-by-1 double matrix
1672
+ if (mxIsDouble(p) && mxGetNumberOfDimensions(p)==2 && !mxIsSparse(p)
1673
+ && mxGetM(p)==1 && mxGetN(p)==2) {
1674
+ double* data = static_cast<double*>(mxGetData(p));
1675
+ casadi_int first = static_cast<casadi_int>(data[0]);
1676
+ casadi_int second = static_cast<casadi_int>(data[1]);
1677
+ if (data[0]==first && data[1]==second) {
1678
+ if (m) **m = std::make_pair(first, second);
1679
+ return true;
1680
+ } else {
1681
+ return false;
1682
+ }
1683
+ }
1684
+
1685
+ // No match
1686
+ return false;
1687
+ }
1688
+ #endif // SWIGMATLAB
1689
+
1690
+ template<typename M1, typename M2> bool to_ptr(GUESTOBJECT *p, std::pair<M1, M2>** m) {
1691
+ #ifdef SWIGPYTHON
1692
+ if (PyTuple_Check(p) && PyTuple_Size(p)==2) {
1693
+ PyObject *p_first = PyTuple_GetItem(p, 0);
1694
+ PyObject *p_second = PyTuple_GetItem(p, 1);
1695
+ return to_val(p_first, m ? &(**m).first : 0)
1696
+ && to_val(p_second, m ? &(**m).second : 0);
1697
+ }
1698
+ #elif defined(SWIGMATLAB)
1699
+ // Other overloads mapped to 2-by-1 cell array
1700
+ if (mxGetClassID(p)==mxCELL_CLASS && mxGetM(p)==1 && mxGetN(p)==2) {
1701
+ mxArray *p_first = mxGetCell(p, 0);
1702
+ mxArray *p_second = mxGetCell(p, 1);
1703
+ return to_val(p_first, m ? &(**m).first : 0)
1704
+ && to_val(p_second, m ? &(**m).second : 0);
1705
+ }
1706
+ #endif
1707
+ // No match
1708
+ return false;
1709
+ }
1710
+
1711
+ #ifdef SWIGMATLAB
1712
+ GUESTOBJECT* from_ptr(const std::pair<casadi_int, casadi_int>* a) {
1713
+ // (casadi_int,casadi_int) mapped to 2-by-1 double matrix
1714
+ mxArray* ret = mxCreateDoubleMatrix(1, 2, mxREAL);
1715
+ double* data = static_cast<double*>(mxGetData(ret));
1716
+ data[0] = a->first;
1717
+ data[1] = a->second;
1718
+ return ret;
1719
+ }
1720
+ #endif // SWIGMATLAB
1721
+
1722
+ template<typename M1, typename M2> GUESTOBJECT* from_ptr(const std::pair<M1, M2>* a) {
1723
+ #ifdef SWIGPYTHON
1724
+ PyObject* ret = PyTuple_New(2);
1725
+ PyTuple_SetItem(ret, 0, from_ref(a->first));
1726
+ PyTuple_SetItem(ret, 1, from_ref(a->second));
1727
+ return ret;
1728
+ #elif defined(SWIGMATLAB)
1729
+ // Other overloads mapped to 2-by-1 cell array
1730
+ mxArray* ret = mxCreateCellMatrix(1, 2);
1731
+ mxSetCell(ret, 0, from_ref(a->first));
1732
+ mxSetCell(ret, 1, from_ref(a->second));
1733
+ return ret;
1734
+ #else
1735
+ return 0;
1736
+ #endif // SWIGPYTHON
1737
+ }
1738
+ } // namespace casadi
1739
+ }
1740
+
1741
+ %fragment("casadi_sx", "header", fragment="casadi_aux") {
1742
+ namespace casadi {
1743
+ bool to_ptr(GUESTOBJECT *p, SX** m) {
1744
+ // Treat Null
1745
+ if (is_null(p)) return false;
1746
+
1747
+ // SX already?
1748
+ if (SWIG_IsOK(SWIG_ConvertPtr(p, reinterpret_cast<void**>(m),
1749
+ $descriptor(casadi::Matrix<casadi::SXElem>*), 0))) {
1750
+ return true;
1751
+ }
1752
+
1753
+ // Try first converting to a temporary DM
1754
+ {
1755
+ DM tmp;
1756
+ if(to_val(p, m? &tmp: 0)) {
1757
+ if (m) **m = tmp;
1758
+ return true;
1759
+ }
1760
+ }
1761
+
1762
+ #ifdef SWIGPYTHON
1763
+ // Numpy arrays will be cast to dense SX
1764
+ if (SX_from_array(p, m)) return true;
1765
+ // Object has __SX__ method
1766
+ if (PyObject_HasAttrString(p,"__SX__")) {
1767
+ PyObject *cr = PyObject_CallMethod(p, (char*) "__SX__", 0);
1768
+ if (!cr) return false;
1769
+ casadi_int flag = to_ptr(cr, m);
1770
+ Py_DECREF(cr);
1771
+ return flag;
1772
+ }
1773
+ #endif // SWIGPYTHON
1774
+
1775
+ // No match
1776
+ return false;
1777
+ }
1778
+
1779
+ GUESTOBJECT* from_ptr(const SX *a) {
1780
+ return SWIG_NewPointerObj(new SX(*a), $descriptor(casadi::Matrix<casadi::SXElem> *), SWIG_POINTER_OWN);
1781
+ }
1782
+ } // namespace casadi
1783
+ }
1784
+
1785
+ %fragment("casadi_sxelem", "header", fragment="casadi_aux") {
1786
+ namespace casadi {
1787
+ bool to_ptr(GUESTOBJECT *p, SXElem** m) {
1788
+ // Treat Null
1789
+ if (is_null(p)) return false;
1790
+
1791
+ // Try first converting to a temporary SX
1792
+ {
1793
+ SX tmp, *mt=&tmp;
1794
+ if(casadi::to_ptr(p, m ? &mt : 0)) {
1795
+ if (m && !mt->is_scalar()) return false;
1796
+ if (m) **m = mt->scalar();
1797
+ return true;
1798
+ }
1799
+ }
1800
+
1801
+ // No match
1802
+ return false;
1803
+ }
1804
+
1805
+ GUESTOBJECT* from_ptr(const SXElem *a) {
1806
+ return from_ref(SX(*a));
1807
+ }
1808
+ } // namespace casadi
1809
+ }
1810
+
1811
+ %fragment("casadi_mx", "header", fragment="casadi_decl") {
1812
+ namespace casadi {
1813
+ bool to_ptr(GUESTOBJECT *p, MX** m) {
1814
+ // Treat Null
1815
+ if (is_null(p)) return false;
1816
+
1817
+ // MX already?
1818
+ if (SWIG_IsOK(SWIG_ConvertPtr(p, reinterpret_cast<void**>(m),
1819
+ $descriptor(casadi::MX*), 0))) {
1820
+ return true;
1821
+ }
1822
+
1823
+ // Try first converting to a temporary DM
1824
+ {
1825
+ DM tmp;
1826
+ if(to_val(p, m ? &tmp : 0)) {
1827
+ if (m) **m = tmp;
1828
+ return true;
1829
+ }
1830
+ }
1831
+
1832
+ #ifdef SWIGPYTHON
1833
+ if (PyObject_HasAttrString(p,"__MX__")) {
1834
+ PyObject *cr = PyObject_CallMethod(p, (char*) "__MX__", 0);
1835
+ if (!cr) return false;
1836
+ casadi_int flag = to_ptr(cr, m);
1837
+ Py_DECREF(cr);
1838
+ return flag;
1839
+ }
1840
+ #endif // SWIGPYTHON
1841
+
1842
+ // No match
1843
+ return false;
1844
+ }
1845
+
1846
+ GUESTOBJECT* from_ptr(const MX *a) {
1847
+ return SWIG_NewPointerObj(new MX(*a), $descriptor(casadi::MX*), SWIG_POINTER_OWN);
1848
+ }
1849
+ } // namespace casadi
1850
+ }
1851
+
1852
+ %fragment("casadi_dmatrix", "header", fragment="casadi_aux") {
1853
+ namespace casadi {
1854
+ #ifdef SWIGPYTHON
1855
+ /** Check PyObjects by class name */
1856
+ bool PyObjectHasClassName(PyObject* p, const char * name) {
1857
+ PyObject * classo = PyObject_GetAttrString( p, "__class__");
1858
+ PyObject * classname = PyObject_GetAttrString( classo, "__name__");
1859
+
1860
+ char* c_classname = SWIG_Python_str_AsChar(classname);
1861
+ bool ret = strcmp(c_classname, name)==0;
1862
+
1863
+ Py_DECREF(classo);Py_DECREF(classname);
1864
+ SWIG_Python_str_DelForPy3(c_classname);
1865
+ return ret;
1866
+ }
1867
+ #endif // SWIGPYTHON
1868
+
1869
+ bool to_ptr(GUESTOBJECT *p, DM** m) {
1870
+ // Treat Null
1871
+ if (is_null(p)) return false;
1872
+
1873
+ // DM already?
1874
+ if (SWIG_IsOK(SWIG_ConvertPtr(p, reinterpret_cast<void**>(m),
1875
+ $descriptor(casadi::Matrix<double>*), 0))) {
1876
+ return true;
1877
+ }
1878
+
1879
+ // Object is a sparsity pattern
1880
+ {
1881
+ Sparsity *m2;
1882
+ if (SWIG_IsOK(SWIG_ConvertPtr(p, reinterpret_cast<void**>(&m2),
1883
+ $descriptor(casadi::Sparsity*), 0))) {
1884
+ if (m) **m=DM::ones(*m2);
1885
+ return true;
1886
+ }
1887
+ }
1888
+
1889
+ // Double scalar
1890
+ {
1891
+ double tmp;
1892
+ if (to_val(p, m? &tmp: 0)) {
1893
+ if (m) **m=tmp;
1894
+ return true;
1895
+ }
1896
+ }
1897
+
1898
+ #ifdef SWIGPYTHON
1899
+ // Object has __DM__ method
1900
+ if (PyObject_HasAttrString(p,"__DM__")) {
1901
+ char name[] = "__DM__";
1902
+ PyObject *cr = PyObject_CallMethod(p, name, 0);
1903
+ if (!cr) return false;
1904
+ casadi_int result = to_val(cr, m ? *m : 0);
1905
+ Py_DECREF(cr);
1906
+ return result;
1907
+ }
1908
+
1909
+ if (DM_from_array(p, m)) return true;
1910
+
1911
+ if (DM_from_csc(p,m)) return true;
1912
+
1913
+ {
1914
+ std::vector <double> t;
1915
+ casadi_int res = to_val(p, &t);
1916
+ if (t.size()>0) {
1917
+ if (m) **m = casadi::Matrix<double>(t);
1918
+ } else {
1919
+ if (m) **m = casadi::Matrix<double>(0,0);
1920
+ }
1921
+ return res;
1922
+ }
1923
+ #endif // SWIGPYTHON
1924
+ #ifdef SWIGMATLAB
1925
+ // MATLAB double matrix (sparse or dense)
1926
+ if (mxIsDouble(p) && mxGetNumberOfDimensions(p)==2) {
1927
+ if (m) {
1928
+ **m = casadi::DM(get_sparsity(p));
1929
+ double* data = static_cast<double*>(mxGetData(p));
1930
+ casadi_copy(data, (*m)->nnz(), (*m)->ptr());
1931
+ }
1932
+ return true;
1933
+ }
1934
+ #endif // SWIGMATLAB
1935
+
1936
+ // No match
1937
+ return false;
1938
+ }
1939
+
1940
+ GUESTOBJECT* from_ptr(const DM *a) {
1941
+ return SWIG_NewPointerObj(new DM(*a), $descriptor(casadi::Matrix<double>*), SWIG_POINTER_OWN);
1942
+ }
1943
+ } // namespace casadi
1944
+ }
1945
+
1946
+ %fragment("casadi_sparsity", "header", fragment="casadi_aux") {
1947
+ namespace casadi {
1948
+ bool to_ptr(GUESTOBJECT *p, Sparsity** m) {
1949
+ // Treat Null
1950
+ if (is_null(p)) return false;
1951
+
1952
+ // Sparsity already?
1953
+ if (SWIG_IsOK(SWIG_ConvertPtr(p, reinterpret_cast<void**>(m),
1954
+ $descriptor(casadi::Sparsity*), 0))) {
1955
+ return true;
1956
+ }
1957
+
1958
+ // No match
1959
+ return false;
1960
+ }
1961
+
1962
+ GUESTOBJECT* from_ptr(const Sparsity *a) {
1963
+ return SWIG_NewPointerObj(new Sparsity(*a), $descriptor(casadi::Sparsity*), SWIG_POINTER_OWN);
1964
+ }
1965
+ } // namespace casadi
1966
+ }
1967
+
1968
+ %fragment("casadi_imatrix", "header", fragment="casadi_aux", fragment=SWIG_AsVal_frag(int)) {
1969
+ namespace casadi {
1970
+ bool to_ptr(GUESTOBJECT *p, IM** m) {
1971
+ // Treat Null
1972
+ if (is_null(p)) return false;
1973
+
1974
+ // Object is a sparsity pattern
1975
+ {
1976
+ Sparsity *m2;
1977
+ if (SWIG_IsOK(SWIG_ConvertPtr(p, reinterpret_cast<void**>(&m2),
1978
+ $descriptor(casadi::Sparsity*), 0))) {
1979
+ if (m) **m=IM::ones(*m2);
1980
+ return true;
1981
+ }
1982
+ }
1983
+
1984
+ // First convert to integer
1985
+ {
1986
+ casadi_int tmp;
1987
+ if (to_val(p, m? &tmp: 0)) {
1988
+ if (m) **m=tmp;
1989
+ return true;
1990
+ }
1991
+ }
1992
+
1993
+ #ifdef SWIGPYTHON
1994
+ // Numpy arrays will be cast to dense Matrix<casadi_int>
1995
+ if (IM_from_array(p, m)) return true;
1996
+
1997
+ if (PyObject_HasAttrString(p,"__IM__")) {
1998
+ PyObject *cr = PyObject_CallMethod(p, (char*) "__IM__", 0);
1999
+ if (!cr) return false;
2000
+ casadi_int result = to_val(cr, m ? *m : 0);
2001
+ Py_DECREF(cr);
2002
+ return result;
2003
+ }
2004
+
2005
+ {
2006
+ std::vector <casadi_int> t;
2007
+ if (to_val(p, &t)) {
2008
+ if (m) **m = casadi::Matrix<casadi_int>(t);
2009
+ return true;
2010
+ }
2011
+ }
2012
+ #endif // SWIGPYTHON
2013
+
2014
+ #ifdef SWIGMATLAB
2015
+ // In MATLAB, it is common to use floating point values to represent integers
2016
+ if (mxIsDouble(p) && mxGetNumberOfDimensions(p)==2) {
2017
+ double* data = static_cast<double*>(mxGetData(p));
2018
+
2019
+ // Check if all integers
2020
+ bool all_integers=true;
2021
+ size_t sz = getNNZ(p);
2022
+ for (size_t i=0; i<sz; ++i) {
2023
+ if (data[i] != casadi_int(data[i])) {
2024
+ all_integers = false;
2025
+ break;
2026
+ }
2027
+ }
2028
+
2029
+ // If successful
2030
+ if (all_integers) {
2031
+ if (m) {
2032
+ **m = casadi::IM(get_sparsity(p));
2033
+ for (size_t i=0; i<sz; ++i) {
2034
+ (**m)->at(i) = casadi_int(data[i]);
2035
+ }
2036
+ }
2037
+ return true;
2038
+ }
2039
+ }
2040
+ #endif // SWIGMATLAB
2041
+
2042
+ // Convert from DM
2043
+ {
2044
+ DM tmp;
2045
+ if (to_val(p, m? &tmp: 0)) {
2046
+ // Check integrality
2047
+ for (double d : tmp.nonzeros()) {
2048
+ if (d!=casadi_int(d)) return false;
2049
+ }
2050
+ // Convert
2051
+ if (m) {
2052
+ **m = casadi::Matrix<double>(tmp);
2053
+ }
2054
+ return true;
2055
+ }
2056
+ }
2057
+
2058
+ // No match
2059
+ return false;
2060
+ }
2061
+ GUESTOBJECT* from_ptr(const IM *a) {
2062
+ DM tmp(*a);
2063
+ return from_ref(tmp);
2064
+ }
2065
+
2066
+ } // namespace casadi
2067
+ }
2068
+
2069
+ // Can be overloaded by specifying before importing casadi.i
2070
+ %fragment("casadi_extra", "header") {}
2071
+
2072
+ // Collect all fragments
2073
+ %fragment("casadi_all", "header", fragment="casadi_aux,casadi_extra,casadi_bool,casadi_int,casadi_double,casadi_vector,casadi_vectorvector,casadi_function,casadi_generictype,casadi_string,casadi_slice,casadi_map,casadi_pair,casadi_sx,casadi_sxelem,casadi_mx,casadi_dmatrix,casadi_sparsity,casadi_imatrix") { }
2074
+
2075
+ #endif // SWIGXML
2076
+
2077
+ // Define all input typemaps
2078
+ %define %casadi_input_typemaps(xName, xPrec, xType...)
2079
+ // Pass input by value, check if matches
2080
+ %typemap(typecheck, noblock=1, precedence=xPrec, fragment="casadi_all") xType {
2081
+ $1 = casadi::to_ptr($input, static_cast< xType **>(0));
2082
+ }
2083
+
2084
+ // Directorout typemap; as input by value
2085
+ %typemap(directorout, noblock=1, fragment="casadi_all") xType {
2086
+ if (!casadi::to_val($input, &$result)) {
2087
+ %dirout_fail(SWIG_TypeError,"$type");
2088
+ }
2089
+ }
2090
+
2091
+ // Pass input by value, convert argument
2092
+ %typemap(in, doc=xName, noblock=1, fragment="casadi_all") xType {
2093
+ if (!casadi::to_val($input, &$1)) SWIG_exception_fail(SWIG_TypeError,"Failed to convert input $argnum to type '" xName "'.");
2094
+ }
2095
+
2096
+ // Pass input by value, cleanup
2097
+ %typemap(freearg, noblock=1) xType {}
2098
+
2099
+ // Pass input by reference, check if matches
2100
+ %typemap(typecheck, noblock=1, precedence=xPrec, fragment="casadi_all") const xType& {
2101
+ $1 = casadi::to_ptr($input, static_cast< xType **>(0));
2102
+ }
2103
+
2104
+ // Pass input by reference, convert argument
2105
+ %typemap(in, doc=xName, noblock=1, fragment="casadi_all") const xType & (xType m) {
2106
+ $1 = &m;
2107
+ if (!casadi::to_ptr($input, &$1)) SWIG_exception_fail(SWIG_TypeError,"Failed to convert input $argnum to type '" xName "'.");
2108
+ }
2109
+
2110
+ // Pass input by reference, cleanup
2111
+ %typemap(freearg, noblock=1) const xType & {}
2112
+
2113
+ %enddef
2114
+
2115
+ // Define all output typemaps
2116
+ %define %casadi_output_typemaps(xName, xType...)
2117
+
2118
+ // Return-by-value
2119
+ %typemap(out, doc=xName, noblock=1, fragment="casadi_all") xType, const xType {
2120
+ if(!($result = casadi::from_ref($1))) SWIG_exception_fail(SWIG_TypeError,"Failed to convert output to type '" xName "'.");
2121
+ }
2122
+
2123
+ // Return a const-ref behaves like return-by-value
2124
+ %typemap(out, doc=xName, noblock=1, fragment="casadi_all") const xType& {
2125
+ if(!($result = casadi::from_ptr($1))) SWIG_exception_fail(SWIG_TypeError,"Failed to convert output to type '" xName "'.");
2126
+ }
2127
+
2128
+ // Inputs marked OUTPUT are also returned by the function, ...
2129
+ %typemap(argout, noblock=1,fragment="casadi_all") xType &OUTPUT {
2130
+ %append_output(casadi::from_ptr($1));
2131
+ }
2132
+
2133
+ // ... and the corresponding inputs are ignored
2134
+ %typemap(in, doc=xName, noblock=1, numinputs=0) xType &OUTPUT (xType m) {
2135
+ $1 = &m;
2136
+ }
2137
+
2138
+ // Directorin typemap; as output
2139
+ %typemap(directorin, noblock=1, fragment="casadi_all") xType, const xType {
2140
+ if(!($input = casadi::from_ref($1))) %dirout_fail(SWIG_TypeError,"For director inputs, failed to convert input to " xName ".");
2141
+ }
2142
+
2143
+ // Directorin typemap; as output
2144
+ %typemap(directorin, noblock=1, fragment="casadi_all") const xType& {
2145
+ if(!($input = casadi::from_ptr(&$1))) %dirout_fail(SWIG_TypeError,"For director inputs, failed to convert input to " xName ".");
2146
+ }
2147
+
2148
+ // Enable dynamic dispatch
2149
+ %typemap(typecheck, noblock=1, fragment="casadi_all") xType &OUTPUT {
2150
+ $1 = casadi::to_ptr($input, static_cast< xType **>(0));
2151
+ }
2152
+
2153
+ // Alternative names
2154
+ %apply xType &OUTPUT {xType &OUTPUT1};
2155
+ %apply xType &OUTPUT {xType &OUTPUT2};
2156
+ %apply xType &OUTPUT {xType &OUTPUT3};
2157
+ %apply xType &OUTPUT {xType &OUTPUT4};
2158
+ %apply xType &OUTPUT {xType &OUTPUT5};
2159
+ %apply xType &OUTPUT {xType &OUTPUT6};
2160
+
2161
+ // Inputs marked INOUT are also returned by the function, ...
2162
+ %typemap(argout,noblock=1,fragment="casadi_all") xType &INOUT {
2163
+ %append_output(casadi::from_ptr($1));
2164
+ }
2165
+
2166
+ // ... but kept as inputs
2167
+ %typemap(in, doc=xName, noblock=1, fragment="casadi_all") xType &INOUT (xType m) {
2168
+ $1 = &m;
2169
+ if (!casadi::to_ptr($input, &$1)) SWIG_exception_fail(SWIG_TypeError,"Failed to convert input to type '" xName "'.");
2170
+ }
2171
+
2172
+ // ... also for dynamic dispatch
2173
+ %typemap(typecheck, noblock=1, fragment="casadi_all") xType& INOUT {
2174
+ $1 = casadi::to_ptr($input, static_cast< xType **>(0));
2175
+ }
2176
+
2177
+ // No arguments need to be freed
2178
+ %typemap(freearg, noblock=1) xType& INOUT {}
2179
+
2180
+ // Alternative names
2181
+ %apply xType &INOUT {xType &INOUT1};
2182
+ %apply xType &INOUT {xType &INOUT2};
2183
+ %apply xType &INOUT {xType &INOUT3};
2184
+ %apply xType &INOUT {xType &INOUT4};
2185
+ %apply xType &INOUT {xType &INOUT5};
2186
+ %apply xType &INOUT {xType &INOUT6};
2187
+
2188
+ %enddef
2189
+
2190
+ // Define all typemaps for a template instantiation without proxy classes
2191
+ %define %casadi_template(xName, xPrec, xType...)
2192
+ %template() xType;
2193
+ %casadi_input_typemaps(xName, xPrec, xType)
2194
+ %casadi_output_typemaps(xName, %arg(xType))
2195
+ %enddef
2196
+
2197
+ // Define all input and ouput typemaps
2198
+ %define %casadi_typemaps(xName, xPrec, xType...)
2199
+ %casadi_input_typemaps(xName, xPrec, xType)
2200
+ %casadi_output_typemaps(xName, xType)
2201
+ %enddef
2202
+
2203
+ // Order in typemap matching: Lower value means will be checked first
2204
+
2205
+ %define PREC_DICT 21 %enddef
2206
+ %define PREC_SPARSITY 90 %enddef
2207
+ %define PREC_IVector 92 %enddef
2208
+ %define PREC_IVectorVector 92 %enddef
2209
+ %define PREC_VECTOR 92 %enddef
2210
+ %define PREC_PAIR_SLICE_SLICE 93 %enddef
2211
+ %define PREC_SLICE 94 %enddef
2212
+ %define PREC_PAIR_IVector_IVector 96 %enddef
2213
+ %define PREC_IM 97 %enddef
2214
+ %define PREC_DVector 99 %enddef
2215
+ %define PREC_DM 100 %enddef
2216
+ %define PREC_DMVector 101 %enddef
2217
+ %define PREC_DMVectorVector 101 %enddef
2218
+ %define PREC_SX 103 %enddef
2219
+ %define PREC_SXVector 103 %enddef
2220
+ %define PREC_SXVectorVector 103 %enddef
2221
+ %define PREC_MX 104 %enddef
2222
+ %define PREC_MXVector 105 %enddef
2223
+ %define PREC_MXVectorVector 106 %enddef
2224
+ %define PREC_CREATOR 150 %enddef
2225
+ %define PREC_STRING 180 %enddef
2226
+ %define PREC_FUNCTION 200 %enddef
2227
+ %define PREC_GENERICTYPE 201 %enddef
2228
+
2229
+ #ifndef SWIGXML
2230
+
2231
+ // std::ostream & is redirected to casadi::uout()
2232
+ %typemap(in, noblock=1, numinputs=0) std::ostream &stream {
2233
+ $1 = &casadi::uout();
2234
+ }
2235
+
2236
+ // Add trailing newline in MATLAB and Octave
2237
+ #if defined(SWIGMATLAB) || defined(SWIGOCTAVE)
2238
+ %typemap(argout, noblock=1) std::ostream &stream {
2239
+ *$1 << "\n" << std::flush;
2240
+ }
2241
+ #endif
2242
+
2243
+ #define L_INT "int"
2244
+ #define L_BOOL "bool"
2245
+ #define LPAIR(A,B) "(" A "," B ")"
2246
+
2247
+ #if defined(SWIGMATLAB) || defined(SWIGOCTAVE)
2248
+ #define L_DOUBLE "double"
2249
+ #define L_DICT "struct"
2250
+ #define LDICT(ARG) L_DICT ":" ARG
2251
+ #define LL "{"
2252
+ #define LR "}"
2253
+ #define L_STR "char"
2254
+ #define MATLABSTYLE
2255
+ #else
2256
+ #define LL "["
2257
+ #define LR "]"
2258
+ #define L_DICT "dict"
2259
+ #define L_DOUBLE "float"
2260
+ #define LDICT(ARG) L_DICT ":" ARG
2261
+ #define L_STR "str"
2262
+ #endif
2263
+
2264
+ #ifdef SWIGPYTHON
2265
+ %typemap(in, doc="memoryview(ro)", noblock=1, fragment="casadi_all") (const double * a, casadi_int size) (Py_buffer* buffer) {
2266
+ if (!PyMemoryView_Check($input)) SWIG_exception_fail(SWIG_TypeError, "Must supply a MemoryView.");
2267
+ buffer = PyMemoryView_GET_BUFFER($input);
2268
+ $1 = static_cast<double*>(buffer->buf); // const double cast comes later
2269
+ $2 = buffer->len;
2270
+ }
2271
+
2272
+ %typemap(in, doc="memoryview(rw)", noblock=1, fragment="casadi_all") (double * a, casadi_int size) (Py_buffer* buffer) {
2273
+ if (!PyMemoryView_Check($input)) SWIG_exception_fail(SWIG_TypeError, "Must supply a writable MemoryView.");
2274
+ buffer = PyMemoryView_GET_BUFFER($input);
2275
+ if (buffer->readonly) SWIG_exception_fail(SWIG_TypeError, "Must supply a writable MemoryView.");
2276
+ $1 = static_cast<double*>(buffer->buf);
2277
+ $2 = buffer->len;
2278
+ }
2279
+
2280
+ // Directorin typemap; as output
2281
+ %typemap(directorin, noblock=1, fragment="casadi_all") (const double** arg, const std::vector<casadi_int>& sizes_arg) (PyObject* my_tuple) {
2282
+ PyObject * arg_tuple = PyTuple_New($2.size());
2283
+ for (casadi_int i=0;i<$2.size();++i) {
2284
+
2285
+ #ifdef WITH_PYTHON3
2286
+ PyObject* buf = $1[i] ? PyMemoryView_FromMemory(reinterpret_cast<char*>(const_cast<double*>($1[i])), $2[i]*sizeof(double), PyBUF_READ) : SWIG_Py_Void();
2287
+ #else
2288
+ PyObject* buf = $1[i] ? PyBuffer_FromMemory(const_cast<double*>($1[i]), $2[i]*sizeof(double)) : SWIG_Py_Void();
2289
+ #endif
2290
+ PyTuple_SET_ITEM(arg_tuple, i, buf);
2291
+ }
2292
+ $input = arg_tuple;
2293
+ }
2294
+
2295
+ %typemap(directorin, noblock=1, fragment="casadi_all") (double** res, const std::vector<casadi_int>& sizes_res) {
2296
+ PyObject* res_tuple = PyTuple_New($2.size());
2297
+ for (casadi_int i=0;i<$2.size();++i) {
2298
+ #ifdef WITH_PYTHON3
2299
+ PyObject* buf = $1[i] ? PyMemoryView_FromMemory(reinterpret_cast<char*>(const_cast<double*>($1[i])), $2[i]*sizeof(double), PyBUF_WRITE) : SWIG_Py_Void();
2300
+ #else
2301
+ PyObject* buf = $1[i] ? PyBuffer_FromReadWriteMemory($1[i], $2[i]*sizeof(double)) : SWIG_Py_Void();
2302
+ #endif
2303
+ PyTuple_SET_ITEM(res_tuple, i, buf);
2304
+ }
2305
+ $input = res_tuple;
2306
+ }
2307
+
2308
+ %typemap(in, doc="void*", noblock=1, fragment="casadi_all") void* raw {
2309
+ $1 = PyCapsule_GetPointer($input, NULL);
2310
+ }
2311
+
2312
+ %typemap(out, doc="void*", noblock=1, fragment="casadi_all") void* {
2313
+ $result = PyCapsule_New($1, NULL,NULL);
2314
+ }
2315
+ #endif
2316
+
2317
+ %casadi_typemaps(L_STR, PREC_STRING, std::string)
2318
+ %casadi_template(LL L_STR LR, PREC_VECTOR, std::vector<std::string>)
2319
+ %casadi_template(LL LL L_STR LR LR, PREC_VECTOR, std::vector<std::vector<std::string> >)
2320
+ %casadi_typemaps("Sparsity", PREC_SPARSITY, casadi::Sparsity)
2321
+ %casadi_template(LL "Sparsity" LR, PREC_SPARSITY, std::vector< casadi::Sparsity>)
2322
+ %casadi_template(LL LL "Sparsity" LR LR, PREC_SPARSITY, std::vector<std::vector< casadi::Sparsity> >)
2323
+ %casadi_template(LDICT("Sparsity"), PREC_SPARSITY, std::map<std::string, casadi::Sparsity >)
2324
+ %casadi_template(LDICT(LL "Sparsity" LR), PREC_SPARSITY, std::map<std::string, std::vector<casadi::Sparsity > >)
2325
+ %casadi_template(LPAIR(LDICT("Sparsity"),"[" L_STR "]"), PREC_SPARSITY, std::pair<std::map<std::string, casadi::Sparsity >, std::vector<std::string> >)
2326
+ %casadi_typemaps(L_BOOL, SWIG_TYPECHECK_BOOL, bool)
2327
+ %casadi_template("[" L_BOOL "]", SWIG_TYPECHECK_BOOL, std::vector<bool>)
2328
+ %casadi_template("[[" L_BOOL "]]", SWIG_TYPECHECK_BOOL, std::vector<std::vector<bool> >)
2329
+ %casadi_typemaps( L_INT , SWIG_TYPECHECK_INTEGER, casadi_int)
2330
+
2331
+ #ifdef MATLABSTYLE
2332
+ #define LABEL "[int,int]"
2333
+ #else
2334
+ #define LABEL LPAIR("int","int")
2335
+ #endif
2336
+ %casadi_template(LABEL, SWIG_TYPECHECK_INTEGER, std::pair<casadi_int,casadi_int>)
2337
+ #undef LABEL
2338
+ %casadi_template("[" L_INT "]", PREC_IVector, std::vector<casadi_int>)
2339
+ %casadi_template(LL "[" L_INT "]" LR, PREC_IVectorVector, std::vector<std::vector<casadi_int> >)
2340
+ %casadi_typemaps(L_DOUBLE, SWIG_TYPECHECK_DOUBLE, double)
2341
+ %casadi_template("[" L_DOUBLE "]", SWIG_TYPECHECK_DOUBLE, std::vector<double>)
2342
+ %casadi_template(LL "[" L_DOUBLE "]" LR, SWIG_TYPECHECK_DOUBLE, std::vector<std::vector<double> >)
2343
+ %casadi_typemaps("SXElem", PREC_SX, casadi::SXElem)
2344
+ %casadi_template(LL "SXElem" LR, PREC_SXVector, std::vector<casadi::SXElem>)
2345
+ %casadi_typemaps("SX", PREC_SX, casadi::Matrix<casadi::SXElem>)
2346
+ %casadi_template(LL "SX" LR, PREC_SXVector, std::vector< casadi::Matrix<casadi::SXElem> >)
2347
+ %casadi_template(LL LL "SX" LR LR, PREC_SXVectorVector, std::vector<std::vector< casadi::Matrix<casadi::SXElem> > >)
2348
+ %casadi_template(LDICT("SX"), PREC_SX, std::map<std::string, casadi::Matrix<casadi::SXElem> >)
2349
+ %casadi_typemaps("MX", PREC_MX, casadi::MX)
2350
+ %casadi_template(LL "MX" LR, PREC_MXVector, std::vector<casadi::MX>)
2351
+ %casadi_template(LL LL "MX" LR LR, PREC_MXVectorVector, std::vector<std::vector<casadi::MX> >)
2352
+ %casadi_template(LDICT("MX"), PREC_MX, std::map<std::string, casadi::MX>)
2353
+ %casadi_template(LPAIR("MX","MX"), PREC_MXVector, std::pair<casadi::MX, casadi::MX>)
2354
+ %casadi_typemaps("DM", PREC_DM, casadi::Matrix<double>)
2355
+ %casadi_template(LL "DM" LR, PREC_DMVector, std::vector< casadi::Matrix<double> >)
2356
+ %casadi_template(LL LL "DM" LR LR, PREC_DMVectorVector, std::vector<std::vector< casadi::Matrix<double> > >)
2357
+ %casadi_template(LDICT("DM"), PREC_DM, std::map<std::string, casadi::Matrix<double> >)
2358
+ %casadi_typemaps("IM", PREC_IM, casadi::Matrix<casadi_int>)
2359
+ // Without CASADI_INT_TYPE, you get SwigValueWrapper
2360
+ // With it, docstrings are screwed
2361
+ %casadi_typemaps("GenericType", PREC_GENERICTYPE, casadi::GenericType)
2362
+ %casadi_template(LL "GenericType" LR, PREC_GENERICTYPE, std::vector<casadi::GenericType>)
2363
+ %casadi_typemaps("Slice", PREC_SLICE, casadi::Slice)
2364
+ %casadi_typemaps("Function", PREC_FUNCTION, casadi::Function)
2365
+ %casadi_template(LL "Function" LR, PREC_FUNCTION, std::vector<casadi::Function>)
2366
+ %casadi_template(LPAIR("Function","Function"), PREC_FUNCTION, std::pair<casadi::Function, casadi::Function>)
2367
+ %casadi_template(L_DICT, PREC_DICT, std::map<std::string, casadi::GenericType>)
2368
+ %casadi_template(LDICT(LL L_STR LR), PREC_DICT, std::map<std::string, std::vector<std::string> >)
2369
+
2370
+ #undef L_INT
2371
+ #undef L_BOOL
2372
+ #undef LPAIR
2373
+ #undef L_DOUBLE
2374
+ #undef L_DICT
2375
+ #undef LL
2376
+ #undef LR
2377
+ #undef L_STR
2378
+ #undef MATLABSTYLE
2379
+
2380
+ // Matlab is index-1 based
2381
+ #ifdef SWIGMATLAB
2382
+ %typemap(in, doc="index", noblock=1) casadi_index {
2383
+ if (!casadi::to_val($input, &$1)) SWIG_exception_fail(SWIG_TypeError,"Failed to convert input $argnum to type ' index '.");
2384
+ if ($1==0) SWIG_exception_fail(SWIG_TypeError,"Index starts at 1, got index '0'.");
2385
+ if ($1>=1) $1--;
2386
+ }
2387
+ #endif
2388
+
2389
+ #endif // SWIGXML
2390
+
2391
+ #ifdef SWIGPYTHON
2392
+ %pythoncode %{
2393
+ if __name__ != "casadi.casadi":
2394
+ raise Exception("""
2395
+ CasADi is not running from its package context.
2396
+
2397
+ You probably specified the wrong casadi directory.
2398
+
2399
+ When setting PYTHONPATH or sys.path.append,
2400
+ take care not to add a trailing '/casadi'.
2401
+
2402
+ """)
2403
+
2404
+ def swigtypeconvertor(*args):
2405
+ return swig_typename_convertor_python2cpp(args)
2406
+
2407
+ def swig_typename_convertor_python2cpp(a):
2408
+ try:
2409
+ import numpy as np
2410
+ except:
2411
+ class NoExist:
2412
+ pass
2413
+ class Temp(object):
2414
+ ndarray = NoExist
2415
+ np = Temp()
2416
+ if isinstance(a,list):
2417
+ if len(a)>0:
2418
+ return "[%s]" % "|".join(set([swig_typename_convertor_python2cpp(i) for i in a]))
2419
+ else:
2420
+ return "[]"
2421
+ elif isinstance(a,tuple):
2422
+ return "(%s)" % ",".join([swig_typename_convertor_python2cpp(i) for i in a])
2423
+ elif isinstance(a,np.ndarray):
2424
+ return "np.array(%s)" % ",".join(set([swig_typename_convertor_python2cpp(i) for i in np.array(a).flatten().tolist()]))
2425
+ elif isinstance(a,dict):
2426
+ if len(a)>0:
2427
+ return "|".join(set([swig_typename_convertor_python2cpp(i) for i in a.keys()])) +":"+ "|".join(set([swig_typename_convertor_python2cpp(i) for i in a.values()]))
2428
+ else:
2429
+ return "dict"
2430
+ return type(a).__name__
2431
+ %}
2432
+ #endif // SWIGPYTHON
2433
+
2434
+ // Init hooks
2435
+ #ifdef SWIGPYTHON
2436
+ #ifdef WITH_PYTHON_INTERRUPTS
2437
+ %{
2438
+ #include <pythonrun.h>
2439
+ void SigIntHandler(casadi_int) {
2440
+ std::cerr << "Keyboard Interrupt" << std::endl;
2441
+ signal(SIGINT, SIG_DFL);
2442
+ kill(getpid(), SIGINT);
2443
+ }
2444
+ %}
2445
+
2446
+ %init %{
2447
+ PyOS_setsig(SIGINT, SigIntHandler);
2448
+ %}
2449
+ #endif // WITH_PYTHON_INTERRUPTS
2450
+
2451
+ %pythoncode%{
2452
+ try:
2453
+ from numpy import pi, inf
2454
+ except:
2455
+ pass
2456
+
2457
+ arcsin = lambda x: _casadi.asin(x)
2458
+ arccos = lambda x: _casadi.acos(x)
2459
+ arctan = lambda x: _casadi.atan(x)
2460
+ arctan2 = lambda x,y: _casadi.atan2(x, y)
2461
+ arctanh = lambda x: _casadi.atanh(x)
2462
+ arcsinh = lambda x: _casadi.asinh(x)
2463
+ arccosh = lambda x: _casadi.acosh(x)
2464
+ %}
2465
+ #endif // SWIGPYTHON
2466
+
2467
+ // Strip leading casadi_ unless followed by ML/int
2468
+ %rename("%(regex:/casadi_(?!ML|int\\b)(.*)/\\1/)s") "";
2469
+ %rename(casadi_int) "casadi_int";
2470
+
2471
+ %rename(row) get_row;
2472
+ %rename(colind) get_colind;
2473
+ %rename(sparsity) get_sparsity;
2474
+ %rename(nonzeros) get_nonzeros;
2475
+ %rename(elements) get_elements;
2476
+
2477
+ // Explicit conversion to double and casadi_int
2478
+ #ifdef SWIGPYTHON
2479
+ %rename(__float__) operator double;
2480
+ %rename(__int__) operator casadi_int;
2481
+ #else
2482
+ %rename(to_double) operator double;
2483
+ %rename(to_int) operator casadi_int;
2484
+ #endif
2485
+ %rename(to_DM) operator Matrix<double>;
2486
+
2487
+ #ifdef SWIGPYTHON
2488
+ %ignore T;
2489
+
2490
+ %rename(logic_and) casadi_and;
2491
+ %rename(logic_or) casadi_or;
2492
+ %rename(logic_not) casadi_not;
2493
+ %rename(logic_all) casadi_all;
2494
+ %rename(logic_any) casadi_any;
2495
+ %rename(fabs) casadi_abs;
2496
+
2497
+ // Concatenations
2498
+ %rename(_veccat) casadi_veccat;
2499
+ %rename(_vertcat) casadi_vertcat;
2500
+ %rename(_horzcat) casadi_horzcat;
2501
+ %rename(_diagcat) casadi_diagcat;
2502
+ %pythoncode %{
2503
+ def veccat(*args):
2504
+ try:
2505
+ if len(args)==0:
2506
+ return DM(0,1)
2507
+ except:
2508
+ pass
2509
+ return _veccat(args)
2510
+ def vertcat(*args):
2511
+ try:
2512
+ if len(args)==0:
2513
+ return DM(0,1)
2514
+ except:
2515
+ pass
2516
+ return _vertcat(args)
2517
+ def horzcat(*args):
2518
+ try:
2519
+ if len(args)==0:
2520
+ return DM(1,0)
2521
+ except:
2522
+ pass
2523
+ return _horzcat(args)
2524
+ def diagcat(*args):
2525
+ try:
2526
+ if len(args)==0:
2527
+ return DM(0,0)
2528
+ except:
2529
+ pass
2530
+ return _diagcat(args)
2531
+ def vvcat(args):
2532
+ try:
2533
+ if len(args)==0:
2534
+ return DM(0,1)
2535
+ except:
2536
+ pass
2537
+ return _veccat(args)
2538
+ def vcat(args):
2539
+ try:
2540
+ if len(args)==0:
2541
+ return DM(0,1)
2542
+ except:
2543
+ pass
2544
+ return _vertcat(args)
2545
+ def hcat(args):
2546
+ try:
2547
+ if len(args)==0:
2548
+ return DM(1,0)
2549
+ except:
2550
+ pass
2551
+ return _horzcat(args)
2552
+ def dcat(args):
2553
+ try:
2554
+ if len(args)==0:
2555
+ return DM(0,0)
2556
+ except:
2557
+ pass
2558
+ return _diagcat(args)
2559
+ %}
2560
+
2561
+ // Non-fatal errors (returning NotImplemented singleton)
2562
+ %feature("python:maybecall") casadi_plus;
2563
+ %feature("python:maybecall") casadi_minus;
2564
+ %feature("python:maybecall") casadi_times;
2565
+ %feature("python:maybecall") casadi_rdivide;
2566
+ %feature("python:maybecall") casadi_lt;
2567
+ %feature("python:maybecall") casadi_le;
2568
+ %feature("python:maybecall") casadi_eq;
2569
+ %feature("python:maybecall") casadi_ne;
2570
+ %feature("python:maybecall") casadi_power;
2571
+ %feature("python:maybecall") casadi_atan2;
2572
+ %feature("python:maybecall") casadi_min;
2573
+ %feature("python:maybecall") casadi_max;
2574
+ %feature("python:maybecall") casadi_and;
2575
+ %feature("python:maybecall") casadi_or;
2576
+ %feature("python:maybecall") casadi_mod;
2577
+ %feature("python:maybecall") casadi_copysign;
2578
+ %feature("python:maybecall") casadi_constpow;
2579
+ #endif // SWIGPYTHON
2580
+
2581
+ #ifdef SWIGMATLAB
2582
+ %rename(uminus) operator-;
2583
+ %rename(uplus) operator+;
2584
+ %feature("varargin","1") casadi_vertcat;
2585
+ %feature("varargin","1") casadi_horzcat;
2586
+ %feature("varargin","1") casadi_diagcat;
2587
+ %feature("varargin","1") casadi_veccat;
2588
+ %feature("optionalunpack","1") size;
2589
+
2590
+ // Raise an error if "this" not correct
2591
+ %typemap(check, noblock=1) SWIGTYPE *self %{
2592
+ if (!$1) {
2593
+ SWIG_Error(SWIG_RuntimeError, "Invalid 'self' object");
2594
+ SWIG_fail;
2595
+ }
2596
+ %}
2597
+
2598
+ // Workarounds, pending proper fix
2599
+ %rename(nonzero) __nonzero__;
2600
+ %rename(hash) __hash__;
2601
+
2602
+ %rename(rem) casadi_mod;
2603
+ #endif // SWIGMATLAB
2604
+
2605
+ #ifdef SWIGPYTHON
2606
+ %ignore casadi_mod;
2607
+ #endif // SWIGPYTHON
2608
+
2609
+ #ifdef WITH_PYTHON3
2610
+ %rename(__bool__) __nonzero__;
2611
+ #endif
2612
+
2613
+ #ifdef SWIGPYTHON
2614
+
2615
+ %pythoncode %{
2616
+ class NZproxy:
2617
+ def __init__(self,matrix):
2618
+ self.matrix = matrix
2619
+
2620
+ def __getitem__(self,s):
2621
+ return self.matrix.get_nz(False, s)
2622
+
2623
+ def __setitem__(self,s,val):
2624
+ return self.matrix.set_nz(val, False, s)
2625
+
2626
+ def __len__(self):
2627
+ return self.matrix.nnz()
2628
+
2629
+ def __iter__(self):
2630
+ for i in range(len(self)):
2631
+ yield self[i]
2632
+
2633
+ %}
2634
+
2635
+ %define %matrix_helpers(Type)
2636
+ %pythoncode %{
2637
+ @property
2638
+ def shape(self):
2639
+ return (self.size1(),self.size2())
2640
+
2641
+ def reshape(self,arg):
2642
+ return _casadi.reshape(self,arg)
2643
+
2644
+ @property
2645
+ def T(self):
2646
+ return _casadi.transpose(self)
2647
+
2648
+ def __getitem__(self, s):
2649
+ if isinstance(s, tuple) and len(s)==2:
2650
+ if s[1] is None: raise TypeError("Cannot slice with None")
2651
+ return self.get(False, s[0], s[1])
2652
+ return self.get(False, s)
2653
+
2654
+ def __iter__(self):
2655
+ raise Exception("""CasADi matrices are not iterable by design.
2656
+ Did you mean to iterate over m.nz, with m IM/DM/SX?
2657
+ Did you mean to iterate over horzsplit(m,1)/vertsplit(m,1) with m IM/DM/SX/MX?
2658
+ """)
2659
+
2660
+ def __setitem__(self,s,val):
2661
+ if isinstance(s,tuple) and len(s)==2:
2662
+ return self.set(val, False, s[0], s[1])
2663
+ return self.set(val, False, s)
2664
+
2665
+ @property
2666
+ def nz(self):
2667
+ return NZproxy(self)
2668
+
2669
+ %}
2670
+ %enddef
2671
+
2672
+ %define %python_array_wrappers(arraypriority)
2673
+ %pythoncode %{
2674
+
2675
+ __array_priority__ = arraypriority
2676
+
2677
+ def __array_wrap__(self,out_arr,context=None):
2678
+ if context is None:
2679
+ return out_arr
2680
+ name = context[0].__name__
2681
+ args = list(context[1])
2682
+
2683
+ if len(context[1])==3:
2684
+ raise Exception("Error with %s. Looks like you are using an assignment operator, such as 'a+=b' where 'a' is a numpy type. This is not supported, and cannot be supported without changing numpy." % name)
2685
+
2686
+ if "vectorized" in name:
2687
+ name = name[:-len(" (vectorized)")]
2688
+
2689
+ conversion = {"multiply": "mul", "divide": "div", "true_divide": "div", "subtract":"sub","power":"pow","greater_equal":"ge","less_equal": "le", "less": "lt", "greater": "gt", "equal": "eq", "not_equal": "ne"}
2690
+ if name in conversion:
2691
+ name = conversion[name]
2692
+ if len(context[1])==2 and context[1][1] is self and not(context[1][0] is self):
2693
+ name = 'r' + name
2694
+ args.reverse()
2695
+ if not(hasattr(self,name)) or ('mul' in name):
2696
+ name = '__' + name + '__'
2697
+ fun=getattr(self, name)
2698
+ return fun(*args[1:])
2699
+
2700
+ def __array_ufunc__(self, ufunc, method, *inputs, **kwargs):
2701
+ conversion = {"multiply": "mul", "divide": "div", "true_divide": "div", "subtract":"sub","power":"pow","greater_equal":"ge","less_equal": "le", "less": "lt", "greater": "gt", "equal": "eq", "not_equal": "ne"}
2702
+ name = ufunc.__name__
2703
+ inputs = list(inputs)
2704
+ if len(inputs)==3:
2705
+ import warnings
2706
+ warnings.warn("Error with %s. Looks like you are using an assignment operator, such as 'a+=b' where 'a' is a numpy type. This is not supported, and cannot be supported without changing numpy." % name, RuntimeWarning)
2707
+ return NotImplemented
2708
+ if "vectorized" in name:
2709
+ name = name[:-len(" (vectorized)")]
2710
+ if name in conversion:
2711
+ name = conversion[name]
2712
+ if len(inputs)==2 and inputs[1] is self and not(inputs[0] is self):
2713
+ name = 'r' + name
2714
+ inputs.reverse()
2715
+ if not(hasattr(self,name)) or ('mul' in name):
2716
+ name = '__' + name + '__'
2717
+ try:
2718
+ assert method=="__call__"
2719
+ fun=getattr(self, name)
2720
+ return fun(*inputs[1:])
2721
+ except Exception as e:
2722
+ if "Dimension mismatch" in str(e):
2723
+ import sys
2724
+ if sys.version_info[0] < 3:
2725
+ raise RuntimeError(str(e))
2726
+ else:
2727
+ raise e
2728
+ # Fall back to numpy conversion
2729
+ new_inputs = list(inputs)
2730
+ try:
2731
+ new_inputs[0] = new_inputs[0].full()
2732
+ except:
2733
+ import warnings
2734
+ warnings.warn("Implicit conversion of symbolic CasADi type to numeric matrix not supported.\n"
2735
+ + "This may occur when you pass a CasADi object to a numpy function.\n"
2736
+ + "Use an equivalent CasADi function instead of that numpy function.", RuntimeWarning)
2737
+ return NotImplemented
2738
+ return new_inputs[0].__array_ufunc__(ufunc, method, *new_inputs, **kwargs)
2739
+
2740
+
2741
+ def __array__(self,*args,**kwargs):
2742
+ import numpy as n
2743
+ if len(args) > 1 and isinstance(args[1],tuple) and isinstance(args[1][0],n.ufunc) and isinstance(args[1][0],n.ufunc) and len(args[1])>1 and args[1][0].nin==len(args[1][1]):
2744
+ if len(args[1][1])==3:
2745
+ raise Exception("Error with %s. Looks like you are using an assignment operator, such as 'a+=b'. This is not supported when 'a' is a numpy type, and cannot be supported without changing numpy itself. Either upgrade a to a CasADi type first, or use 'a = a + b'. " % args[1][0].__name__)
2746
+ return n.array([n.nan])
2747
+ else:
2748
+ if hasattr(self,'__array_custom__'):
2749
+ return self.__array_custom__(*args,**kwargs)
2750
+ else:
2751
+ try:
2752
+ return self.full()
2753
+ except:
2754
+ if self.is_scalar(True):
2755
+ # Needed for #2743
2756
+ E=n.empty((),dtype=object)
2757
+ E[()] = self
2758
+ return E
2759
+ else:
2760
+ raise Exception("Implicit conversion of symbolic CasADi type to numeric matrix not supported.\n"
2761
+ + "This may occur when you pass a CasADi object to a numpy function.\n"
2762
+ + "Use an equivalent CasADi function instead of that numpy function.")
2763
+
2764
+ %}
2765
+ %enddef
2766
+ #endif // SWIGPYTHON
2767
+
2768
+ #ifdef SWIGXML
2769
+ %define %matrix_helpers(Type)
2770
+ %enddef
2771
+ #endif
2772
+
2773
+ #ifdef SWIGMATLAB
2774
+ %{
2775
+ namespace casadi {
2776
+ /// Helper function: Convert ':' to Slice
2777
+ inline Slice char2Slice(char ch) {
2778
+ casadi_assert_dev(ch==':');
2779
+ return Slice();
2780
+ }
2781
+ } // namespace casadi
2782
+ %}
2783
+
2784
+ %define %matrix_helpers(Type)
2785
+ // Get a submatrix (index-1)
2786
+ const Type paren(char rr) const {
2787
+ casadi_assert_dev(rr==':');
2788
+ return vec(*$self);
2789
+ }
2790
+ const Type paren(const Matrix<casadi_int>& rr) const {
2791
+ Type m;
2792
+ $self->get(m, true, rr);
2793
+ return m;
2794
+ }
2795
+ const Type paren(const Sparsity& sp) const {
2796
+ Type m;
2797
+ $self->get(m, true, sp);
2798
+ return m;
2799
+ }
2800
+ const Type paren(char rr, char cc) const {
2801
+ Type m;
2802
+ $self->get(m, true, casadi::char2Slice(rr), casadi::char2Slice(cc));
2803
+ return m;
2804
+ }
2805
+ const Type paren(char rr, const Matrix<casadi_int>& cc) const {
2806
+ Type m;
2807
+ $self->get(m, true, casadi::char2Slice(rr), cc);
2808
+ return m;
2809
+ }
2810
+ const Type paren(const Matrix<casadi_int>& rr, char cc) const {
2811
+ Type m;
2812
+ $self->get(m, true, rr, casadi::char2Slice(cc));
2813
+ return m;
2814
+ }
2815
+ const Type paren(const Matrix<casadi_int>& rr, const Matrix<casadi_int>& cc) const {
2816
+ Type m;
2817
+ $self->get(m, true, rr, cc);
2818
+ return m;
2819
+ }
2820
+
2821
+ // Set a submatrix (index-1)
2822
+ void paren_asgn(const Type& m, char rr) {
2823
+ casadi_assert_dev(rr==':');
2824
+ $self->set(m, false, casadi::IM(casadi::range($self->numel())));
2825
+ }
2826
+ void paren_asgn(const Type& m, const Matrix<casadi_int>& rr) { $self->set(m, true, rr);}
2827
+ void paren_asgn(const Type& m, const Sparsity& sp) { $self->set(m, true, sp);}
2828
+ void paren_asgn(const Type& m, char rr, char cc) { $self->set(m, true, casadi::char2Slice(rr), casadi::char2Slice(cc));}
2829
+ void paren_asgn(const Type& m, char rr, const Matrix<casadi_int>& cc) { $self->set(m, true, casadi::char2Slice(rr), cc);}
2830
+ void paren_asgn(const Type& m, const Matrix<casadi_int>& rr, char cc) { $self->set(m, true, rr, casadi::char2Slice(cc));}
2831
+ void paren_asgn(const Type& m, const Matrix<casadi_int>& rr, const Matrix<casadi_int>& cc) { $self->set(m, true, rr, cc);}
2832
+
2833
+ // Get nonzeros (index-1)
2834
+ const Type brace(char rr) const { Type m; $self->get_nz(m, true, casadi::char2Slice(rr)); return m;}
2835
+ const Type brace(const Matrix<casadi_int>& rr) const { Type m; $self->get_nz(m, true, rr); return m;}
2836
+
2837
+ // Set nonzeros (index-1)
2838
+ void setbrace(const Type& m, char rr) { $self->set_nz(m, true, casadi::char2Slice(rr));}
2839
+ void setbrace(const Type& m, const Matrix<casadi_int>& rr) { $self->set_nz(m, true, rr);}
2840
+
2841
+ // 'end' function (needed for end syntax in MATLAB)
2842
+ inline casadi_int end(casadi_int i, casadi_int n) const {
2843
+ return n==1 ? $self->numel() : i==1 ? $self->size1() : $self->size2();
2844
+ }
2845
+
2846
+
2847
+ // Needed for brace syntax to access nonzeros
2848
+ casadi_int numel(casadi_int k) const {
2849
+ return 1;
2850
+ }
2851
+
2852
+ // Needed for brace syntax to access nonzeros
2853
+ casadi_int numel(char rr) const {
2854
+ casadi_assert_dev(rr==':');
2855
+ return 1;
2856
+ }
2857
+
2858
+ // Needed for brace syntax to access nonzeros
2859
+ casadi_int numel(const std::vector<casadi_int> &k) const {
2860
+ return 1;
2861
+ }
2862
+
2863
+ // Needed because original numel call gets hidden by the above extend overloads
2864
+ casadi_int numel() const {
2865
+ return $self->numel();
2866
+ }
2867
+
2868
+
2869
+ // Transpose using the A' syntax in addition to A.'
2870
+ Type ctranspose() const { return $self->T();}
2871
+
2872
+ %enddef
2873
+ #endif
2874
+
2875
+ %include <casadi/core/printable.hpp>
2876
+
2877
+ namespace casadi{
2878
+ %extend PrintableCommon {
2879
+ #ifdef SWIGPYTHON
2880
+ %pythoncode %{
2881
+ def __str__(self): return self.str()
2882
+ def repr(self): return self.type_name() + '(' + self.str() + ')'
2883
+ %}
2884
+ #endif // SWIGPYTHON
2885
+ #ifdef SWIGMATLAB
2886
+ %matlabcode %{
2887
+ function s = repr(self)
2888
+ s = [self.type_name() '(' self.str() ')'];
2889
+ end
2890
+ %}
2891
+ #endif // SWIGMATLAB
2892
+ }
2893
+ } // namespace casadi
2894
+
2895
+ %include <casadi/core/shared_object.hpp>
2896
+ %include <casadi/core/casadi_misc.hpp>
2897
+ %include <casadi/core/casadi_common.hpp>
2898
+ %include <casadi/core/generic_type.hpp>
2899
+ %include <casadi/core/calculus.hpp>
2900
+ %include <casadi/core/sparsity_interface.hpp>
2901
+ %include <casadi/core/sparsity.hpp>
2902
+
2903
+ // Logic for pickling
2904
+ #ifdef SWIGPYTHON
2905
+ namespace casadi{
2906
+ %extend Sparsity {
2907
+ %pythoncode %{
2908
+ def __setstate__(self, state):
2909
+ self.__init__(Sparsity.deserialize(state["serialization"]))
2910
+
2911
+ def __getstate__(self):
2912
+ return {"serialization": self.serialize()}
2913
+ %}
2914
+ }
2915
+
2916
+ } // namespace casadi
2917
+ #endif // SWIGPYTHON
2918
+
2919
+ /* There is no reason to expose the Slice class to e.g. Python or MATLAB. Only if an interfaced language
2920
+ lacks a slice type, the type should be exposed here */
2921
+ // #if !(defined(SWIGPYTHON) || defined(SWIGMATLAB))
2922
+ %include <casadi/core/slice.hpp>
2923
+ //#endif
2924
+
2925
+
2926
+ %include <casadi/core/generic_matrix.hpp>
2927
+
2928
+ %template(GenDM) casadi::GenericMatrix<casadi::Matrix<double> >;
2929
+ %template(GenSX) casadi::GenericMatrix<casadi::Matrix<casadi::SXElem> >;
2930
+ %template(GenMX) casadi::GenericMatrix<casadi::MX>;
2931
+
2932
+ %include <casadi/core/generic_expression.hpp>
2933
+
2934
+ // Flags to allow differentiating the wrapping by type
2935
+ #define IS_GLOBAL 0x1
2936
+ #define IS_MEMBER 0x10
2937
+ #define IS_SPARSITY 0x100
2938
+ #define IS_DMATRIX 0x1000
2939
+ #define IS_IMATRIX 0x10000
2940
+ #define IS_SX 0x100000
2941
+ #define IS_MX 0x1000000
2942
+ #define IS_DOUBLE 0x10000000
2943
+
2944
+ %define SPARSITY_INTERFACE_FUN_BASE(DECL, FLAG, M)
2945
+ #if FLAG & IS_MEMBER
2946
+
2947
+ DECL M casadi_horzcat(const std::vector< M > &v) {
2948
+ return horzcat(v);
2949
+ }
2950
+ DECL M casadi_vertcat(const std::vector< M > &v) {
2951
+ return vertcat(v);
2952
+ }
2953
+ DECL std::vector< M >
2954
+ casadi_horzsplit(const M& v, const std::vector<casadi_int>& offset) {
2955
+ return horzsplit(v, offset);
2956
+ }
2957
+ DECL std::vector< M > casadi_horzsplit(const M& v, casadi_int incr=1) {
2958
+ return horzsplit(v, incr);
2959
+ }
2960
+ DECL std::vector< M > casadi_horzsplit_n(const M& v, casadi_int n) {
2961
+ return horzsplit_n(v, n);
2962
+ }
2963
+ DECL std::vector< M >
2964
+ casadi_vertsplit(const M& v, const std::vector<casadi_int>& offset) {
2965
+ return vertsplit(v, offset);
2966
+ }
2967
+ DECL std::vector<casadi_int >
2968
+ casadi_offset(const std::vector< M > &v, bool vert=true) {
2969
+ return offset(v, vert);
2970
+ }
2971
+ DECL std::vector< M >
2972
+ casadi_vertsplit(const M& v, casadi_int incr=1) {
2973
+ return vertsplit(v, incr);
2974
+ }
2975
+ DECL std::vector< M >
2976
+ casadi_vertsplit_n(const M& v, casadi_int n) {
2977
+ return vertsplit_n(v, n);
2978
+ }
2979
+ DECL M casadi_blockcat(const M& A, const M& B, const M& C, const M& D) {
2980
+ return vertcat(horzcat(A, B), horzcat(C, D));
2981
+ }
2982
+ DECL std::vector< std::vector< M > >
2983
+ casadi_blocksplit(const M& x, const std::vector<casadi_int>& vert_offset,
2984
+ const std::vector<casadi_int>& horz_offset) {
2985
+ return blocksplit(x, vert_offset, horz_offset);
2986
+ }
2987
+ DECL std::vector< std::vector< M > >
2988
+ casadi_blocksplit(const M& x, casadi_int vert_incr=1, casadi_int horz_incr=1) {
2989
+ return blocksplit(x, vert_incr, horz_incr);
2990
+ }
2991
+ DECL M casadi_diagcat(const std::vector< M > &A) {
2992
+ return diagcat(A);
2993
+ }
2994
+ DECL std::vector< M >
2995
+ casadi_diagsplit(const M& x, const std::vector<casadi_int>& output_offset1,
2996
+ const std::vector<casadi_int>& output_offset2) {
2997
+ return diagsplit(x, output_offset1, output_offset2);
2998
+ }
2999
+ DECL std::vector< M >
3000
+ casadi_diagsplit(const M& x, const std::vector<casadi_int>& output_offset) {
3001
+ return diagsplit(x, output_offset);
3002
+ }
3003
+ DECL std::vector< M > casadi_diagsplit(const M& x, casadi_int incr=1) {
3004
+ return diagsplit(x, incr);
3005
+ }
3006
+ DECL std::vector< M >
3007
+ casadi_diagsplit(const M& x, casadi_int incr1, casadi_int incr2) {
3008
+ return diagsplit(x, incr1, incr2);
3009
+ }
3010
+ DECL M casadi_veccat(const std::vector< M >& x) {
3011
+ return veccat(x);
3012
+ }
3013
+ DECL M casadi_mtimes(const M& x, const M& y) {
3014
+ return mtimes(x, y);
3015
+ }
3016
+ DECL M casadi_mtimes(const std::vector< M > &args) {
3017
+ return mtimes(args);
3018
+ }
3019
+ DECL M casadi_mac(const M& X, const M& Y, const M& Z) {
3020
+ return mac(X, Y, Z);
3021
+ }
3022
+ DECL M casadi_transpose(const M& X) {
3023
+ return X.T();
3024
+ }
3025
+ DECL M casadi_vec(const M& a) {
3026
+ return vec(a);
3027
+ }
3028
+ DECL M casadi_reshape(const M& a, casadi_int nrow, casadi_int ncol) {
3029
+ return reshape(a, nrow, ncol);
3030
+ }
3031
+ DECL M casadi_reshape(const M& a, std::pair<casadi_int, casadi_int> rc) {
3032
+ return reshape(a, rc.first, rc.second);
3033
+ }
3034
+ DECL M casadi_reshape(const M& a, const Sparsity& sp) {
3035
+ return reshape(a, sp);
3036
+ }
3037
+ DECL M casadi_sparsity_cast(const M& a, const Sparsity& sp) {
3038
+ return sparsity_cast(a, sp);
3039
+ }
3040
+ DECL casadi_int casadi_sprank(const M& A) {
3041
+ return sprank(A);
3042
+ }
3043
+ DECL casadi_int casadi_norm_0_mul(const M& x, const M& y) {
3044
+ return norm_0_mul(x, y);
3045
+ }
3046
+ DECL M casadi_triu(const M& a, bool includeDiagonal=true) {
3047
+ return triu(a, includeDiagonal);
3048
+ }
3049
+ DECL M casadi_tril(const M& a, bool includeDiagonal=true) {
3050
+ return tril(a, includeDiagonal);
3051
+ }
3052
+ DECL M casadi_kron(const M& a, const M& b) {
3053
+ return kron(a, b);
3054
+ }
3055
+ DECL M casadi_repmat(const M& A, casadi_int n, casadi_int m=1) {
3056
+ return repmat(A, n, m);
3057
+ }
3058
+ DECL M casadi_repmat(const M& A, const std::pair<casadi_int, casadi_int>& rc) {
3059
+ return repmat(A, rc.first, rc.second);
3060
+ }
3061
+ DECL M casadi_sum2(const M& x) {
3062
+ return sum2(x);
3063
+ }
3064
+ DECL M casadi_sum1(const M& x) {
3065
+ return sum1(x);
3066
+ }
3067
+ #endif
3068
+ %enddef
3069
+
3070
+ %define SPARSITY_INTERFACE_ALL(DECL, FLAG)
3071
+ SPARSITY_INTERFACE_FUN(DECL, (FLAG | IS_SPARSITY), Sparsity)
3072
+ SPARSITY_INTERFACE_FUN(DECL, (FLAG | IS_MX), MX)
3073
+ SPARSITY_INTERFACE_FUN(DECL, (FLAG | IS_DMATRIX), Matrix<double>)
3074
+ SPARSITY_INTERFACE_FUN(DECL, (FLAG | IS_SX), Matrix<SXElem>)
3075
+ %enddef
3076
+
3077
+ #ifdef SWIGMATLAB
3078
+ %define SPARSITY_INTERFACE_FUN(DECL, FLAG, M)
3079
+ SPARSITY_INTERFACE_FUN_BASE(DECL, FLAG, M)
3080
+ #if FLAG & IS_MEMBER
3081
+ DECL casadi_int casadi_length(const M &v) {
3082
+ return std::max(v.size1(), v.size2());
3083
+ }
3084
+ #endif
3085
+ %enddef
3086
+ #else
3087
+ %define SPARSITY_INTERFACE_FUN(DECL, FLAG, M)
3088
+ SPARSITY_INTERFACE_FUN_BASE(DECL, FLAG, M)
3089
+ %enddef
3090
+ #endif
3091
+
3092
+ %define GENERIC_MATRIX_FUN(DECL, FLAG, M)
3093
+ #if FLAG & IS_MEMBER
3094
+ DECL M casadi_mpower(const M& x, const M& n) {
3095
+ return mpower(x, n);
3096
+ }
3097
+
3098
+ DECL M casadi_mrdivide(const M& x, const M& y) {
3099
+ return mrdivide(x, y);
3100
+ }
3101
+
3102
+ DECL M casadi_mldivide(const M& x, const M& y) {
3103
+ return mldivide(x, y);
3104
+ }
3105
+
3106
+ DECL std::vector< M > casadi_symvar(const M& x) {
3107
+ return symvar(x);
3108
+ }
3109
+
3110
+ DECL M casadi_bilin(const M& A, const M& x, const M& y) {
3111
+ return bilin(A, x, y);
3112
+ }
3113
+
3114
+ DECL M casadi_bilin(const M& A, const M& x) {
3115
+ return bilin(A, x);
3116
+ }
3117
+
3118
+ DECL M casadi_rank1(const M& A, const M& alpha, const M& x, const M& y) {
3119
+ return rank1(A, alpha, x, y);
3120
+ }
3121
+
3122
+ DECL M casadi_sumsqr(const M& X) {
3123
+ return sumsqr(X);
3124
+ }
3125
+
3126
+ DECL M casadi_linspace(const M& a, const M& b, casadi_int nsteps) {
3127
+ return linspace(a, b, nsteps);
3128
+ }
3129
+
3130
+ DECL M casadi_logsumexp(const M& a) {
3131
+ return logsumexp(a);
3132
+ }
3133
+
3134
+ DECL M casadi_logsumexp(const M& a, const M& margin) {
3135
+ return logsumexp(a, margin);
3136
+ }
3137
+
3138
+ DECL M casadi_interp1d(const std::vector<double>& x, const M&v,
3139
+ const std::vector<double>& xq, const std::string& mode="linear", bool equidistant=false) {
3140
+ return interp1d(x, v, xq, mode, equidistant);
3141
+ }
3142
+
3143
+ DECL M casadi_soc(const M& x, const M& y) {
3144
+ return soc(x, y);
3145
+ }
3146
+
3147
+ DECL M casadi_cross(const M& a, const M& b, casadi_int dim = -1) {
3148
+ return cross(a, b, dim);
3149
+ }
3150
+
3151
+ DECL M casadi_skew(const M& a) {
3152
+ return skew(a);
3153
+ }
3154
+
3155
+ DECL M casadi_inv_skew(const M& a) {
3156
+ return inv_skew(a);
3157
+ }
3158
+
3159
+ DECL M casadi_det(const M& A) {
3160
+ return det(A);
3161
+ }
3162
+
3163
+ DECL M casadi_inv_minor(const M& A) {
3164
+ return inv_minor(A);
3165
+ }
3166
+
3167
+ DECL M casadi_inv(const M& A) {
3168
+ return inv(A);
3169
+ }
3170
+
3171
+ DECL M casadi_inv(const M& A, const std::string& lsolver,
3172
+ const casadi::Dict& opts = casadi::Dict()) {
3173
+ return inv(A, lsolver, opts);
3174
+ }
3175
+
3176
+ DECL M casadi_trace(const M& a) {
3177
+ return trace(a);
3178
+ }
3179
+
3180
+ DECL M casadi_tril2symm(const M& a) {
3181
+ return tril2symm(a);
3182
+ }
3183
+
3184
+ DECL M casadi_triu2symm(const M& a) {
3185
+ return triu2symm(a);
3186
+ }
3187
+
3188
+ DECL M casadi_norm_fro(const M& x) {
3189
+ return norm_fro(x);
3190
+ }
3191
+
3192
+ DECL M casadi_norm_2(const M& x) {
3193
+ return norm_2(x);
3194
+ }
3195
+
3196
+ DECL M casadi_norm_1(const M& x) {
3197
+ return norm_1(x);
3198
+ }
3199
+
3200
+ DECL M casadi_norm_inf(const M& x) {
3201
+ return norm_inf(x);
3202
+ }
3203
+
3204
+ DECL M casadi_dot(const M& x, const M& y) {
3205
+ return dot(x, y);
3206
+ }
3207
+
3208
+ DECL M casadi_nullspace(const M& A) {
3209
+ return nullspace(A);
3210
+ }
3211
+
3212
+ DECL M casadi_polyval(const M& p, const M& x) {
3213
+ return polyval(p, x);
3214
+ }
3215
+
3216
+ DECL M casadi_diag(const M& A) {
3217
+ return diag(A);
3218
+ }
3219
+
3220
+ DECL M casadi_unite(const M& A, const M& B) {
3221
+ return unite(A, B);
3222
+ }
3223
+
3224
+ DECL M casadi_densify(const M& x) {
3225
+ return densify(x);
3226
+ }
3227
+
3228
+ DECL M casadi_project(const M& A, const Sparsity& sp, bool intersect=false) {
3229
+ return project(A, sp, intersect);
3230
+ }
3231
+
3232
+ DECL M casadi_if_else(const M& cond, const M& if_true,
3233
+ const M& if_false, bool short_circuit=false) {
3234
+ return if_else(cond, if_true, if_false, short_circuit);
3235
+ }
3236
+
3237
+ DECL M casadi_conditional(const M& ind, const std::vector< M > &x,
3238
+ const M& x_default, bool short_circuit=false) {
3239
+ return conditional(ind, x, x_default, short_circuit);
3240
+ }
3241
+
3242
+ DECL bool casadi_depends_on(const M& f, const M& arg) {
3243
+ return depends_on(f, arg);
3244
+ }
3245
+
3246
+ DECL M casadi_solve(const M& A, const M& b) {
3247
+ return solve(A, b);
3248
+ }
3249
+
3250
+ DECL M casadi_solve(const M& A, const M& b,
3251
+ const std::string& lsolver,
3252
+ const casadi::Dict& opts = casadi::Dict()) {
3253
+ return solve(A, b, lsolver, opts);
3254
+ }
3255
+
3256
+ DECL M casadi_pinv(const M& A) {
3257
+ return pinv(A);
3258
+ }
3259
+
3260
+ DECL M casadi_pinv(const M& A, const std::string& lsolver,
3261
+ const casadi::Dict& opts = casadi::Dict()) {
3262
+ return pinv(A, lsolver, opts);
3263
+ }
3264
+
3265
+ DECL M casadi_expm_const(const M& A, const M& t) {
3266
+ return expm_const(A, t);
3267
+ }
3268
+
3269
+ DECL M casadi_expm(const M& A) {
3270
+ return expm(A);
3271
+ }
3272
+
3273
+ DECL M casadi_jacobian(const M &ex, const M &arg, const Dict& opts=Dict()) {
3274
+ return jacobian(ex, arg, opts);
3275
+ }
3276
+
3277
+ DECL M casadi_jtimes(const M& ex, const M& arg, const M& v, bool tr=false) {
3278
+ return jtimes(ex, arg, v, tr);
3279
+ }
3280
+
3281
+ DECL M casadi_linearize(const M& f, const M& x, const M& x0) {
3282
+ return linearize(f, x, x0);
3283
+ }
3284
+
3285
+ DECL std::vector<bool> casadi_which_depends(const M& expr, const M& var,
3286
+ casadi_int order=1, bool tr=false) {
3287
+ return which_depends(expr, var, order, tr);
3288
+ }
3289
+
3290
+ DECL Sparsity casadi_jacobian_sparsity(const M& f, const M& x) {
3291
+ return jacobian_sparsity(f, x);
3292
+ }
3293
+
3294
+ DECL bool casadi_is_linear(const M& expr, const M& var) {
3295
+ return is_linear(expr, var);
3296
+ }
3297
+
3298
+ DECL bool casadi_is_quadratic(const M& expr, const M& var) {
3299
+ return is_quadratic(expr, var);
3300
+ }
3301
+
3302
+ DECL M casadi_gradient(const M &ex, const M &arg) {
3303
+ return gradient(ex, arg);
3304
+ }
3305
+
3306
+ DECL M casadi_tangent(const M &ex, const M &arg) {
3307
+ return tangent(ex, arg);
3308
+ }
3309
+
3310
+ DECL M casadi_hessian(const M& ex, const M& arg, M& OUTPUT1, const casadi::Dict& opts = casadi::Dict()) {
3311
+ return hessian(ex, arg, OUTPUT1, opts);
3312
+ }
3313
+
3314
+ DECL void casadi_quadratic_coeff(const M& ex, const M& arg, M& OUTPUT1, M& OUTPUT2, M& OUTPUT3, bool check=true) {
3315
+ quadratic_coeff(ex, arg, OUTPUT1, OUTPUT2, OUTPUT3, check);
3316
+ }
3317
+
3318
+ DECL void casadi_linear_coeff(const M& ex, const M& arg, M& OUTPUT1, M& OUTPUT2, bool check=true) {
3319
+ linear_coeff(ex, arg, OUTPUT1, OUTPUT2, check);
3320
+ }
3321
+
3322
+ DECL casadi_int casadi_n_nodes(const M& A) {
3323
+ return n_nodes(A);
3324
+ }
3325
+
3326
+ DECL std::string casadi_print_operator(const M& xb,
3327
+ const std::vector<std::string>& args) {
3328
+ return print_operator(xb, args);
3329
+ }
3330
+ DECL M casadi_repsum(const M& A, casadi_int n, casadi_int m=1) {
3331
+ return repsum(A, n, m);
3332
+ }
3333
+ DECL M casadi_diff(const M& A, casadi_int n=1, casadi_index axis=-1) {
3334
+ return diff(A, n, axis);
3335
+ }
3336
+ DECL M casadi_cumsum(const M& A, casadi_index axis=-1) {
3337
+ return cumsum(A, axis);
3338
+ }
3339
+ DECL M casadi_einstein(const M& A, const M& B, const M& C,
3340
+ const std::vector<casadi_int>& dim_a, const std::vector<casadi_int>& dim_b, const std::vector<casadi_int>& dim_c,
3341
+ const std::vector<casadi_int>& a, const std::vector<casadi_int>& b, const std::vector<casadi_int>& c) {
3342
+ return einstein(A, B, C, dim_a, dim_b, dim_c, a, b, c);
3343
+ }
3344
+ DECL M casadi_einstein(const M& A, const M& B,
3345
+ const std::vector<casadi_int>& dim_a, const std::vector<casadi_int>& dim_b, const std::vector<casadi_int>& dim_c,
3346
+ const std::vector<casadi_int>& a, const std::vector<casadi_int>& b, const std::vector<casadi_int>& c) {
3347
+ return einstein(A, B, dim_a, dim_b, dim_c, a, b, c);
3348
+ }
3349
+ DECL M casadi_mmin(const M& x) { return mmin(x); }
3350
+ DECL M casadi_mmax(const M& x) { return mmax(x); }
3351
+ DECL casadi::DM casadi_evalf(const M& x) {
3352
+ return evalf(x);
3353
+ }
3354
+ DECL std::vector<M> casadi_cse(const std::vector<M>& e) {
3355
+ return cse(e);
3356
+ }
3357
+ DECL M casadi_cse(const M& e) {
3358
+ return cse(e);
3359
+ }
3360
+
3361
+ #endif // FLAG & IS_MEMBER
3362
+
3363
+ #if FLAG & IS_GLOBAL
3364
+ DECL std::vector<std::vector< M > >
3365
+ casadi_forward(const std::vector< M > &ex, const std::vector< M > &arg,
3366
+ const std::vector<std::vector< M > > &v,
3367
+ const Dict& opts = Dict()) {
3368
+ return forward(ex, arg, v, opts);
3369
+ }
3370
+
3371
+ DECL std::vector<std::vector< M > >
3372
+ casadi_reverse(const std::vector< M > &ex, const std::vector< M > &arg,
3373
+ const std::vector<std::vector< M > > &v,
3374
+ const Dict& opts = Dict()) {
3375
+ return reverse(ex, arg, v, opts);
3376
+ }
3377
+
3378
+ DECL M casadi_substitute(const M& ex, const M& v, const M& vdef) {
3379
+ return substitute(ex, v, vdef);
3380
+ }
3381
+
3382
+ DECL std::vector< M > casadi_substitute(const std::vector< M >& ex,
3383
+ const std::vector< M >& v,
3384
+ const std::vector< M >& vdef) {
3385
+ return substitute(ex, v, vdef);
3386
+ }
3387
+
3388
+ DECL void casadi_substitute_inplace(const std::vector< M >& v,
3389
+ std::vector< M >& INOUT1,
3390
+ std::vector< M >& INOUT2,
3391
+ bool reverse=false) {
3392
+ return substitute_inplace(v, INOUT1, INOUT2, reverse);
3393
+ }
3394
+
3395
+ DECL void casadi_extract(const std::vector< M >& ex,
3396
+ std::vector< M >& OUTPUT1,
3397
+ std::vector< M >& OUTPUT2,
3398
+ std::vector< M >& OUTPUT3,
3399
+ const Dict& opts = Dict()) {
3400
+ OUTPUT1 = ex;
3401
+ extract(OUTPUT1, OUTPUT2, OUTPUT3, opts);
3402
+ }
3403
+
3404
+ DECL void casadi_shared(const std::vector< M >& ex,
3405
+ std::vector< M >& OUTPUT1,
3406
+ std::vector< M >& OUTPUT2,
3407
+ std::vector< M >& OUTPUT3,
3408
+ const std::string& v_prefix="v_",
3409
+ const std::string& v_suffix="") {
3410
+ OUTPUT1 = ex;
3411
+ shared(OUTPUT1, OUTPUT2, OUTPUT3, v_prefix, v_suffix);
3412
+ }
3413
+
3414
+ DECL M casadi_blockcat(const std::vector< std::vector< M > > &v) {
3415
+ return blockcat(v);
3416
+ }
3417
+ #endif // FLAG & IS_GLOBAL
3418
+ %enddef
3419
+
3420
+ %define GENERIC_MATRIX_ALL(DECL, FLAG)
3421
+ GENERIC_MATRIX_FUN(DECL, (FLAG | IS_MX), MX)
3422
+ GENERIC_MATRIX_FUN(DECL, (FLAG | IS_DMATRIX), Matrix<double>)
3423
+ GENERIC_MATRIX_FUN(DECL, (FLAG | IS_SX), Matrix<SXElem>)
3424
+ %enddef
3425
+
3426
+ %define GENERIC_EXPRESSION_FUN(DECL, FLAG, M)
3427
+ #if FLAG & IS_MEMBER
3428
+ DECL M casadi_plus(const M& x, const M& y) { return x+y; }
3429
+ DECL M casadi_minus(const M& x, const M& y) { return x-y; }
3430
+ DECL M casadi_times(const M& x, const M& y) { return x*y; }
3431
+ DECL M casadi_rdivide(const M& x, const M& y) { return x/y; }
3432
+ DECL M casadi_ldivide(const M& x, const M& y) { return y/x; }
3433
+ DECL M casadi_lt(const M& x, const M& y) { return x<y; }
3434
+ DECL M casadi_le(const M& x, const M& y) { return x<=y; }
3435
+ DECL M casadi_gt(const M& x, const M& y) { return x>y; }
3436
+ DECL M casadi_ge(const M& x, const M& y) { return x>=y; }
3437
+ DECL M casadi_eq(const M& x, const M& y) { return x==y; }
3438
+ DECL M casadi_ne(const M& x, const M& y) { return x!=y; }
3439
+ DECL M casadi_and(const M& x, const M& y) { return x&&y; }
3440
+ DECL M casadi_or(const M& x, const M& y) { return x||y; }
3441
+ DECL M casadi_not(const M& x) { return !x; }
3442
+ DECL M casadi_abs(const M& x) { return fabs(x); }
3443
+ DECL M casadi_sqrt(const M& x) { return sqrt(x); }
3444
+ DECL M casadi_sin(const M& x) { return sin(x); }
3445
+ DECL M casadi_cos(const M& x) { return cos(x); }
3446
+ DECL M casadi_tan(const M& x) { return tan(x); }
3447
+ DECL M casadi_atan(const M& x) { return atan(x); }
3448
+ DECL M casadi_asin(const M& x) { return asin(x); }
3449
+ DECL M casadi_acos(const M& x) { return acos(x); }
3450
+ DECL M casadi_tanh(const M& x) { return tanh(x); }
3451
+ DECL M casadi_sinh(const M& x) { return sinh(x); }
3452
+ DECL M casadi_cosh(const M& x) { return cosh(x); }
3453
+ DECL M casadi_atanh(const M& x) { return atanh(x); }
3454
+ DECL M casadi_asinh(const M& x) { return asinh(x); }
3455
+ DECL M casadi_acosh(const M& x) { return acosh(x); }
3456
+ DECL M casadi_exp(const M& x) { return exp(x); }
3457
+ DECL M casadi_log(const M& x) { return log(x); }
3458
+ DECL M casadi_log10(const M& x) { return log10(x); }
3459
+ DECL M casadi_log1p(const M& x) { return log1p(x); }
3460
+ DECL M casadi_expm1(const M& x) { return expm1(x); }
3461
+ DECL M casadi_floor(const M& x) { return floor(x); }
3462
+ DECL M casadi_ceil(const M& x) { return ceil(x); }
3463
+ DECL M casadi_erf(const M& x) { return erf(x); }
3464
+ DECL M casadi_erfinv(const M& x) { using casadi::erfinv; return erfinv(x); }
3465
+ DECL M casadi_sign(const M& x) { using casadi::sign; return sign(x); }
3466
+ DECL M casadi_power(const M& x, const M& n) { return pow(x, n); }
3467
+ DECL M casadi_mod(const M& x, const M& y) { return fmod(x, y); }
3468
+ DECL M casadi_fmod(const M& x, const M& y) { return fmod(x, y); }
3469
+ DECL M casadi_remainder(const M& x, const M& y) { return remainder(x, y); }
3470
+ DECL M casadi_atan2(const M& x, const M& y) { return atan2(x, y); }
3471
+ DECL M casadi_fmin(const M& x, const M& y) { return fmin(x, y); }
3472
+ DECL M casadi_fmax(const M& x, const M& y) { return fmax(x, y); }
3473
+ DECL M casadi_hypot(const M& x, const M& y) { return hypot(x, y); }
3474
+ DECL M casadi_simplify(const M& x) { using casadi::simplify; return simplify(x); }
3475
+ DECL bool casadi_is_equal(const M& x, const M& y, casadi_int depth=0) { using casadi::is_equal; return is_equal(x, y, depth); }
3476
+ DECL M casadi_copysign(const M& x, const M& y) { return copysign(x, y); }
3477
+ DECL M casadi_constpow(const M& x, const M& y) { using casadi::constpow; return constpow(x, y); }
3478
+ #endif // FLAG & IS_MEMBER
3479
+ %enddef
3480
+
3481
+ %define GENERIC_EXPRESSION_ALL(DECL, FLAG)
3482
+ GENERIC_EXPRESSION_FUN(DECL, (FLAG | IS_MX), MX)
3483
+ GENERIC_EXPRESSION_FUN(DECL, (FLAG | IS_DMATRIX), Matrix<double>)
3484
+ GENERIC_EXPRESSION_FUN(DECL, (FLAG | IS_SX), Matrix<SXElem>)
3485
+ GENERIC_EXPRESSION_FUN(DECL, (FLAG | IS_DOUBLE), double)
3486
+ %enddef
3487
+
3488
+ %define MATRIX_FUN(DECL, FLAG, M)
3489
+ #if FLAG & IS_MEMBER
3490
+ DECL M casadi_all(const M& x) {
3491
+ return all(x);
3492
+ }
3493
+
3494
+ DECL M casadi_any(const M& x) {
3495
+ return any(x);
3496
+ }
3497
+
3498
+ DECL M casadi_adj(const M& A) {
3499
+ return adj(A);
3500
+ }
3501
+
3502
+ DECL M casadi_minor(const M& x, casadi_int i, casadi_int j) {
3503
+ return minor(x, i, j);
3504
+ }
3505
+
3506
+ DECL M casadi_cofactor(const M& x, casadi_int i, casadi_int j) {
3507
+ return cofactor(x, i, j);
3508
+ }
3509
+
3510
+ DECL void casadi_qr(const M& A, M& OUTPUT1, M& OUTPUT2) {
3511
+ return qr(A, OUTPUT1, OUTPUT2);
3512
+ }
3513
+
3514
+ DECL void casadi_qr_sparse(const M& A, M& OUTPUT1, M& OUTPUT2, M& OUTPUT3,
3515
+ std::vector<casadi_int>& OUTPUT4, std::vector<casadi_int>& OUTPUT5, bool amd=true) {
3516
+ return qr_sparse(A, OUTPUT1, OUTPUT2, OUTPUT3, OUTPUT4, OUTPUT5, amd);
3517
+ }
3518
+
3519
+ DECL M casadi_qr_solve(const M& b, const M& v, const M& r, const M& beta,
3520
+ const std::vector<casadi_int>& prinv,
3521
+ const std::vector<casadi_int>& pc, bool tr=false) {
3522
+ return qr_solve(b, v, r, beta, prinv, pc, tr);
3523
+ }
3524
+
3525
+ DECL void casadi_ldl(const M& A, M& OUTPUT1, M& OUTPUT2, std::vector<casadi_int>& OUTPUT3, bool amd=true) {
3526
+ return ldl(A, OUTPUT1, OUTPUT2, OUTPUT3, amd);
3527
+ }
3528
+
3529
+ DECL M casadi_ldl_solve(const M& b, const M& D, const M& LT, const std::vector<casadi_int>& p) {
3530
+ return ldl_solve(b, D, LT, p);
3531
+ }
3532
+
3533
+ DECL M casadi_chol(const M& A) {
3534
+ return chol(A);
3535
+ }
3536
+
3537
+ DECL M casadi_norm_inf_mul(const M& x, const M& y) {
3538
+ return norm_inf_mul(x, y);
3539
+ }
3540
+
3541
+ DECL M casadi_sparsify(const M& A, double tol=0) {
3542
+ return sparsify(A, tol);
3543
+ }
3544
+
3545
+ DECL void casadi_expand(const M& ex, M& OUTPUT1, M& OUTPUT2) {
3546
+ expand(ex, OUTPUT1, OUTPUT2);
3547
+ }
3548
+
3549
+ DECL M casadi_pw_const(const M &t, const M& tval, const M& val) {
3550
+ return pw_const(t, tval, val);
3551
+ }
3552
+
3553
+ DECL M casadi_pw_lin(const M& t, const M& tval, const M& val) {
3554
+ return pw_lin(t, tval, val);
3555
+ }
3556
+
3557
+ DECL M casadi_heaviside(const M& x) {
3558
+ return heaviside(x);
3559
+ }
3560
+
3561
+ DECL M casadi_rectangle(const M& x) {
3562
+ return rectangle(x);
3563
+ }
3564
+
3565
+ DECL M casadi_triangle(const M& x) {
3566
+ return triangle(x);
3567
+ }
3568
+
3569
+ DECL M casadi_ramp(const M& x) {
3570
+ return ramp(x);
3571
+ }
3572
+
3573
+ DECL M casadi_gauss_quadrature(const M& f, const M& x,
3574
+ const M& a, const M& b,
3575
+ casadi_int order=5) {
3576
+ return gauss_quadrature(f, x, a, b, order);
3577
+ }
3578
+
3579
+ DECL M casadi_gauss_quadrature(const M& f, const M& x,
3580
+ const M& a, const M& b,
3581
+ casadi_int order, const M& w) {
3582
+ return gauss_quadrature(f, x, a, b, order, w);
3583
+ }
3584
+
3585
+ DECL M casadi_taylor(const M& ex, const M& x, const M& a=0, casadi_int order=1) {
3586
+ return taylor(ex, x, a, order);
3587
+ }
3588
+
3589
+ DECL M casadi_mtaylor(const M& ex, const M& x, const M& a, casadi_int order=1) {
3590
+ return mtaylor(ex, x, a, order);
3591
+ }
3592
+
3593
+ DECL M casadi_mtaylor(const M& ex, const M& x, const M& a, casadi_int order,
3594
+ const std::vector<casadi_int>& order_contributions) {
3595
+ return mtaylor(ex, x, a, order, order_contributions);
3596
+ }
3597
+
3598
+ DECL M casadi_poly_coeff(const M& ex,
3599
+ const M&x) {
3600
+ return poly_coeff(ex, x);
3601
+ }
3602
+
3603
+ DECL M casadi_poly_roots(const M& p) {
3604
+ return poly_roots(p);
3605
+ }
3606
+
3607
+ DECL M casadi_eig_symbolic(const M& m) {
3608
+ return eig_symbolic(m);
3609
+ }
3610
+
3611
+ #endif
3612
+ %enddef
3613
+
3614
+ %define MATRIX_ALL(DECL, FLAG)
3615
+ MATRIX_FUN(DECL, (FLAG | IS_DMATRIX), Matrix<double>)
3616
+ MATRIX_FUN(DECL, (FLAG | IS_SX), Matrix<SXElem>)
3617
+ %enddef
3618
+
3619
+ %define MX_FUN(DECL, FLAG, M)
3620
+ #if FLAG & IS_MEMBER
3621
+ DECL M casadi_find(const M& x) {
3622
+ return find(x);
3623
+ }
3624
+ DECL M casadi_low(const M& v, const M& p, const Dict& options = Dict()) {
3625
+ return low(v, p, options);
3626
+ }
3627
+ DECL M casadi_inv_node(const M& x) {
3628
+ return inv_node(x);
3629
+ }
3630
+ #endif // FLAG & IS_MEMBER
3631
+
3632
+ #if FLAG & IS_GLOBAL
3633
+ DECL std::vector< M >
3634
+ casadi_matrix_expand(const std::vector< M >& e,
3635
+ const std::vector< M > &boundary = std::vector< M >(),
3636
+ const Dict& options = Dict()) {
3637
+ return matrix_expand(e, boundary, options);
3638
+ }
3639
+
3640
+ DECL M casadi_matrix_expand(const M& e,
3641
+ const std::vector< M > &boundary = std::vector< M >(),
3642
+ const Dict& options = Dict()) {
3643
+ return matrix_expand(e, boundary, options);
3644
+ }
3645
+
3646
+ DECL M casadi_graph_substitute(const M& ex, const std::vector< M >& v,
3647
+ const std::vector< M > &vdef) {
3648
+ return graph_substitute(ex, v, vdef);
3649
+ }
3650
+
3651
+ DECL std::vector< M >
3652
+ casadi_graph_substitute(const std::vector< M > &ex,
3653
+ const std::vector< M > &v,
3654
+ const std::vector< M > &vdef) {
3655
+ return graph_substitute(ex, v, vdef);
3656
+ }
3657
+ DECL M casadi_bspline(const M& x,
3658
+ const DM& coeffs,
3659
+ const std::vector< std::vector<double> >& knots,
3660
+ const std::vector<casadi_int>& degree,
3661
+ casadi_int m,
3662
+ const Dict& opts = Dict()) {
3663
+ return bspline(x, coeffs, knots, degree, m, opts);
3664
+ }
3665
+ DECL M casadi_bspline(const M& x,
3666
+ const M& coeffs,
3667
+ const std::vector< std::vector<double> >& knots,
3668
+ const std::vector<casadi_int>& degree,
3669
+ casadi_int m,
3670
+ const Dict& opts = Dict()) {
3671
+ return bspline(x, coeffs, knots, degree, m, opts);
3672
+ }
3673
+ DECL M casadi_convexify(const M& H,
3674
+ const Dict& opts = Dict()) {
3675
+ return convexify(H, opts);
3676
+ }
3677
+ DECL M casadi_stop_diff(const M& expr, casadi_int order) {
3678
+ return stop_diff(expr, order);
3679
+ }
3680
+ DECL M casadi_stop_diff(const M& expr, const M& var, casadi_int order) {
3681
+ return stop_diff(expr, var, order);
3682
+ }
3683
+ DECL M casadi_no_hess(const M& expr) {
3684
+ return no_hess(expr);
3685
+ }
3686
+ DECL M casadi_no_grad(const M& expr) {
3687
+ return no_grad(expr);
3688
+ }
3689
+
3690
+ #endif
3691
+ %enddef
3692
+
3693
+ %define MX_ALL(DECL, FLAG)
3694
+ MX_FUN(DECL, (FLAG | IS_MX), MX)
3695
+ %enddef
3696
+ %include <casadi/core/matrix_fwd.hpp>
3697
+ %include <casadi/core/matrix_decl.hpp>
3698
+ %include <casadi/core/dm_fwd.hpp>
3699
+ %include <casadi/core/sx_fwd.hpp>
3700
+
3701
+ // Remove from API
3702
+ %warnfilter(401) casadi::Matrix<casadi_int>;
3703
+ %template() casadi::Matrix<casadi_int>;
3704
+
3705
+ %template(DM) casadi::Matrix<double>;
3706
+ %extend casadi::Matrix<double> {
3707
+ %template(DM) Matrix<SXElem>;
3708
+ };
3709
+
3710
+
3711
+ namespace casadi{
3712
+ %extend Matrix<double> {
3713
+ void assign(const casadi::Matrix<double>&rhs) { (*$self)=rhs; }
3714
+ %matrix_helpers(casadi::Matrix<double>)
3715
+
3716
+ }
3717
+
3718
+ }
3719
+
3720
+ // Extend DM with SWIG unique features
3721
+ namespace casadi{
3722
+ %extend Matrix<double> {
3723
+ // Convert to a dense matrix
3724
+ GUESTOBJECT* full() const {
3725
+ return full(*$self);
3726
+ }
3727
+
3728
+ // Convert to a sparse matrix
3729
+ GUESTOBJECT* sparse() const {
3730
+ return sparse(*$self);
3731
+ }
3732
+ }
3733
+
3734
+ } // namespace casadi
3735
+
3736
+
3737
+ #ifdef SWIGPYTHON
3738
+ namespace casadi{
3739
+ %extend Matrix<double> {
3740
+
3741
+ %python_array_wrappers(999.0)
3742
+
3743
+ // The following code has some trickery to fool numpy ufunc.
3744
+ // Normally, because of the presence of __array__, an ufunctor like nump.sqrt
3745
+ // will unleash its activity on the output of __array__
3746
+ // However, we wish DM to remain a DM
3747
+ // So when we receive a call from a functor, we return a dummy empty array
3748
+ // and return the real result during the postprocessing (__array_wrap__) of the functor.
3749
+ %pythoncode %{
3750
+ def __array_custom__(self,*args,**kwargs):
3751
+ if "dtype" in kwargs and not(isinstance(kwargs["dtype"],n.double)):
3752
+ return n.array(self.full(),dtype=kwargs["dtype"])
3753
+ else:
3754
+ return self.full()
3755
+ %}
3756
+
3757
+ %pythoncode %{
3758
+ def tocsc(self):
3759
+ import numpy as np
3760
+ import warnings
3761
+ with warnings.catch_warnings():
3762
+ warnings.simplefilter("ignore")
3763
+ from scipy.sparse import csc_matrix
3764
+ return csc_matrix( (self.nonzeros(),self.row(),self.colind()), shape = self.shape, dtype=np.double )
3765
+ def toarray(self,simplify=False):
3766
+ import numpy as np
3767
+ if simplify:
3768
+ if self.is_scalar():
3769
+ return float(self)
3770
+ elif self.is_vector():
3771
+ return np.array(self.T.elements())
3772
+ return np.array(self.T.elements()).reshape(self.shape)
3773
+ %}
3774
+
3775
+
3776
+ #ifdef WITH_PYTHON3
3777
+ %pythoncode %{
3778
+ def __bool__(self):
3779
+ if self.numel()!=1:
3780
+ raise Exception("Only a scalar can be cast to a float")
3781
+ if self.nnz()==0:
3782
+ return False
3783
+ return float(self)!=0
3784
+ %}
3785
+ #else
3786
+ %pythoncode %{
3787
+ def __nonzero__(self):
3788
+ if self.numel()!=1:
3789
+ raise Exception("Only a scalar can be cast to a float")
3790
+ if self.nnz()==0:
3791
+ return False
3792
+ return float(self)!=0
3793
+ %}
3794
+ #endif
3795
+
3796
+ %pythoncode %{
3797
+ def __abs__(self):
3798
+ return abs(float(self))
3799
+ %}
3800
+
3801
+ }; // extend Matrix<double>
3802
+
3803
+
3804
+ // Logic for pickling
3805
+
3806
+ %extend Matrix<double> {
3807
+
3808
+ %pythoncode %{
3809
+ def __setstate__(self, state):
3810
+ self.__init__(DM.deserialize(state["serialization"]))
3811
+
3812
+ def __getstate__(self):
3813
+ return {"serialization": self.serialize()}
3814
+ %}
3815
+
3816
+ }
3817
+
3818
+
3819
+ %extend Function {
3820
+
3821
+ %pythoncode %{
3822
+ def __setstate__(self, state):
3823
+ self.__init__(Function.deserialize(state["serialization"]))
3824
+
3825
+ def __getstate__(self):
3826
+ return {"serialization": self.serialize()}
3827
+ %}
3828
+
3829
+ }
3830
+
3831
+
3832
+ } // namespace casadi
3833
+ #endif // SWIGPYTHON
3834
+
3835
+
3836
+ #ifdef SWIGMATLAB
3837
+ namespace casadi{
3838
+
3839
+
3840
+ %extend Matrix<double> {
3841
+
3842
+ %matlabcode %{
3843
+ function s = saveobj(obj)
3844
+ try
3845
+ s.serialization = obj.serialize();
3846
+ catch exception
3847
+ warning(['Serializing of CasADi DM failed:' getReport(exception) ]);
3848
+ s = struct;
3849
+ end
3850
+ end
3851
+ %}
3852
+ %matlabcode_static %{
3853
+ function obj = loadobj(s)
3854
+ try
3855
+ if isstruct(s)
3856
+ obj = casadi.DM.deserialize(s.serialization);
3857
+ else
3858
+ obj = s;
3859
+ end
3860
+ catch exception
3861
+ warning(['Serializing of CasADi DM failed:' getReport(exception) ]);
3862
+ s = struct;
3863
+ end
3864
+ end
3865
+ %}
3866
+ }
3867
+
3868
+ %extend Sparsity {
3869
+ %matlabcode %{
3870
+ function s = saveobj(obj)
3871
+ try
3872
+ s.serialization = obj.serialize();
3873
+ catch exception
3874
+ warning(['Serializing of CasADi Sparsity failed:' getReport(exception) ]);
3875
+ s = struct;
3876
+ end
3877
+ end
3878
+ %}
3879
+ %matlabcode_static %{
3880
+ function obj = loadobj(s)
3881
+ try
3882
+ if isstruct(s)
3883
+ obj = casadi.Sparsity.deserialize(s.serialization);
3884
+ else
3885
+ obj = s;
3886
+ end
3887
+ catch exception
3888
+ warning(['Serializing of CasADi Sparsity failed:' getReport(exception) ]);
3889
+ s = struct;
3890
+ end
3891
+ end
3892
+ %}
3893
+ }
3894
+
3895
+
3896
+ %extend Function {
3897
+
3898
+ %matlabcode %{
3899
+ function s = saveobj(obj)
3900
+ try
3901
+ s.serialization = obj.serialize();
3902
+ catch exception
3903
+ warning(['Serializing of CasADi Function failed:' getReport(exception) ]);
3904
+ s = struct;
3905
+ end
3906
+ end
3907
+ %}
3908
+ %matlabcode_static %{
3909
+ function obj = loadobj(s)
3910
+ try
3911
+ if isstruct(s)
3912
+ obj = casadi.Function.deserialize(s.serialization);
3913
+ else
3914
+ obj = s;
3915
+ end
3916
+ catch exception
3917
+ warning(['Serializing of CasADi Function failed:' getReport(exception) ]);
3918
+ s = struct;
3919
+ end
3920
+ end
3921
+ %}
3922
+
3923
+ }
3924
+
3925
+ } // namespace casadi
3926
+ #endif // SWIGMATLAB
3927
+
3928
+ %include <casadi/core/sx_elem.hpp>
3929
+
3930
+ #ifdef SWIGPYTHON
3931
+ %extend casadi::Sparsity{
3932
+ %pythoncode %{
3933
+ @property
3934
+ def shape(self):
3935
+ return (self.size1(),self.size2())
3936
+
3937
+ @property
3938
+ def T(self):
3939
+ return _casadi.transpose(self)
3940
+
3941
+ def __array__(self,*args,**kwargs):
3942
+ return DM.ones(self).full()
3943
+ %}
3944
+ };
3945
+
3946
+ #endif // SWIGPYTHON
3947
+
3948
+ #ifdef SWIGPYTHON
3949
+ %pythoncode %{
3950
+
3951
+ try:
3952
+ import numpy
3953
+
3954
+ def constpow(x,y):
3955
+ pass
3956
+
3957
+ constpow=numpy.frompyfunc(constpow,2,1)
3958
+ except:
3959
+ pass
3960
+ %}
3961
+ #endif // SWIGPYTHON
3962
+
3963
+ namespace casadi {
3964
+ %extend Matrix<SXElem>{
3965
+ %matrix_helpers(casadi::Matrix<casadi::SXElem>)
3966
+
3967
+ #ifdef SWIGPYTHON
3968
+ %python_array_wrappers(1001.0)
3969
+ #endif // SWIGPYTHON
3970
+
3971
+ };
3972
+
3973
+ } // namespace casadi
3974
+
3975
+ #ifdef SWIGPYTHON
3976
+ #include <arrayobject.h>
3977
+ %template() std::vector<PyObject*>;
3978
+ #endif // SWIGPYTHON
3979
+
3980
+ %template(SX) casadi::Matrix<casadi::SXElem>;
3981
+ %extend casadi::Matrix<casadi::SXElem> {
3982
+ %template(SX) Matrix<double>;
3983
+ };
3984
+
3985
+ %include <casadi/core/mx.hpp>
3986
+
3987
+ %extend casadi::MX{
3988
+ %matrix_helpers(casadi::MX)
3989
+ #ifdef SWIGPYTHON
3990
+ %python_array_wrappers(1002.0)
3991
+ #endif //SWIGPYTHON
3992
+ };
3993
+
3994
+ #ifdef SWIGPYTHON
3995
+ %pythoncode %{
3996
+ def attach_return_type(f,t):
3997
+ if not(hasattr(f,'func_annotations')):
3998
+ f.func_annotations = {}
3999
+ if not(isinstance(getattr(f,'func_annotations'),dict)):
4000
+ raise Exception("Cannot annotate this python Method to be a sparsitygenerator. Method has func_annotations attribute with unknown type.")
4001
+ f.func_annotations["return"] = t
4002
+ return f
4003
+
4004
+ def pyevaluate(f):
4005
+ return attach_return_type(f,None)
4006
+
4007
+ def pycallback(f):
4008
+ return attach_return_type(f,int)
4009
+
4010
+
4011
+ def pyfunction(inputs,outputs):
4012
+ def wrap(f):
4013
+
4014
+ @pyevaluate
4015
+ def fcustom(f2):
4016
+ res = f([f2.getInput(i) for i in range(f2.n_in())])
4017
+ if not isinstance(res,list):
4018
+ res = [res]
4019
+ for i in range(f2.n_out()):
4020
+ f2.setOutput(res[i],i)
4021
+ import warnings
4022
+
4023
+ with warnings.catch_warnings():
4024
+ warnings.filterwarnings("ignore",category=DeprecationWarning)
4025
+ Fun = CustomFunction("CustomFunction",fcustom,inputs,outputs)
4026
+ return Fun
4027
+
4028
+ return wrap
4029
+
4030
+ def PyFunction(name, obj, inputs, outputs, opts={}):
4031
+ @pyevaluate
4032
+ def fcustom(f):
4033
+ res = [f.getOutput(i) for i in range(f.n_out())]
4034
+ obj.evaluate([f.getInput(i) for i in range(f.n_in())],res)
4035
+ for i in range(f.n_out()): f.setOutput(res[i], i)
4036
+
4037
+ import warnings
4038
+
4039
+ with warnings.catch_warnings():
4040
+ warnings.filterwarnings("ignore",category=DeprecationWarning)
4041
+ return CustomFunction("CustomFunction", fcustom,
4042
+ inputs, outputs, opts)
4043
+
4044
+ %}
4045
+ #endif
4046
+
4047
+ #ifndef SWIGPYTHON
4048
+ %ignore FunctionBuffer;
4049
+ %ignore _function_buffer_eval;
4050
+ #endif
4051
+
4052
+ %include <casadi/core/function.hpp>
4053
+ #ifdef SWIGPYTHON
4054
+ namespace casadi{
4055
+ %extend Function {
4056
+ %pythoncode %{
4057
+ def __call__(self, *args, **kwargs):
4058
+ # Either named inputs or ordered inputs
4059
+ if len(args)>0 and len(kwargs)>0:
4060
+ raise SyntaxError('Function evaluation requires all arguments to be named or none')
4061
+ if len(args)>0:
4062
+ # Ordered inputs -> return tuple
4063
+ ret = self.call(args)
4064
+ if len(ret)==0:
4065
+ return None
4066
+ elif len(ret)==1:
4067
+ return ret[0]
4068
+ else:
4069
+ return tuple(ret)
4070
+ else:
4071
+ # Named inputs -> return dictionary
4072
+ return self.call(kwargs)
4073
+
4074
+ def buffer(self):
4075
+ """
4076
+ Create a FunctionBuffer object for evaluating with minimal overhead
4077
+
4078
+ """
4079
+ import functools
4080
+ fb = FunctionBuffer(self)
4081
+ caller = functools.partial(_casadi._function_buffer_eval, fb._self())
4082
+ return (fb, caller)
4083
+ %}
4084
+
4085
+
4086
+ }
4087
+
4088
+ }
4089
+ #endif // SWIGPYTHON
4090
+
4091
+ #ifdef SWIGMATLAB
4092
+ namespace casadi{
4093
+ %extend GenericMatrixCommon {
4094
+ %matlabcode %{
4095
+ function varargout = spy(self,varargin)
4096
+ [varargout{1:nargout}] = spy(sparse(casadi.DM(self.sparsity(),1)),varargin{:});
4097
+ end
4098
+ function varargout = subsref(self,s)
4099
+ if numel(s)==1 && strcmp(s.type,'()')
4100
+ [varargout{1}] = paren(self, s.subs{:});
4101
+ elseif numel(s)==1 && strcmp(s.type,'{}')
4102
+ [varargout{1}] = brace(self, s.subs{:});
4103
+ else
4104
+ [varargout{1:nargout}] = builtin('subsref',self,s);
4105
+ end
4106
+ end
4107
+ function self = subsasgn(self,s,v)
4108
+ if numel(s)==1 && strcmp(s.type,'()')
4109
+ paren_asgn(self, v, s.subs{:});
4110
+ elseif numel(s)==1 && strcmp(s.type,'{}')
4111
+ brace_asgn(self, v, s.subs{:});
4112
+ else
4113
+ self = builtin('subsasgn',self,s,v);
4114
+ end
4115
+ end
4116
+ function out = sum(self,varargin)
4117
+ narginchk(1,3);
4118
+ if nargin==1
4119
+ if is_vector(self)
4120
+ if is_column(self)
4121
+ out = sum1(self);
4122
+ else
4123
+ out = sum2(self);
4124
+ end
4125
+ else
4126
+ out = sum1(self);
4127
+ end
4128
+ else
4129
+ i = varargin{1};
4130
+ if i==1
4131
+ out = sum1(self);
4132
+ elseif i==2
4133
+ out = sum2(self);
4134
+ else
4135
+ error('sum argument (if present) must be 1 or 2');
4136
+ end
4137
+ end
4138
+ end
4139
+ function out = norm(self,varargin)
4140
+ narginchk(1,2);
4141
+ % 2-norm by default
4142
+ if nargin==1
4143
+ ind = 2;
4144
+ else
4145
+ ind = varargin{1};
4146
+ end
4147
+ % Typecheck
4148
+ assert((isnumeric(ind) && isscalar(ind)) || ischar(ind))
4149
+ % Pick the right norm
4150
+ if isnumeric(ind)
4151
+ switch ind
4152
+ case 1
4153
+ out = norm_1(self);
4154
+ case 2
4155
+ out = norm_2(self);
4156
+ case inf
4157
+ out = norm_inf(self);
4158
+ otherwise
4159
+ error(sprintf('Unknown norm argument: %g', ind))
4160
+ end
4161
+ else
4162
+ switch ind
4163
+ case 'fro'
4164
+ out = norm_fro(self);
4165
+ case 'inf'
4166
+ out = norm_inf(self);
4167
+ otherwise
4168
+ error(sprintf('Unknown norm argument: ''%s''', ind))
4169
+ end
4170
+ end
4171
+ end
4172
+ function out = min(varargin)
4173
+ narginchk(1,2);
4174
+ if nargin==1
4175
+ out = mmin(varargin{1});
4176
+ else
4177
+ out = fmin(varargin{1}, varargin{2});
4178
+ end
4179
+ end
4180
+ function out = max(varargin)
4181
+ narginchk(1,2);
4182
+ if nargin==1
4183
+ out = mmax(varargin{1});
4184
+ else
4185
+ out = fmax(varargin{1}, varargin{2});
4186
+ end
4187
+ end
4188
+ function b = isrow(self)
4189
+ b = is_row(self);
4190
+ end
4191
+ function b = iscolumn(self)
4192
+ b = is_column(self);
4193
+ end
4194
+ function b = isvector(self)
4195
+ b = is_vector(self);
4196
+ end
4197
+ function b = isscalar(self)
4198
+ b = is_scalar(self);
4199
+ end
4200
+ %}
4201
+ }
4202
+ %extend Function {
4203
+ %matlabcode %{
4204
+ function varargout = subsref(self,s)
4205
+ if numel(s)==1 && strcmp(s.type,'()')
4206
+ [varargout{1:nargout}]= paren(self, s.subs{:});
4207
+ else
4208
+ [varargout{1:nargout}] = builtin('subsref',self,s);
4209
+ end
4210
+ end
4211
+ function varargout = paren(self, varargin)
4212
+ if nargin==1 || (nargin>=2 && ischar(varargin{1}))
4213
+ % Named inputs: return struct
4214
+ assert(nargout<2, 'Syntax error');
4215
+ assert(mod(nargin,2)==1, 'Syntax error');
4216
+ arg = struct;
4217
+ for i=1:2:nargin-1
4218
+ assert(ischar(varargin{i}), 'Syntax error');
4219
+ arg.(varargin{i}) = varargin{i+1};
4220
+ end
4221
+ res = self.call(arg);
4222
+ varargout{1} = res;
4223
+ else
4224
+ % Ordered inputs: return variable number of outputs
4225
+ res = self.call(varargin);
4226
+ assert(nargout<=numel(res), 'Too many outputs');
4227
+ for i=1:max(min(1,numel(res)),nargout)
4228
+ varargout{i} = res{i};
4229
+ end
4230
+ end
4231
+ end
4232
+ %}
4233
+ }
4234
+ }
4235
+ #endif // SWIGMATLAB
4236
+ %include <casadi/core/external.hpp>
4237
+ %include <casadi/core/integrator.hpp>
4238
+ %include <casadi/core/conic.hpp>
4239
+ %include <casadi/core/nlpsol.hpp>
4240
+ %include <casadi/core/rootfinder.hpp>
4241
+ %include <casadi/core/linsol.hpp>
4242
+ %include <casadi/core/dple.hpp>
4243
+ %include <casadi/core/expm.hpp>
4244
+ %include <casadi/core/interpolant.hpp>
4245
+
4246
+ %feature("copyctor", "0") casadi::CodeGenerator;
4247
+ %include <casadi/core/code_generator.hpp>
4248
+
4249
+ #ifdef SWIGMATLAB
4250
+ // Wrap (static) member functions
4251
+ %feature("nonstatic");
4252
+ namespace casadi {
4253
+ %extend SparsityInterfaceCommon {
4254
+ SPARSITY_INTERFACE_ALL(static inline, IS_MEMBER)
4255
+ }
4256
+ %extend GenericExpressionCommon {
4257
+ GENERIC_EXPRESSION_ALL(static inline, IS_MEMBER)
4258
+ }
4259
+ %extend GenericMatrixCommon {
4260
+ GENERIC_MATRIX_ALL(static inline, IS_MEMBER)
4261
+ }
4262
+ %extend MatrixCommon {
4263
+ MATRIX_ALL(static inline, IS_MEMBER)
4264
+ }
4265
+ %extend MX {
4266
+ MX_ALL(static inline, IS_MEMBER)
4267
+ const MX brace(const casadi::MX& rr) const { casadi::MX m; $self->get_nz(m, true, rr); return m;}
4268
+ const MX paren(const casadi::MX& rr) const {
4269
+ casadi::MX m;
4270
+ $self->get(m, true, rr);
4271
+ return m;
4272
+ }
4273
+ const MX paren(char rr, const casadi::MX& cc) const {
4274
+ casadi::MX m;
4275
+ $self->get(m, true, casadi::char2Slice(rr), cc);
4276
+ return m;
4277
+ }
4278
+ const MX paren(const casadi::MX& rr, char cc) const {
4279
+ casadi::MX m;
4280
+ $self->get(m, true, rr, casadi::char2Slice(cc));
4281
+ return m;
4282
+ }
4283
+ const MX paren(const casadi::MX& rr, const casadi::MX& cc) const {
4284
+ casadi::MX m;
4285
+ $self->get(m, true, rr, cc);
4286
+ return m;
4287
+ }
4288
+ }
4289
+ } // namespace casadi
4290
+ %feature("nonstatic", "");
4291
+ // Member functions already wrapped
4292
+ #define FLAG IS_GLOBAL
4293
+ #else // SWIGMATLAB
4294
+ // Need to wrap member functions below
4295
+ #define FLAG (IS_GLOBAL | IS_MEMBER)
4296
+ #endif // SWIGMATLAB
4297
+
4298
+ // Wrap non-member functions, possibly with casadi_ prefix
4299
+
4300
+ %inline {
4301
+ namespace casadi {
4302
+ SPARSITY_INTERFACE_ALL(inline, FLAG)
4303
+ GENERIC_EXPRESSION_ALL(inline, FLAG)
4304
+ GENERIC_MATRIX_ALL(inline, FLAG)
4305
+ MATRIX_ALL(inline, FLAG)
4306
+ MX_ALL(inline, FLAG)
4307
+ }
4308
+ }
4309
+
4310
+ // Wrap the casadi_ prefixed functions in member functions
4311
+ #ifdef SWIGPYTHON
4312
+ #ifdef WITH_PYTHON3
4313
+ namespace casadi {
4314
+ %extend GenericExpressionCommon {
4315
+ %pythoncode %{
4316
+ def __hash__(self):
4317
+ try:
4318
+ return self.element_hash()
4319
+ except:
4320
+ return SharedObject.__hash__(self)
4321
+ def __matmul__(x, y): return _casadi.mtimes(x, y)
4322
+ def __rmatmul__(x, y): return _casadi.mtimes(y, x)
4323
+ %}
4324
+ }
4325
+ }
4326
+ #endif
4327
+ namespace casadi {
4328
+ %extend GenericExpressionCommon {
4329
+ %pythoncode %{
4330
+ def __add__(x, y): return _casadi.plus(x, y)
4331
+ def __radd__(x, y): return _casadi.plus(y, x)
4332
+ def __sub__(x, y): return _casadi.minus(x, y)
4333
+ def __rsub__(x, y): return _casadi.minus(y, x)
4334
+ def __mul__(x, y): return _casadi.times(x, y)
4335
+ def __rmul__(x, y): return _casadi.times(y, x)
4336
+ def __div__(x, y): return _casadi.rdivide(x, y)
4337
+ def __rdiv__(x, y): return _casadi.rdivide(y, x)
4338
+ def __truediv__(x, y): return _casadi.rdivide(x, y)
4339
+ def __rtruediv__(x, y): return _casadi.rdivide(y, x)
4340
+ def __lt__(x, y): return _casadi.lt(x, y)
4341
+ def __rlt__(x, y): return _casadi.lt(y, x)
4342
+ def __le__(x, y): return _casadi.le(x, y)
4343
+ def __rle__(x, y): return _casadi.le(y, x)
4344
+ def __gt__(x, y): return _casadi.lt(y, x)
4345
+ def __rgt__(x, y): return _casadi.lt(x, y)
4346
+ def __ge__(x, y): return _casadi.le(y, x)
4347
+ def __rge__(x, y): return _casadi.le(x, y)
4348
+ def __eq__(x, y): return _casadi.eq(x, y)
4349
+ def __req__(x, y): return _casadi.eq(y, x)
4350
+ def __ne__(x, y): return _casadi.ne(x, y)
4351
+ def __rne__(x, y): return _casadi.ne(y, x)
4352
+ def __pow__(x, n): return _casadi.power(x, n)
4353
+ def __rpow__(n, x): return _casadi.power(x, n)
4354
+ def __arctan2__(x, y): return _casadi.atan2(x, y)
4355
+ def __rarctan2__(y, x): return _casadi.atan2(x, y)
4356
+ def fmin(x, y): return _casadi.fmin(x, y)
4357
+ def fmax(x, y): return _casadi.fmax(x, y)
4358
+ def __fmin__(x, y): return _casadi.fmin(x, y)
4359
+ def __rfmin__(y, x): return _casadi.fmin(x, y)
4360
+ def __fmax__(x, y): return _casadi.fmax(x, y)
4361
+ def __rfmax__(y, x): return _casadi.fmax(x, y)
4362
+ def logic_and(x, y): return _casadi.logic_and(x, y)
4363
+ def logic_or(x, y): return _casadi.logic_or(x, y)
4364
+ def fabs(x): return _casadi.fabs(x)
4365
+ def sqrt(x): return _casadi.sqrt(x)
4366
+ def sin(x): return _casadi.sin(x)
4367
+ def cos(x): return _casadi.cos(x)
4368
+ def tan(x): return _casadi.tan(x)
4369
+ def arcsin(x): return _casadi.asin(x)
4370
+ def arccos(x): return _casadi.acos(x)
4371
+ def arctan(x): return _casadi.atan(x)
4372
+ def sinh(x): return _casadi.sinh(x)
4373
+ def cosh(x): return _casadi.cosh(x)
4374
+ def tanh(x): return _casadi.tanh(x)
4375
+ def arcsinh(x): return _casadi.asinh(x)
4376
+ def arccosh(x): return _casadi.acosh(x)
4377
+ def arctanh(x): return _casadi.atanh(x)
4378
+ def exp(x): return _casadi.exp(x)
4379
+ def log(x): return _casadi.log(x)
4380
+ def log10(x): return _casadi.log10(x)
4381
+ def log1p(x): return _casadi.log1p(x)
4382
+ def expm1(x): return _casadi.expm1(x)
4383
+ def floor(x): return _casadi.floor(x)
4384
+ def ceil(x): return _casadi.ceil(x)
4385
+ def erf(x): return _casadi.erf(x)
4386
+ def sign(x): return _casadi.sign(x)
4387
+ def fmod(x, y): return _casadi.mod(x, y)
4388
+ def hypot(x, y): return _casadi.hypot(x, y)
4389
+ def remainder(x, y): return _casadi.remainder(x, y)
4390
+ def __copysign__(x, y): return _casadi.copysign(x, y)
4391
+ def __rcopysign__(y, x): return _casadi.copysign(x, y)
4392
+ def copysign(x, y): return _casadi.copysign(x, y)
4393
+ def rcopysign(y, x): return _casadi.copysign(x, y)
4394
+ def __constpow__(x, y): return _casadi.constpow(x, y)
4395
+ def __rconstpow__(y, x): return _casadi.constpow(x, y)
4396
+ def constpow(x, y): return _casadi.constpow(x, y)
4397
+ def rconstpow(y, x): return _casadi.constpow(x, y)
4398
+ %}
4399
+ }
4400
+
4401
+ %extend GenericMatrixCommon {
4402
+ %pythoncode %{
4403
+ def __mldivide__(x, y): return _casadi.mldivide(x, y)
4404
+ def __rmldivide__(y, x): return _casadi.mldivide(x, y)
4405
+ def __mrdivide__(x, y): return _casadi.mrdivide(x, y)
4406
+ def __rmrdivide__(y, x): return _casadi.mrdivide(x, y)
4407
+ def __mpower__(x, y): return _casadi.mpower(x, y)
4408
+ def __rmpower__(y, x): return _casadi.mpower(x, y)
4409
+ %}
4410
+ }
4411
+
4412
+ } // namespace casadi
4413
+ #endif // SWIGPYTHON
4414
+
4415
+ %feature("director") casadi::Callback;
4416
+
4417
+ %include <casadi/core/importer.hpp>
4418
+ %include <casadi/core/callback.hpp>
4419
+ %include <casadi/core/global_options.hpp>
4420
+ %include <casadi/core/casadi_meta.hpp>
4421
+ %include <casadi/core/integration_tools.hpp>
4422
+ %include <casadi/core/nlp_tools.hpp>
4423
+ %include <casadi/core/nlp_builder.hpp>
4424
+ %include <casadi/core/dae_builder.hpp>
4425
+ %include <casadi/core/xml_file.hpp>
4426
+
4427
+ %feature("copyctor", "0") casadi::SerializerBase;
4428
+ %feature("copyctor", "0") casadi::DeserializerBase;
4429
+ %feature("copyctor", "0") casadi::StringSerializer;
4430
+ %feature("copyctor", "0") casadi::StringDeserializer;
4431
+ %feature("copyctor", "0") casadi::FileSerializer;
4432
+ %feature("copyctor", "0") casadi::FileDeserializer;
4433
+ %nodefaultctor casadi::SerializerBase;
4434
+ %nodefaultctor casadi::DeserializerBase;
4435
+
4436
+ #ifdef SWIGPYTHON
4437
+ %rename("_pop_type") casadi::DeserializerBase::pop_type;
4438
+ %rename("%(regex:/(SERIALIZED_\w+)/_\\1/)s", regextarget=1, fullname=1) "casadi::SerializerBase::SERIALIZED_\w+";
4439
+ #endif // SWIG_PYTHON
4440
+
4441
+
4442
+ #ifdef SWIGMATLAB
4443
+ %rename("internal_pop_type") casadi::DeserializerBase::pop_type;
4444
+ %rename("%(regex:/(SERIALIZED_\w+)/internal_\\1/)s", regextarget=1, fullname=1) "casadi::SerializerBase::SERIALIZED_\w+";
4445
+ #endif // SWIG_PYTHON
4446
+
4447
+ %include <casadi/core/serializer.hpp>
4448
+
4449
+ #ifdef SWIGPYTHON
4450
+ %extend casadi::DeserializerBase {
4451
+ %pythoncode %{
4452
+ def unpack(self):
4453
+ type = SerializerBase.type_to_string(self._pop_type())
4454
+ f = getattr(self, "blind_unpack_"+type)
4455
+ return f()
4456
+ %}
4457
+ }
4458
+ #endif // SWIGPYTHON
4459
+ #ifdef SWIGMATLAB
4460
+ %extend casadi::DeserializerBase {
4461
+ %matlabcode %{
4462
+ function out = unpack(self)
4463
+ type = casadi.SerializerBase.type_to_string(self.internal_pop_type);
4464
+ out = self.(['blind_unpack_' type]);
4465
+ end
4466
+ %}
4467
+ }
4468
+ #endif // SWIGMATLAB
4469
+
4470
+ %feature("director") casadi::OptiCallback;
4471
+
4472
+ // Return-by-value
4473
+ %typemap(out, doc="double", noblock=1, fragment="casadi_all") casadi::native_DM {
4474
+ if(!($result = full_or_sparse($1, true))) SWIG_exception_fail(SWIG_TypeError,"Failed to convert output to type 'double'.");
4475
+ }
4476
+
4477
+
4478
+ %apply casadi_int &OUTPUT { Opti::ConstraintType &OUTPUT };
4479
+
4480
+ %typemap(argout, noblock=1,fragment="casadi_all") casadi::Opti::ConstraintType &OUTPUT {
4481
+ %append_output(casadi::from_ptr((casadi_int *) $1));
4482
+ }
4483
+
4484
+ %typemap(in, doc="Opti.ConstraintType", noblock=1, numinputs=0) casadi::Opti::ConstraintType &OUTPUT (casadi::Opti::ConstraintType m) {
4485
+ $1 = &m;
4486
+ }
4487
+
4488
+
4489
+ #ifdef SWIGPYTHON
4490
+
4491
+ %define make_property(class, name)
4492
+ %rename(_ ## name) class ## :: ## name;
4493
+ %extend class {
4494
+ %pythoncode %{
4495
+ @property
4496
+ def name(self):
4497
+ return self._ ## name()
4498
+ %}
4499
+ }
4500
+ %enddef
4501
+
4502
+
4503
+ make_property(casadi::Opti, debug);
4504
+ make_property(casadi::Opti, advanced);
4505
+ make_property(casadi::OptiSol, opti);
4506
+
4507
+ %define make_property_opti(name)
4508
+ make_property(casadi::Opti, name);
4509
+ %enddef
4510
+
4511
+ make_property(casadi::OptiSol, debug);
4512
+ make_property_opti(f)
4513
+ make_property_opti(g)
4514
+ make_property_opti(x)
4515
+ make_property_opti(p)
4516
+ make_property_opti(lam_g)
4517
+ make_property_opti(lbg)
4518
+ make_property_opti(ubg)
4519
+ make_property_opti(nx)
4520
+ make_property_opti(np)
4521
+ make_property_opti(ng)
4522
+
4523
+ make_property(casadi::Opti, casadi_solver);
4524
+ %define opti_metadata_modifiers(class)
4525
+ %rename(_variable) class ## :: variable;
4526
+ %rename(_parameter) class ## :: parameter;
4527
+ %rename(_subject_to) class ## :: subject_to;
4528
+ %extend class {
4529
+ %pythoncode %{
4530
+ def parameter(self,*args):
4531
+ import sys
4532
+ import os
4533
+ try:
4534
+ frame = sys._getframe(1)
4535
+ except:
4536
+ frame = {}
4537
+ meta = {} if frame is None else {"stacktrace": {"file":os.path.abspath(frame.f_code.co_filename),"line":frame.f_lineno,"name":frame.f_code.co_name}}
4538
+ ret = self._parameter(*args)
4539
+ if len(meta)>0:
4540
+ self.update_user_dict(ret, meta)
4541
+ return ret
4542
+
4543
+ def variable(self,*args):
4544
+ import sys
4545
+ import os
4546
+ try:
4547
+ frame = sys._getframe(1)
4548
+ except:
4549
+ frame = {}
4550
+ meta = {} if frame is None else {"stacktrace": {"file":os.path.abspath(frame.f_code.co_filename),"line":frame.f_lineno,"name":frame.f_code.co_name}}
4551
+ ret = self._variable(*args)
4552
+ if len(meta)>0:
4553
+ self.update_user_dict(ret, meta)
4554
+ return ret
4555
+
4556
+ def subject_to(self,*args):
4557
+ if len(args)==0:
4558
+ return self._subject_to()
4559
+ import sys
4560
+ import os
4561
+ try:
4562
+ frame = sys._getframe(1)
4563
+ except:
4564
+ frame = {}
4565
+ meta = {} if frame is None else {"stacktrace": {"file":os.path.abspath(frame.f_code.co_filename),"line":frame.f_lineno,"name":frame.f_code.co_name}}
4566
+ ret = self._subject_to(*args)
4567
+ if len(meta)>0:
4568
+ self.update_user_dict(args[0], meta)
4569
+ return ret
4570
+ %}
4571
+ }
4572
+ %enddef
4573
+
4574
+ opti_metadata_modifiers(casadi::Opti);
4575
+
4576
+ #endif
4577
+
4578
+
4579
+ #ifdef SWIGMATLAB
4580
+ %define opti_metadata_modifiers(class)
4581
+ %rename(internal_variable) class ## ::variable;
4582
+ %rename(internal_parameter) class ## ::parameter;
4583
+ %rename(internal_subject_to) class ## ::subject_to;
4584
+ %extend class {
4585
+ %matlabcode %{
4586
+ function out = variable(self, varargin)
4587
+ st = dbstack('-completenames',1);
4588
+ if length(st)>0
4589
+ meta = struct('stacktrace', st(1));
4590
+ else
4591
+ meta = struct;
4592
+ end
4593
+ out = self.internal_variable(varargin{:});
4594
+ self.update_user_dict(out, meta);
4595
+ end
4596
+ function out = parameter(self, varargin)
4597
+ st = dbstack('-completenames',1);
4598
+ if length(st)>0
4599
+ meta = struct('stacktrace', st(1));
4600
+ else
4601
+ meta = struct;
4602
+ end
4603
+ out = self.internal_parameter(varargin{:});
4604
+ self.update_user_dict(out, meta);
4605
+ end
4606
+ function [] = subject_to(self, varargin)
4607
+ if length(varargin)==0
4608
+ self.internal_subject_to();
4609
+ return;
4610
+ end
4611
+ st = dbstack('-completenames',1);
4612
+ if length(st)>0
4613
+ meta = struct('stacktrace', st(1));
4614
+ else
4615
+ meta = struct;
4616
+ end
4617
+ self.internal_subject_to(varargin{:});
4618
+ self.update_user_dict(varargin{1}, meta);
4619
+ end
4620
+ %}
4621
+ }
4622
+ %enddef
4623
+
4624
+ opti_metadata_modifiers(casadi::Opti)
4625
+ #endif
4626
+ %include <casadi/core/optistack.hpp>
4627
+
4628
+
4629
+ #ifdef SWIGPYTHON
4630
+ %extend casadi::Opti {
4631
+ %pythoncode %{
4632
+
4633
+ @staticmethod
4634
+ def _callback(self,fh=None):
4635
+ if fh is None:
4636
+ self.callback_class();
4637
+ return
4638
+ class OptiCallbackHelper(OptiCallback):
4639
+ def __init__(self, callback):
4640
+ OptiCallback.__init__(self)
4641
+ self.callback = callback
4642
+
4643
+ def call(self, i):
4644
+ self.callback(i)
4645
+
4646
+ self._fh = fh
4647
+ self._cb = OptiCallbackHelper(fh);
4648
+ self.callback_class(self._cb);
4649
+
4650
+
4651
+ def callback(self,fh=None):
4652
+ self._callback(self,fh)
4653
+
4654
+
4655
+ %}
4656
+
4657
+ }
4658
+ #endif
4659
+
4660
+ #ifdef SWIGMATLAB
4661
+ %extend casadi::Opti {
4662
+ %matlabcode %{
4663
+ function [] = callback(self, varargin)
4664
+ casadi.OptiCallbackHelper.callback_setup(self, varargin{:})
4665
+ end
4666
+ %}
4667
+ }
4668
+ #endif
4669
+
4670
+ // Cleanup for dependent modules
4671
+ %exception {
4672
+ $action
4673
+ }