diff options
Diffstat (limited to 'packages/sparse/src/Numeric')
-rw-r--r-- | packages/sparse/src/Numeric/LinearAlgebra/Sparse.hs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/packages/sparse/src/Numeric/LinearAlgebra/Sparse.hs b/packages/sparse/src/Numeric/LinearAlgebra/Sparse.hs index 8608394..d75fec2 100644 --- a/packages/sparse/src/Numeric/LinearAlgebra/Sparse.hs +++ b/packages/sparse/src/Numeric/LinearAlgebra/Sparse.hs | |||
@@ -13,8 +13,11 @@ import System.IO.Unsafe(unsafePerformIO) | |||
13 | import Foreign(Ptr) | 13 | import Foreign(Ptr) |
14 | import Numeric.LinearAlgebra.HMatrix | 14 | import Numeric.LinearAlgebra.HMatrix |
15 | import Text.Printf | 15 | import Text.Printf |
16 | import Numeric.LinearAlgebra.Util((~!~)) | 16 | import Control.Monad(when) |
17 | 17 | ||
18 | (???) :: Bool -> String -> IO () | ||
19 | infixl 0 ??? | ||
20 | c ??? msg = when c (error msg) | ||
18 | 21 | ||
19 | type IV t = CInt -> Ptr CInt -> t | 22 | type IV t = CInt -> Ptr CInt -> t |
20 | type V t = CInt -> Ptr Double -> t | 23 | type V t = CInt -> Ptr Double -> t |
@@ -22,7 +25,7 @@ type SMxV = V (IV (IV (V (V (IO CInt))))) | |||
22 | 25 | ||
23 | dss :: CSR -> Vector Double -> Vector Double | 26 | dss :: CSR -> Vector Double -> Vector Double |
24 | dss CSR{..} b = unsafePerformIO $ do | 27 | dss CSR{..} b = unsafePerformIO $ do |
25 | size b /= csrNRows ~!~ printf "dss: incorrect sizes: (%d,%d) x %d" csrNRows csrNCols (size b) | 28 | size b /= csrNRows ??? printf "dss: incorrect sizes: (%d,%d) x %d" csrNRows csrNCols (size b) |
26 | r <- createVector csrNCols | 29 | r <- createVector csrNCols |
27 | app5 c_dss vec csrVals vec csrCols vec csrRows vec b vec r "dss" | 30 | app5 c_dss vec csrVals vec csrCols vec csrRows vec b vec r "dss" |
28 | return r | 31 | return r |