diff options
author | Alberto Ruiz <aruiz@um.es> | 2015-06-19 13:55:39 +0200 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2015-06-19 13:55:39 +0200 |
commit | db50bc11dafa6834a4367427156306674063ed6b (patch) | |
tree | 721e9d0235168be1d0ebb2bd1dd254a66251f274 /packages/glpk | |
parent | 7f9c7b5adf8f05653d15f19358f41c1916e8db70 (diff) |
removed the annoying appN adapter for the foreign functions.
replaced by several overloaded app variants in the style of
the module Internal.Foreign contributed by Mike Ledger.
Diffstat (limited to 'packages/glpk')
-rw-r--r-- | packages/glpk/src/Numeric/LinearProgramming.hs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/packages/glpk/src/Numeric/LinearProgramming.hs b/packages/glpk/src/Numeric/LinearProgramming.hs index 7bf4279..0a776fa 100644 --- a/packages/glpk/src/Numeric/LinearProgramming.hs +++ b/packages/glpk/src/Numeric/LinearProgramming.hs | |||
@@ -275,6 +275,11 @@ mkConstrS n objfun b1 = fromLists (ob ++ co) where | |||
275 | 275 | ||
276 | ----------------------------------------------------- | 276 | ----------------------------------------------------- |
277 | 277 | ||
278 | (##) :: TransArray c => TransRaw c b -> c -> b | ||
279 | infixl 1 ## | ||
280 | a ## b = applyRaw a b | ||
281 | {-# INLINE (##) #-} | ||
282 | |||
278 | foreign import ccall unsafe "c_simplex_sparse" c_simplex_sparse | 283 | foreign import ccall unsafe "c_simplex_sparse" c_simplex_sparse |
279 | :: CInt -> CInt -- rows and cols | 284 | :: CInt -> CInt -- rows and cols |
280 | -> CInt -> CInt -> Ptr Double -- coeffs | 285 | -> CInt -> CInt -> Ptr Double -- coeffs |
@@ -285,7 +290,7 @@ foreign import ccall unsafe "c_simplex_sparse" c_simplex_sparse | |||
285 | simplexSparse :: Int -> Int -> Matrix Double -> Matrix Double -> Vector Double | 290 | simplexSparse :: Int -> Int -> Matrix Double -> Matrix Double -> Vector Double |
286 | simplexSparse m n c b = unsafePerformIO $ do | 291 | simplexSparse m n c b = unsafePerformIO $ do |
287 | s <- createVector (2+n) | 292 | s <- createVector (2+n) |
288 | app3 (c_simplex_sparse (fi m) (fi n)) mat (cmat c) mat (cmat b) vec s "c_simplex_sparse" | 293 | c_simplex_sparse (fi m) (fi n) ## (cmat c) ## (cmat b) ## s #|"c_simplex_sparse" |
289 | return s | 294 | return s |
290 | 295 | ||
291 | foreign import ccall unsafe "c_exact_sparse" c_exact_sparse | 296 | foreign import ccall unsafe "c_exact_sparse" c_exact_sparse |
@@ -298,7 +303,7 @@ foreign import ccall unsafe "c_exact_sparse" c_exact_sparse | |||
298 | exactSparse :: Int -> Int -> Matrix Double -> Matrix Double -> Vector Double | 303 | exactSparse :: Int -> Int -> Matrix Double -> Matrix Double -> Vector Double |
299 | exactSparse m n c b = unsafePerformIO $ do | 304 | exactSparse m n c b = unsafePerformIO $ do |
300 | s <- createVector (2+n) | 305 | s <- createVector (2+n) |
301 | app3 (c_exact_sparse (fi m) (fi n)) mat (cmat c) mat (cmat b) vec s "c_exact_sparse" | 306 | c_exact_sparse (fi m) (fi n) ## (cmat c) ## (cmat b) ## s #|"c_exact_sparse" |
302 | return s | 307 | return s |
303 | 308 | ||
304 | glpFR, glpLO, glpUP, glpDB, glpFX :: Double | 309 | glpFR, glpLO, glpUP, glpDB, glpFX :: Double |