casadi 3.6.2__cp311-none-manylinux2014_i686.whl → 3.6.4__cp311-none-manylinux2014_i686.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- casadi/_casadi.so +0 -0
- casadi/casadi.py +217 -60
- casadi/cbc +0 -0
- casadi/clp +0 -0
- casadi/cmake/alpaqa/alpaqaConfig.cmake +24 -0
- casadi/cmake/alpaqa/alpaqaConfigVersion.cmake +70 -0
- casadi/cmake/alpaqa/alpaqaTargets-release.cmake +29 -0
- casadi/cmake/alpaqa/alpaqaTargets.cmake +131 -0
- casadi/cmake/casadi-config-version.cmake +1 -1
- casadi/cmake/casadi-config.cmake +4 -0
- casadi/cmake/highs/highs-config.cmake +18 -4
- casadi/cmake/highs/highs-targets-release.cmake +3 -3
- casadi/cmake/highs/highs-targets.cmake +1 -1
- casadi/cmake/sleqp/sleqp-config-version.cmake +70 -0
- casadi/cmake/sleqp/sleqp-config.cmake +1 -0
- casadi/cmake/sleqp/sleqp-targets-release.cmake +20 -0
- casadi/cmake/sleqp/sleqp-targets.cmake +102 -0
- casadi/cmake/trlib/trlib-config-release.cmake +19 -0
- casadi/cmake/trlib/trlib-config-version.cmake +88 -0
- casadi/cmake/trlib/trlib-config.cmake +107 -0
- casadi/highs +0 -0
- casadi/include/casadi/casadi.i +20 -3
- casadi/include/casadi/config.h +8 -8
- casadi/include/casadi/core/calculus.hpp +1 -1
- casadi/include/casadi/core/code_generator.hpp +10 -0
- casadi/include/casadi/core/fmu.hpp +224 -0
- casadi/include/casadi/core/generic_matrix.hpp +4 -2
- casadi/include/casadi/core/nlpsol.hpp +0 -2
- casadi/include/casadi/core/runtime/casadi_finite_diff.hpp +204 -11
- casadi/include/casadi/core/serializing_stream.hpp +12 -0
- casadi/include/casadi/core/sparsity_interface.hpp +55 -1
- casadi/include/casadi/doc.i +916 -462
- casadi/include/casadi/doc_merged.i +492 -176
- casadi/include/casadi/mem.h +13 -2
- casadi/include/casadi/valgrind-casadi.supp +82 -0
- casadi/include/casadi/valgrind-python.supp +39 -0
- casadi/include/highs/HConfig.h +4 -7
- casadi/include/highs/Highs.h +240 -51
- casadi/include/highs/filereaderlp/builder.hpp +12 -13
- casadi/include/highs/filereaderlp/model.hpp +32 -35
- casadi/include/highs/fortran/highs_fortran_api.mod +0 -0
- casadi/include/highs/interfaces/highs_c_api.h +964 -577
- casadi/include/highs/io/Filereader.h +2 -4
- casadi/include/highs/io/FilereaderEms.h +2 -4
- casadi/include/highs/io/FilereaderLp.h +2 -4
- casadi/include/highs/io/FilereaderMps.h +2 -4
- casadi/include/highs/io/HMPSIO.h +2 -4
- casadi/include/highs/io/HMpsFF.h +2 -4
- casadi/include/highs/io/HighsIO.h +19 -13
- casadi/include/highs/io/LoadOptions.h +7 -6
- casadi/include/highs/ipm/IpxWrapper.h +4 -5
- casadi/include/highs/lp_data/HConst.h +60 -15
- casadi/include/highs/lp_data/HStruct.h +32 -8
- casadi/include/highs/lp_data/HighsAnalysis.h +2 -4
- casadi/include/highs/lp_data/HighsCallback.h +33 -0
- casadi/include/highs/lp_data/HighsCallbackStruct.h +36 -0
- casadi/include/highs/lp_data/HighsDebug.h +2 -4
- casadi/include/highs/lp_data/HighsInfo.h +22 -23
- casadi/include/highs/lp_data/HighsInfoDebug.h +2 -4
- casadi/include/highs/lp_data/HighsLp.h +14 -6
- casadi/include/highs/lp_data/HighsLpSolverObject.h +6 -5
- casadi/include/highs/lp_data/HighsLpUtils.h +23 -12
- casadi/include/highs/lp_data/HighsModelUtils.h +22 -8
- casadi/include/highs/lp_data/HighsOptions.h +175 -106
- casadi/include/highs/lp_data/HighsRanging.h +2 -4
- casadi/include/highs/lp_data/HighsRuntimeOptions.h +21 -6
- casadi/include/highs/lp_data/HighsSolution.h +4 -4
- casadi/include/highs/lp_data/HighsSolutionDebug.h +2 -4
- casadi/include/highs/lp_data/HighsSolve.h +2 -4
- casadi/include/highs/lp_data/HighsStatus.h +2 -4
- casadi/include/highs/mip/HighsCliqueTable.h +18 -20
- casadi/include/highs/mip/HighsConflictPool.h +2 -4
- casadi/include/highs/mip/HighsCutGeneration.h +2 -4
- casadi/include/highs/mip/HighsCutPool.h +2 -4
- casadi/include/highs/mip/HighsDebugSol.h +2 -4
- casadi/include/highs/mip/HighsDomain.h +5 -5
- casadi/include/highs/mip/HighsDomainChange.h +2 -4
- casadi/include/highs/mip/HighsDynamicRowMatrix.h +2 -4
- casadi/include/highs/mip/HighsGFkSolve.h +2 -4
- casadi/include/highs/mip/HighsImplications.h +2 -4
- casadi/include/highs/mip/HighsLpAggregator.h +2 -4
- casadi/include/highs/mip/HighsLpRelaxation.h +2 -4
- casadi/include/highs/mip/HighsMipSolver.h +18 -6
- casadi/include/highs/mip/HighsMipSolverData.h +8 -4
- casadi/include/highs/mip/HighsModkSeparator.h +2 -4
- casadi/include/highs/mip/HighsNodeQueue.h +3 -9
- casadi/include/highs/mip/HighsObjectiveFunction.h +2 -4
- casadi/include/highs/mip/HighsPathSeparator.h +2 -4
- casadi/include/highs/mip/HighsPrimalHeuristics.h +2 -4
- casadi/include/highs/mip/HighsPseudocost.h +2 -4
- casadi/include/highs/mip/HighsRedcostFixing.h +2 -4
- casadi/include/highs/mip/HighsSearch.h +2 -4
- casadi/include/highs/mip/HighsSeparation.h +2 -4
- casadi/include/highs/mip/HighsSeparator.h +2 -4
- casadi/include/highs/mip/HighsTableauSeparator.h +2 -4
- casadi/include/highs/mip/HighsTransformedLp.h +2 -4
- casadi/include/highs/model/HighsHessian.h +3 -1
- casadi/include/highs/model/HighsModel.h +2 -0
- casadi/include/highs/parallel/HighsSpinMutex.h +2 -1
- casadi/include/highs/parallel/HighsSplitDeque.h +1 -1
- casadi/include/highs/parallel/HighsTaskExecutor.h +10 -2
- casadi/include/highs/presolve/HPresolve.h +9 -6
- casadi/include/highs/presolve/HPresolveAnalysis.h +5 -4
- casadi/include/highs/presolve/HighsPostsolveStack.h +50 -13
- casadi/include/highs/presolve/HighsSymmetry.h +2 -4
- casadi/include/highs/presolve/ICrash.h +4 -3
- casadi/include/highs/presolve/ICrashUtil.h +2 -2
- casadi/include/highs/presolve/ICrashX.h +4 -6
- casadi/include/highs/presolve/PresolveComponent.h +4 -42
- casadi/include/highs/qpsolver/a_asm.hpp +56 -0
- casadi/include/highs/qpsolver/a_quass.hpp +12 -0
- casadi/include/highs/qpsolver/quass.hpp +1 -4
- casadi/include/highs/simplex/HApp.h +14 -16
- casadi/include/highs/simplex/HEkk.h +12 -11
- casadi/include/highs/simplex/HEkkDual.h +2 -4
- casadi/include/highs/simplex/HEkkDualRHS.h +5 -6
- casadi/include/highs/simplex/HEkkDualRow.h +2 -4
- casadi/include/highs/simplex/HEkkPrimal.h +2 -4
- casadi/include/highs/simplex/HSimplex.h +2 -4
- casadi/include/highs/simplex/HSimplexDebug.h +2 -4
- casadi/include/highs/simplex/HSimplexNla.h +2 -4
- casadi/include/highs/simplex/HSimplexReport.h +3 -5
- casadi/include/highs/simplex/HighsSimplexAnalysis.h +2 -4
- casadi/include/highs/simplex/SimplexConst.h +7 -5
- casadi/include/highs/simplex/SimplexStruct.h +11 -5
- casadi/include/highs/simplex/SimplexTimer.h +2 -4
- casadi/include/highs/test/DevKkt.h +2 -4
- casadi/include/highs/test/KktCh2.h +2 -4
- casadi/include/highs/util/FactorTimer.h +2 -4
- casadi/include/highs/util/HFactor.h +2 -4
- casadi/include/highs/util/HFactorConst.h +2 -4
- casadi/include/highs/util/HFactorDebug.h +2 -4
- casadi/include/highs/util/HSet.h +3 -5
- casadi/include/highs/util/HVector.h +2 -4
- casadi/include/highs/util/HVectorBase.h +2 -4
- casadi/include/highs/util/HighsCDouble.h +2 -4
- casadi/include/highs/util/HighsComponent.h +2 -4
- casadi/include/highs/util/HighsDataStack.h +3 -5
- casadi/include/highs/util/HighsDisjointSets.h +8 -10
- casadi/include/highs/util/HighsHash.h +22 -7
- casadi/include/highs/util/HighsHashTree.h +25 -7
- casadi/include/highs/util/HighsInt.h +2 -4
- casadi/include/highs/util/HighsIntegers.h +2 -4
- casadi/include/highs/util/HighsLinearSumBounds.h +2 -4
- casadi/include/highs/util/HighsMatrixPic.h +2 -4
- casadi/include/highs/util/HighsMatrixSlice.h +2 -4
- casadi/include/highs/util/HighsMatrixUtils.h +2 -4
- casadi/include/highs/util/HighsRandom.h +2 -4
- casadi/include/highs/util/HighsRbTree.h +2 -4
- casadi/include/highs/util/HighsSort.h +2 -4
- casadi/include/highs/util/HighsSparseMatrix.h +11 -7
- casadi/include/highs/util/HighsSparseVectorSum.h +2 -4
- casadi/include/highs/util/HighsSplay.h +2 -4
- casadi/include/highs/util/HighsTimer.h +3 -4
- casadi/include/highs/util/HighsUtils.h +14 -4
- casadi/include/highs/util/stringutil.h +2 -4
- casadi/include/licenses/alpaqa-external/LICENSE +165 -0
- casadi/include/licenses/highs-external/LICENSE +1 -1
- casadi/include/licenses/sleqp-external/LICENSE +165 -0
- casadi/include/licenses/trlib-external/LICENSE +21 -0
- casadi/include/trlib/trlib_eigen_inverse.h +118 -0
- casadi/include/trlib/trlib_krylov.h +493 -0
- casadi/include/trlib/trlib_leftmost.h +181 -0
- casadi/include/trlib/trlib_private.h +109 -0
- casadi/include/trlib/trlib_quadratic_zero.h +57 -0
- casadi/include/trlib/trlib_tri_factor.h +409 -0
- casadi/include/trlib/trlib_types.h +36 -0
- casadi/lib/libtinyxml2.a +0 -0
- casadi/libCbc.la +3 -3
- casadi/libCbc.so +0 -0
- casadi/libCbc.so.3 +0 -0
- casadi/libCbc.so.3.10.11 +0 -0
- casadi/libCbcSolver.la +3 -3
- casadi/libCbcSolver.so +0 -0
- casadi/libCbcSolver.so.3 +0 -0
- casadi/libCbcSolver.so.3.10.11 +0 -0
- casadi/libCgl.la +2 -2
- casadi/libCgl.so +0 -0
- casadi/libCgl.so.1 +0 -0
- casadi/libCgl.so.1.10.8 +0 -0
- casadi/libClp.la +2 -2
- casadi/libClp.so +0 -0
- casadi/libClp.so.1 +0 -0
- casadi/{libClp.so.1.14.7 → libClp.so.1.14.9} +0 -0
- casadi/libClpSolver.la +2 -2
- casadi/libClpSolver.so +0 -0
- casadi/libClpSolver.so.1 +0 -0
- casadi/{libClpSolver.so.1.14.7 → libClpSolver.so.1.14.9} +0 -0
- casadi/libCoinUtils.la +2 -2
- casadi/libCoinUtils.so +0 -0
- casadi/libCoinUtils.so.3 +0 -0
- casadi/libCoinUtils.so.3.11.10 +0 -0
- casadi/libFortranHighs.so +0 -0
- casadi/libOsi.la +2 -2
- casadi/libOsiCbc.la +3 -3
- casadi/libOsiCbc.so +0 -0
- casadi/libOsiCbc.so.3 +0 -0
- casadi/{libOsiCbc.so.3.10.6 → libOsiCbc.so.3.10.11} +0 -0
- casadi/libOsiClp.la +2 -2
- casadi/libOsiClp.so +0 -0
- casadi/libOsiClp.so.1 +0 -0
- casadi/libOsiClp.so.1.14.9 +0 -0
- casadi/libOsiCommonTests.la +2 -2
- casadi/libOsiCommonTests.so +0 -0
- casadi/libOsiCommonTests.so.1 +0 -0
- casadi/{libOsiCommonTests.so.1.13.7 → libOsiCommonTests.so.1.13.9} +0 -0
- casadi/libalpaqa-dl-loader.so +0 -0
- casadi/libalpaqa-dl-loader.so.1.0.0 +0 -0
- casadi/libalpaqa.so +0 -0
- casadi/libalpaqa.so.1.0.0 +0 -0
- casadi/libbonmin.la +3 -3
- casadi/libbonmin.so +0 -0
- casadi/libbonmin.so.4 +0 -0
- casadi/libbonmin.so.4.8.9 +0 -0
- casadi/libcasadi.so +0 -0
- casadi/libcasadi.so.3.7 +0 -0
- casadi/libcasadi_conic_cbc.so +0 -0
- casadi/libcasadi_conic_cbc.so.3.7 +0 -0
- casadi/libcasadi_conic_clp.so +0 -0
- casadi/libcasadi_conic_clp.so.3.7 +0 -0
- casadi/libcasadi_conic_gurobi.so +0 -0
- casadi/libcasadi_conic_gurobi.so.3.7 +0 -0
- casadi/libcasadi_conic_highs.so +0 -0
- casadi/libcasadi_conic_highs.so.3.7 +0 -0
- casadi/libcasadi_conic_ipqp.so +0 -0
- casadi/libcasadi_conic_ipqp.so.3.7 +0 -0
- casadi/libcasadi_conic_nlpsol.so +0 -0
- casadi/libcasadi_conic_nlpsol.so.3.7 +0 -0
- casadi/libcasadi_conic_osqp.so +0 -0
- casadi/libcasadi_conic_osqp.so.3.7 +0 -0
- casadi/libcasadi_conic_proxqp.so +0 -0
- casadi/libcasadi_conic_proxqp.so.3.7 +0 -0
- casadi/libcasadi_conic_qpoases.so +0 -0
- casadi/libcasadi_conic_qpoases.so.3.7 +0 -0
- casadi/libcasadi_conic_qrqp.so +0 -0
- casadi/libcasadi_conic_qrqp.so.3.7 +0 -0
- casadi/libcasadi_conic_superscs.so +0 -0
- casadi/libcasadi_conic_superscs.so.3.7 +0 -0
- casadi/libcasadi_integrator_collocation.so +0 -0
- casadi/libcasadi_integrator_collocation.so.3.7 +0 -0
- casadi/libcasadi_integrator_cvodes.so +0 -0
- casadi/libcasadi_integrator_cvodes.so.3.7 +0 -0
- casadi/libcasadi_integrator_idas.so +0 -0
- casadi/libcasadi_integrator_idas.so.3.7 +0 -0
- casadi/libcasadi_interpolant_bspline.so +0 -0
- casadi/libcasadi_interpolant_bspline.so.3.7 +0 -0
- casadi/libcasadi_interpolant_linear.so +0 -0
- casadi/libcasadi_interpolant_linear.so.3.7 +0 -0
- casadi/libcasadi_linsol_lapacklu.so +0 -0
- casadi/libcasadi_linsol_lapacklu.so.3.7 +0 -0
- casadi/libcasadi_linsol_lapackqr.so +0 -0
- casadi/libcasadi_linsol_lapackqr.so.3.7 +0 -0
- casadi/libcasadi_linsol_ldl.so +0 -0
- casadi/libcasadi_linsol_ldl.so.3.7 +0 -0
- casadi/libcasadi_linsol_mumps.so +0 -0
- casadi/libcasadi_linsol_mumps.so.3.7 +0 -0
- casadi/libcasadi_linsol_qr.so +0 -0
- casadi/libcasadi_linsol_qr.so.3.7 +0 -0
- casadi/libcasadi_linsol_symbolicqr.so +0 -0
- casadi/libcasadi_linsol_symbolicqr.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_alpaqa.so +0 -0
- casadi/libcasadi_nlpsol_alpaqa.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_ampl.so +0 -0
- casadi/libcasadi_nlpsol_ampl.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_blocksqp.so +0 -0
- casadi/libcasadi_nlpsol_blocksqp.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_bonmin.so +0 -0
- casadi/libcasadi_nlpsol_bonmin.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_feasiblesqpmethod.so +0 -0
- casadi/libcasadi_nlpsol_feasiblesqpmethod.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_ipopt.so +0 -0
- casadi/libcasadi_nlpsol_ipopt.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_knitro.so +0 -0
- casadi/libcasadi_nlpsol_knitro.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_qrsqp.so +0 -0
- casadi/libcasadi_nlpsol_qrsqp.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_scpgen.so +0 -0
- casadi/libcasadi_nlpsol_scpgen.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_sleqp.so +0 -0
- casadi/libcasadi_nlpsol_sleqp.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_snopt.so +0 -0
- casadi/libcasadi_nlpsol_snopt.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_sqpmethod.so +0 -0
- casadi/libcasadi_nlpsol_sqpmethod.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_worhp.so +0 -0
- casadi/libcasadi_nlpsol_worhp.so.3.7 +0 -0
- casadi/libcasadi_rootfinder_fast_newton.so +0 -0
- casadi/libcasadi_rootfinder_fast_newton.so.3.7 +0 -0
- casadi/libcasadi_rootfinder_newton.so +0 -0
- casadi/libcasadi_rootfinder_newton.so.3.7 +0 -0
- casadi/libcasadi_sundials_common.so +0 -0
- casadi/libcasadi_sundials_common.so.3.7 +0 -0
- casadi/libhighs.so +0 -0
- casadi/libhighs.so.1.6 +0 -0
- casadi/libhighs.so.1.6.0 +0 -0
- casadi/libindirect.a +0 -0
- casadi/liblinsys.a +0 -0
- casadi/libosqp.a +0 -0
- casadi/libqdldl.a +0 -0
- casadi/libsleqp.so +0 -0
- casadi/libsleqp.so.1.0.1 +0 -0
- casadi/libspral.a +0 -0
- casadi/libsuperscs.a +0 -0
- casadi/libtrlib.so +0 -0
- casadi/libtrlib.so.0.4 +0 -0
- casadi/pkgconfig/blas.pc +11 -0
- casadi/pkgconfig/bonmin.pc +1 -1
- casadi/pkgconfig/casadi.pc +1 -1
- casadi/pkgconfig/cbc.pc +2 -2
- casadi/pkgconfig/cgl.pc +2 -2
- casadi/pkgconfig/clp.pc +1 -1
- casadi/pkgconfig/coinutils.pc +1 -1
- casadi/pkgconfig/highs.pc +3 -3
- casadi/pkgconfig/lapack.pc +11 -0
- casadi/pkgconfig/openblas.pc +1 -1
- casadi/pkgconfig/osi-cbc.pc +1 -1
- casadi/pkgconfig/osi-clp.pc +1 -1
- casadi/pkgconfig/osi-unittests.pc +1 -1
- casadi/pkgconfig/osi.pc +1 -1
- casadi/pkgconfig/sleqp.pc +10 -0
- {casadi-3.6.2.dist-info → casadi-3.6.4.dist-info}/METADATA +1 -1
- {casadi-3.6.2.dist-info → casadi-3.6.4.dist-info}/RECORD +324 -283
- casadi/libCbc.so.3.10.6 +0 -0
- casadi/libCbcSolver.so.3.10.6 +0 -0
- casadi/libCgl.so.1.10.4 +0 -0
- casadi/libCoinUtils.so.3.11.6 +0 -0
- casadi/libOsiClp.so.1.14.7 +0 -0
- casadi/libbonmin.so.4.8.8 +0 -0
- casadi/libhighs.so.1.4 +0 -0
- casadi/libhighs.so.1.4.0 +0 -0
- /casadi/{libOsi.so.1.13.7 → libOsi.so.1.13.9} +0 -0
- {casadi-3.6.2.dist-info → casadi-3.6.4.dist-info}/WHEEL +0 -0
@@ -17,6 +17,201 @@
|
|
17
17
|
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
18
18
|
//
|
19
19
|
|
20
|
+
// C-REPLACE "std::numeric_limits<T1>::quiet_NaN()" "NAN"
|
21
|
+
// C-REPLACE "fmax" "casadi_fmax"
|
22
|
+
|
23
|
+
// SYMBOL "forward_diff"
|
24
|
+
template<typename T1>
|
25
|
+
void casadi_forward_diff(const T1** yk, T1* J, T1 h, casadi_int n_y) {
|
26
|
+
// Local variables
|
27
|
+
casadi_int i;
|
28
|
+
const double *yf, *yc;
|
29
|
+
T1 hinv;
|
30
|
+
// Inverse of step size
|
31
|
+
hinv = 1. / h;
|
32
|
+
// Get stencil
|
33
|
+
yc = yk[0];
|
34
|
+
yf = yk[1];
|
35
|
+
// Calculate FD approximation
|
36
|
+
for (i = 0; i < n_y; ++i) J[i] = hinv * (yf[i] - yc[i]);
|
37
|
+
}
|
38
|
+
|
39
|
+
// SYMBOL "central_diff"
|
40
|
+
template<typename T1>
|
41
|
+
void casadi_central_diff(const T1** yk, T1* J, T1 h, casadi_int n_y) {
|
42
|
+
// Local variables
|
43
|
+
casadi_int i;
|
44
|
+
const T1 *yf, *yc, *yb;
|
45
|
+
T1 hinv;
|
46
|
+
// Inverse of step size
|
47
|
+
hinv = 1. / h;
|
48
|
+
// Get stencil
|
49
|
+
yb = yk[0];
|
50
|
+
yc = yk[1];
|
51
|
+
yf = yk[2];
|
52
|
+
// Set u and stencils to zero (also supresses warnings)
|
53
|
+
for (i = 0; i < n_y; ++i) {
|
54
|
+
if (isfinite(yb[i])) {
|
55
|
+
if (isfinite(yf[i])) {
|
56
|
+
// Both forward and backward allowed
|
57
|
+
J[i] = 0.5 * hinv * (yf[i] - yb[i]);
|
58
|
+
} else {
|
59
|
+
// Backward but not forward allowed
|
60
|
+
J[i] = hinv * (yc[i] - yb[i]);
|
61
|
+
}
|
62
|
+
} else {
|
63
|
+
if (isfinite(yf[i])) {
|
64
|
+
// Forward but not backward allowed
|
65
|
+
J[i] = hinv * (yf[i] - yc[i]);
|
66
|
+
} else {
|
67
|
+
// Neither forward nor backward possible
|
68
|
+
J[i] = std::numeric_limits<T1>::quiet_NaN();
|
69
|
+
}
|
70
|
+
}
|
71
|
+
}
|
72
|
+
}
|
73
|
+
|
74
|
+
// SYMBOL "central_diff_err"
|
75
|
+
template<typename T1>
|
76
|
+
T1 casadi_central_diff_err(const T1** yk, T1 h, casadi_int n_y, casadi_int i,
|
77
|
+
T1 abstol, T1 reltol) {
|
78
|
+
// Local variables
|
79
|
+
const T1 *yf, *yc, *yb;
|
80
|
+
T1 err_trunc, err_round;
|
81
|
+
// Get stencil
|
82
|
+
yb = yk[0];
|
83
|
+
yc = yk[1];
|
84
|
+
yf = yk[2];
|
85
|
+
// Only consider points where both forward and backward allowed
|
86
|
+
if (isfinite(yb[i]) && isfinite(yf[i])) {
|
87
|
+
// Truncation error
|
88
|
+
err_trunc = yf[i] - 2*yc[i] + yb[i];
|
89
|
+
// Roundoff error
|
90
|
+
err_round = reltol / h * fmax(fabs(yf[i] - yc[i]), fabs(yc[i] - yb[i])) + abstol;
|
91
|
+
// Error quotient estimate
|
92
|
+
return err_trunc / err_round;
|
93
|
+
} else {
|
94
|
+
// Cannot be calculated
|
95
|
+
return std::numeric_limits<T1>::quiet_NaN();;
|
96
|
+
}
|
97
|
+
}
|
98
|
+
|
99
|
+
// SYMBOL "smoothing_diff_weights"
|
100
|
+
template<typename T1>
|
101
|
+
T1 casadi_smoothing_diff_weights(casadi_int k, T1 yb, T1 yc, T1 yf, T1 *J) {
|
102
|
+
// Calculate shifted finite difference approximation, weights
|
103
|
+
if (k == 0) {
|
104
|
+
// Backward shifted
|
105
|
+
// 7.10 in Conte & Carl de Boor: Elementary Numerical Analysis (1972)
|
106
|
+
// and 25.3.4 in Abramowitz and Stegun, Handbook of Mathematical Functions (1964)
|
107
|
+
if (J) *J = 3 * yf - 4 * yc + yb;
|
108
|
+
// Relative weight is 1
|
109
|
+
return 1;
|
110
|
+
} else if (k == 1) {
|
111
|
+
// Central
|
112
|
+
// We give this the relative weight 4 since if all weights are equal,
|
113
|
+
// this would amount to a five point formula for the derivative
|
114
|
+
// (yb2 - 8*yb + 8*yf - y_f2)/(12*h)
|
115
|
+
// cf. 25.3.6 in Abramowitz and Stegun, Handbook of Mathematical Functions (1964)
|
116
|
+
if (J) *J = yf - yb;
|
117
|
+
// Relative weight is 4
|
118
|
+
return 4;
|
119
|
+
} else {
|
120
|
+
// Forward shifted, cf. backward shifted above
|
121
|
+
if (J) *J = -3 * yb + 4 * yc - yf;
|
122
|
+
// Relative weight is 1
|
123
|
+
return 1;
|
124
|
+
}
|
125
|
+
}
|
126
|
+
|
127
|
+
// SYMBOL "smoothing_diff"
|
128
|
+
template<typename T1>
|
129
|
+
void casadi_smoothing_diff(const T1** yk, T1* J, T1 h, casadi_int n_y, T1 smoothing) {
|
130
|
+
// Stencil
|
131
|
+
T1 yb, yc, yf;
|
132
|
+
// Local variables
|
133
|
+
T1 Jk, wk, sw, ui, sm;
|
134
|
+
casadi_int i, k;
|
135
|
+
// Set stencils to zero (also supresses warnings)
|
136
|
+
yf = yc = yb = 0;
|
137
|
+
for (i = 0; i < n_y; ++i) {
|
138
|
+
// Reset derivative estimate, sum of weights, error estimate
|
139
|
+
J[i] = sw = ui = 0;
|
140
|
+
// For backward shifted, central and forward shifted
|
141
|
+
for (k = 0; k < 3; ++k) {
|
142
|
+
// Get stencil
|
143
|
+
yb = yk[k][i];
|
144
|
+
yc = yk[k + 1][i];
|
145
|
+
yf = yk[k + 2][i];
|
146
|
+
// No contribuation if any value is infinite
|
147
|
+
if (!isfinite(yb) || !isfinite(yc) || !isfinite(yf)) continue;
|
148
|
+
// Calculate weights
|
149
|
+
wk = casadi_smoothing_diff_weights(k, yb, yc, yf, &Jk);
|
150
|
+
// Smoothness measure (second order derivative)
|
151
|
+
sm = yf - 2*yc + yb;
|
152
|
+
sm /= h*h;
|
153
|
+
// Modify the weight according to smoothness
|
154
|
+
wk /= sm*sm + smoothing;
|
155
|
+
sw += wk;
|
156
|
+
// Added weighted contribution to weight and error
|
157
|
+
J[i] += wk * Jk;
|
158
|
+
}
|
159
|
+
// If sw is 0, no stencil worked
|
160
|
+
if (sw == 0) {
|
161
|
+
// Set component to 0, return -1
|
162
|
+
J[i] = std::numeric_limits<T1>::quiet_NaN();
|
163
|
+
} else {
|
164
|
+
// Finalize estimate using the sum of weights and the step length
|
165
|
+
J[i] /= 2*h*sw;
|
166
|
+
}
|
167
|
+
}
|
168
|
+
}
|
169
|
+
|
170
|
+
// SYMBOL "smoothing_diff_err"
|
171
|
+
template<typename T1>
|
172
|
+
T1 casadi_smoothing_diff_err(const T1** yk, T1 h, casadi_int n_y, casadi_int i,
|
173
|
+
T1 abstol, T1 reltol, T1 smoothing) {
|
174
|
+
// Stencil
|
175
|
+
T1 yb, yc, yf;
|
176
|
+
// Local variables
|
177
|
+
T1 wk, sw, ui, err_trunc, err_round, sm;
|
178
|
+
casadi_int k;
|
179
|
+
// Set stencils to zero (also supresses warnings)
|
180
|
+
yf = yc = yb = 0;
|
181
|
+
// Reset derivative estimate, sum of weights, error estimate
|
182
|
+
sw = ui = 0;
|
183
|
+
// For backward shifted, central and forward shifted
|
184
|
+
for (k = 0; k < 3; ++k) {
|
185
|
+
// Get stencil
|
186
|
+
yb = yk[k][i];
|
187
|
+
yc = yk[k + 1][i];
|
188
|
+
yf = yk[k + 2][i];
|
189
|
+
// No contribuation if any value is infinite
|
190
|
+
if (!isfinite(yb) || !isfinite(yc) || !isfinite(yf)) continue;
|
191
|
+
// Calculate weights
|
192
|
+
wk = casadi_smoothing_diff_weights(k, yb, yc, yf, static_cast<T1*>(0));
|
193
|
+
// Truncation error
|
194
|
+
err_trunc = yf - 2*yc + yb;
|
195
|
+
// Roundoff error
|
196
|
+
err_round = reltol/h*fmax(fabs(yf - yc), fabs(yc - yb)) + abstol;
|
197
|
+
// We use the second order derivative as a smoothness measure
|
198
|
+
sm = err_trunc/(h*h);
|
199
|
+
// Modify the weight according to smoothness
|
200
|
+
wk /= sm*sm + smoothing;
|
201
|
+
sw += wk;
|
202
|
+
// Added weighted contribution to weight and error
|
203
|
+
ui += wk * fabs(err_trunc / err_round);
|
204
|
+
}
|
205
|
+
// If sw is 0, no stencil worked
|
206
|
+
if (sw == 0) {
|
207
|
+
// Cannot be calculated
|
208
|
+
return std::numeric_limits<T1>::quiet_NaN();;
|
209
|
+
} else {
|
210
|
+
// Finalize estimate using the sum of weights and the step length
|
211
|
+
return ui / sw;
|
212
|
+
}
|
213
|
+
}
|
214
|
+
|
20
215
|
// SYMBOL "finite_diff_mem"
|
21
216
|
template<typename T1>
|
22
217
|
struct casadi_finite_diff_mem {
|
@@ -31,13 +226,11 @@ struct casadi_finite_diff_mem {
|
|
31
226
|
};
|
32
227
|
|
33
228
|
// C-REPLACE "casadi_finite_diff_mem<T1>" "struct casadi_finite_diff_mem"
|
34
|
-
// C-REPLACE "std::numeric_limits<T1>::quiet_NaN()" "NAN"
|
35
|
-
// C-REPLACE "fmax" "casadi_fmax"
|
36
229
|
|
37
|
-
// SYMBOL "
|
230
|
+
// SYMBOL "forward_diff_old"
|
38
231
|
template<typename T1>
|
39
|
-
T1
|
40
|
-
|
232
|
+
T1 casadi_forward_diff_old(T1** yk, T1* y0, T1* J,
|
233
|
+
T1 h, casadi_int n_y, const casadi_finite_diff_mem<T1>* m) {
|
41
234
|
casadi_int i;
|
42
235
|
for (i=0; i<n_y; ++i) {
|
43
236
|
J[i] = (yk[0][i]-y0[i])/h;
|
@@ -45,10 +238,10 @@ T1 casadi_forward_diff(T1** yk, T1* y0, T1* J,
|
|
45
238
|
return -1;
|
46
239
|
}
|
47
240
|
|
48
|
-
// SYMBOL "
|
241
|
+
// SYMBOL "central_diff_old"
|
49
242
|
template<typename T1>
|
50
|
-
T1
|
51
|
-
|
243
|
+
T1 casadi_central_diff_old(T1** yk, T1* y0, T1* J,
|
244
|
+
T1 h, casadi_int n_y, const casadi_finite_diff_mem<T1>* m) {
|
52
245
|
// Return value
|
53
246
|
T1 u;
|
54
247
|
// Stencil
|
@@ -77,10 +270,10 @@ T1 casadi_central_diff(T1** yk, T1* y0, T1* J,
|
|
77
270
|
return u;
|
78
271
|
}
|
79
272
|
|
80
|
-
// SYMBOL "
|
273
|
+
// SYMBOL "smoothing_diff_old"
|
81
274
|
template<typename T1>
|
82
|
-
T1
|
83
|
-
|
275
|
+
T1 casadi_smoothing_diff_old(T1** yk, T1* y0, T1* J,
|
276
|
+
T1 h, casadi_int n_y, const casadi_finite_diff_mem<T1>* m) {
|
84
277
|
// Return value
|
85
278
|
T1 u;
|
86
279
|
// Stencil
|
@@ -29,6 +29,8 @@
|
|
29
29
|
#include <set>
|
30
30
|
#include <sstream>
|
31
31
|
#include <unordered_map>
|
32
|
+
#include <cstdint>
|
33
|
+
#include <climits>
|
32
34
|
|
33
35
|
namespace casadi {
|
34
36
|
class Slice;
|
@@ -39,6 +41,7 @@ namespace casadi {
|
|
39
41
|
class SXElem;
|
40
42
|
class GenericType;
|
41
43
|
class Importer;
|
44
|
+
class Fmu;
|
42
45
|
class SharedObject;
|
43
46
|
class SharedObjectInternal;
|
44
47
|
class SXNode;
|
@@ -90,10 +93,15 @@ namespace casadi {
|
|
90
93
|
}
|
91
94
|
void unpack(Function& e);
|
92
95
|
void unpack(Importer& e);
|
96
|
+
void unpack(Fmu& e);
|
93
97
|
void unpack(GenericType& e);
|
94
98
|
void unpack(std::ostream& s);
|
95
99
|
void unpack(Slice& e);
|
96
100
|
void unpack(int& e);
|
101
|
+
|
102
|
+
#if SIZE_MAX != UINT_MAX
|
103
|
+
void unpack(unsigned int& e);
|
104
|
+
#endif
|
97
105
|
void unpack(bool& e);
|
98
106
|
void unpack(casadi_int& e);
|
99
107
|
void unpack(size_t& e);
|
@@ -223,10 +231,14 @@ namespace casadi {
|
|
223
231
|
}
|
224
232
|
void pack(const Function& e);
|
225
233
|
void pack(const Importer& e);
|
234
|
+
void pack(const Fmu& e);
|
226
235
|
void pack(const Slice& e);
|
227
236
|
void pack(const GenericType& e);
|
228
237
|
void pack(std::istream& s);
|
229
238
|
void pack(int e);
|
239
|
+
#if SIZE_MAX != UINT_MAX
|
240
|
+
void pack(unsigned int e);
|
241
|
+
#endif
|
230
242
|
void pack(bool e);
|
231
243
|
void pack(casadi_int e);
|
232
244
|
void pack(size_t e);
|
@@ -72,6 +72,8 @@ namespace casadi {
|
|
72
72
|
static MatType mtimes(const std::vector<MatType> &args);
|
73
73
|
static std::vector<MatType > horzsplit(const MatType& x, casadi_int incr);
|
74
74
|
static std::vector<MatType > vertsplit(const MatType& x, casadi_int incr);
|
75
|
+
static std::vector<MatType > horzsplit_n(const MatType& x, casadi_int n);
|
76
|
+
static std::vector<MatType > vertsplit_n(const MatType& x, casadi_int n);
|
75
77
|
static MatType repmat(const MatType &A, const std::pair<casadi_int, casadi_int>& rc) {
|
76
78
|
return MatType::repmat(A, rc.first, rc.second);
|
77
79
|
}
|
@@ -122,15 +124,32 @@ namespace casadi {
|
|
122
124
|
|
123
125
|
/** \brief split horizontally, retaining fixed-sized groups of columns
|
124
126
|
|
125
|
-
* \param incr Size of each group of columns
|
127
|
+
* \param incr Size (width) of each group of columns
|
126
128
|
*
|
127
129
|
* horzcat(horzsplit(x, ...)) = x
|
130
|
+
*
|
131
|
+
* \seealso horzsplit_n
|
128
132
|
|
129
133
|
\identifier{3h} */
|
130
134
|
inline friend std::vector<MatType > horzsplit(const MatType& x, casadi_int incr=1) {
|
131
135
|
return MatType::horzsplit(x, incr);
|
132
136
|
}
|
133
137
|
|
138
|
+
/** \brief split horizontally, retaining fixed-sized groups of columns
|
139
|
+
|
140
|
+
* \param n Number of groups of columns
|
141
|
+
*
|
142
|
+
* Will error when the number of columns is not a multiple of n
|
143
|
+
*
|
144
|
+
* horzcat(horzsplit(x, ...)) = x
|
145
|
+
*
|
146
|
+
* \seealso horzsplit
|
147
|
+
|
148
|
+
\identifier{277} */
|
149
|
+
inline friend std::vector<MatType > horzsplit_n(const MatType& x, casadi_int n) {
|
150
|
+
return MatType::horzsplit_n(x, n);
|
151
|
+
}
|
152
|
+
|
134
153
|
/** \brief split vertically, retaining groups of rows
|
135
154
|
|
136
155
|
* \param output_offset List of all start rows for each group
|
@@ -178,11 +197,29 @@ namespace casadi {
|
|
178
197
|
[DM([0, 1]), DM([2, 3]), DM(4)]
|
179
198
|
\enddoctest
|
180
199
|
*
|
200
|
+
|
201
|
+
* \seealso vertsplit_n
|
202
|
+
|
181
203
|
\identifier{3k} */
|
182
204
|
inline friend std::vector<MatType > vertsplit(const MatType &x, casadi_int incr=1) {
|
183
205
|
return MatType::vertsplit(x, incr);
|
184
206
|
}
|
185
207
|
|
208
|
+
/** \brief split vertically, retaining fixed-sized groups of rows
|
209
|
+
|
210
|
+
* \param n Number of groups of rows
|
211
|
+
*
|
212
|
+
* Will error when the number of rows is not a multiple of n
|
213
|
+
*
|
214
|
+
* vertcat(vertsplit(x, ...)) = x
|
215
|
+
*
|
216
|
+
* \seealso vertsplit
|
217
|
+
|
218
|
+
\identifier{278} */
|
219
|
+
inline friend std::vector<MatType > vertsplit_n(const MatType& x, casadi_int n) {
|
220
|
+
return MatType::vertsplit_n(x, n);
|
221
|
+
}
|
222
|
+
|
186
223
|
/** \brief Construct a matrix from a list of list of blocks.
|
187
224
|
|
188
225
|
\identifier{3l} */
|
@@ -684,6 +721,23 @@ namespace casadi {
|
|
684
721
|
offset1.push_back(sz1);
|
685
722
|
return MatType::vertsplit(x, offset1);
|
686
723
|
}
|
724
|
+
template<typename MatType>
|
725
|
+
std::vector<MatType > SparsityInterface<MatType>::horzsplit_n(const MatType& x, casadi_int n) {
|
726
|
+
casadi_assert(n>=0, "horzsplit_n(x,n): n (" + str(n) + ") must be non-negative");
|
727
|
+
if (x.size2()==0) return std::vector<MatType>(n, x);
|
728
|
+
casadi_assert(x.size2() % n==0, "horzsplit_n(x,n): x.size2() (" + str(x.size2()) +
|
729
|
+
") must be a multiple of n (" + str(n) + ")");
|
730
|
+
return horzsplit(x, x.size2()/n);
|
731
|
+
}
|
732
|
+
template<typename MatType>
|
733
|
+
std::vector<MatType > SparsityInterface<MatType>::vertsplit_n(const MatType& x, casadi_int n) {
|
734
|
+
casadi_assert(n>=0, "vertsplit_n(x,n): n (" + str(n) + ") must be non-negative");
|
735
|
+
if (x.size1()==0) return std::vector<MatType>(n, x);
|
736
|
+
casadi_assert(x.size1() % n==0, "vertsplit(x,n): x.size1() (" + str(x.size1()) +
|
737
|
+
") must be a multiple of n (" + str(n) + ")");
|
738
|
+
return vertsplit(x, x.size1()/n);
|
739
|
+
}
|
740
|
+
|
687
741
|
#endif // SWIG
|
688
742
|
|
689
743
|
} // namespace casadi
|