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