summaryrefslogtreecommitdiff
path: root/packages/sparse/src/Numeric/LinearAlgebra/Sparse.hs
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2014-05-27 20:24:12 +0200
committerAlberto Ruiz <aruiz@um.es>2014-05-27 20:24:12 +0200
commit3c1c5e59e3d699f3e17519f19d47f7dab2403879 (patch)
treea749e0a3fb515ad1a904ce7387fbd3afd2ee0ed3 /packages/sparse/src/Numeric/LinearAlgebra/Sparse.hs
parent53559833d2166010eed754027484fb8d5525e710 (diff)
initial interface to MKL sparse solver
Diffstat (limited to 'packages/sparse/src/Numeric/LinearAlgebra/Sparse.hs')
-rw-r--r--packages/sparse/src/Numeric/LinearAlgebra/Sparse.hs32
1 files changed, 32 insertions, 0 deletions
diff --git a/packages/sparse/src/Numeric/LinearAlgebra/Sparse.hs b/packages/sparse/src/Numeric/LinearAlgebra/Sparse.hs
new file mode 100644
index 0000000..ccf28b7
--- /dev/null
+++ b/packages/sparse/src/Numeric/LinearAlgebra/Sparse.hs
@@ -0,0 +1,32 @@
1{-# LANGUAGE ForeignFunctionInterface #-}
2{-# LANGUAGE RecordWildCards #-}
3
4
5
6module Numeric.LinearAlgebra.Sparse (
7 dss
8) where
9
10import Foreign.C.Types(CInt(..))
11import Data.Packed.Development
12import System.IO.Unsafe(unsafePerformIO)
13import Foreign(Ptr)
14import Numeric.HMatrix
15import Text.Printf
16import Numeric.LinearAlgebra.Util((~!~))
17
18
19type IV t = CInt -> Ptr CInt -> t
20type V t = CInt -> Ptr Double -> t
21type SMxV = V (IV (IV (V (V (IO CInt)))))
22
23dss :: CSR -> Vector Double -> Vector Double
24dss CSR{..} b = unsafePerformIO $ do
25 size b /= csrNRows ~!~ printf "dss: incorrect sizes: (%d,%d) x %d" csrNRows csrNCols (size b)
26 r <- createVector csrNCols
27 app5 c_dss vec csrVals vec csrCols vec csrRows vec b vec r "dss"
28 return r
29
30foreign import ccall unsafe "dss"
31 c_dss :: SMxV
32