summaryrefslogtreecommitdiff
path: root/packages/glpk
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2015-06-19 13:55:39 +0200
committerAlberto Ruiz <aruiz@um.es>2015-06-19 13:55:39 +0200
commitdb50bc11dafa6834a4367427156306674063ed6b (patch)
tree721e9d0235168be1d0ebb2bd1dd254a66251f274 /packages/glpk
parent7f9c7b5adf8f05653d15f19358f41c1916e8db70 (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.hs9
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
279infixl 1 ##
280a ## b = applyRaw a b
281{-# INLINE (##) #-}
282
278foreign import ccall unsafe "c_simplex_sparse" c_simplex_sparse 283foreign 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
285simplexSparse :: Int -> Int -> Matrix Double -> Matrix Double -> Vector Double 290simplexSparse :: Int -> Int -> Matrix Double -> Matrix Double -> Vector Double
286simplexSparse m n c b = unsafePerformIO $ do 291simplexSparse 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
291foreign import ccall unsafe "c_exact_sparse" c_exact_sparse 296foreign import ccall unsafe "c_exact_sparse" c_exact_sparse
@@ -298,7 +303,7 @@ foreign import ccall unsafe "c_exact_sparse" c_exact_sparse
298exactSparse :: Int -> Int -> Matrix Double -> Matrix Double -> Vector Double 303exactSparse :: Int -> Int -> Matrix Double -> Matrix Double -> Vector Double
299exactSparse m n c b = unsafePerformIO $ do 304exactSparse 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
304glpFR, glpLO, glpUP, glpDB, glpFX :: Double 309glpFR, glpLO, glpUP, glpDB, glpFX :: Double