packages feed

casadi-bindings 2.4.1.8 → 2.4.1.9

raw patch · 3 files changed

+17/−35 lines, 3 files

Files

casadi-bindings.cabal view
@@ -1,5 +1,5 @@ name:                casadi-bindings-version:             2.4.1.8+version:             2.4.1.9 synopsis:            mid-level bindings to CasADi category:            Numerical, Math description:
cbits/handwritten.cpp view
@@ -1,31 +1,11 @@-//#include <casadi/casadi.hpp>-//#include <cmath>-//#include <stdexcept>-//#include <iostream>-//-//extern "C"-//casadi::GenericType *-//custom_generic_dictionary(std::string ** err_msg,-//                          std::vector< std::string* >& keys,-//                          std::vector< casadi::GenericType* >& vals);-//-//casadi::GenericType *-//custom_generic_dictionary(std::string ** err_msg,-//                          std::vector< std::string* >& keys,-//                          std::vector< casadi::GenericType* >& vals) {-//    try {-//        const int nk = keys.size();-//        const int nv = vals.size();-//        if (nk != nv) throw "dictionary key/value length mismatch";-//        -//        casadi::Dictionary dict;-//        for (int k = 0; k < nk; k++)-//            dict.insert(std::pair<std::string,casadi::GenericType>(*(keys[k]), *(vals[k])));-//-//        return new casadi::GenericType(dict);-//-//    } catch (std::exception& ex) {-//         *err_msg = new std::string(ex.what());-//         return 0;-//    }-//}+#include "math.h"++extern "C" double c_fmod(double x, double y);+double c_fmod(double x, double y) {+  return fmod(x, y);+}++extern "C" float c_fmodf(float x, float y);+float c_fmodf(float x, float y) {+  return fmodf(x, y);+}
src/Casadi/Overloading.hs view
@@ -9,15 +9,17 @@        , ifLeqThen, ifGeqThen, ifEqThen, ifLtThen, ifGtThen        ) where -import Data.Fixed ( mod' )+import Foreign.C.Types ( CDouble(..), CFloat(..) ) import SpatialMath ( ArcTan2(..) )  -- | doesn't require Real, used for overloading symbolics class Fmod a where   fmod :: a -> a -> a -instance Fmod Double where fmod = mod'-instance Fmod Float where fmod = mod'+foreign import ccall unsafe "c_fmod" c_fmod :: CDouble -> CDouble -> CDouble+foreign import ccall unsafe "c_fmodf" c_fmodf :: CFloat -> CFloat -> CFloat+instance Fmod Double where fmod x y = realToFrac $ c_fmod (realToFrac x) (realToFrac y)+instance Fmod Float where fmod x y = realToFrac $ c_fmodf (realToFrac x) (realToFrac y)  -- | error function class Erf a where