summaryrefslogtreecommitdiff
path: root/packages/base/src/Internal/Matrix.hs
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2015-06-30 14:47:35 +0200
committerAlberto Ruiz <aruiz@um.es>2015-06-30 14:47:35 +0200
commit89ace10b752b18cb4b9498d38344e4b0a716f575 (patch)
treebe4b62bc239d31a3c3399fd1c326b0d28fc79811 /packages/base/src/Internal/Matrix.hs
parent4ada25636995115f2b26707870f611a138f4e20b (diff)
remove applyRaw
Diffstat (limited to 'packages/base/src/Internal/Matrix.hs')
-rw-r--r--packages/base/src/Internal/Matrix.hs17
1 files changed, 2 insertions, 15 deletions
diff --git a/packages/base/src/Internal/Matrix.hs b/packages/base/src/Internal/Matrix.hs
index 5163421..12ef05a 100644
--- a/packages/base/src/Internal/Matrix.hs
+++ b/packages/base/src/Internal/Matrix.hs
@@ -108,14 +108,6 @@ fmat m
108 | otherwise = extractAll ColumnMajor m 108 | otherwise = extractAll ColumnMajor m
109 109
110 110
111-- C-Haskell matrix adapters
112{-# INLINE amatr #-}
113amatr :: Storable a => (CInt -> CInt -> Ptr a -> b) -> Matrix a -> b
114amatr f x = inlinePerformIO (unsafeWith (xdat x) (return . f r c))
115 where
116 r = fi (rows x)
117 c = fi (cols x)
118
119{-# INLINE amat #-} 111{-# INLINE amat #-}
120amat :: Storable a => (CInt -> CInt -> CInt -> CInt -> Ptr a -> b) -> Matrix a -> b 112amat :: Storable a => (CInt -> CInt -> CInt -> CInt -> Ptr a -> b) -> Matrix a -> b
121amat f x = inlinePerformIO (unsafeWith (xdat x) (return . f r c sr sc)) 113amat f x = inlinePerformIO (unsafeWith (xdat x) (return . f r c sr sc))
@@ -125,16 +117,11 @@ amat f x = inlinePerformIO (unsafeWith (xdat x) (return . f r c sr sc))
125 sr = fi (xRow x) 117 sr = fi (xRow x)
126 sc = fi (xCol x) 118 sc = fi (xCol x)
127 119
128
129instance Storable t => TransArray (Matrix t) 120instance Storable t => TransArray (Matrix t)
130 where 121 where
131 type Elem (Matrix t) = t
132 type TransRaw (Matrix t) b = CInt -> CInt -> Ptr t -> b
133 type Trans (Matrix t) b = CInt -> CInt -> CInt -> CInt -> Ptr t -> b 122 type Trans (Matrix t) b = CInt -> CInt -> CInt -> CInt -> Ptr t -> b
134 apply = amat 123 apply = amat
135 {-# INLINE apply #-} 124 {-# INLINE apply #-}
136 applyRaw = amatr
137 {-# INLINE applyRaw #-}
138 125
139infixl 1 # 126infixl 1 #
140a # b = apply a b 127a # b = apply a b
@@ -577,7 +564,7 @@ foreign import ccall unsafe "gemm_mod_int64_t" c_gemmML :: Z -> Tgemm Z
577-------------------------------------------------------------------------------- 564--------------------------------------------------------------------------------
578 565
579foreign import ccall unsafe "saveMatrix" c_saveMatrix 566foreign import ccall unsafe "saveMatrix" c_saveMatrix
580 :: CString -> CString -> Double ..> Ok 567 :: CString -> CString -> Double ::> Ok
581 568
582{- | save a matrix as a 2D ASCII table 569{- | save a matrix as a 2D ASCII table
583-} 570-}
@@ -589,7 +576,7 @@ saveMatrix
589saveMatrix name format m = do 576saveMatrix name format m = do
590 cname <- newCString name 577 cname <- newCString name
591 cformat <- newCString format 578 cformat <- newCString format
592 c_saveMatrix cname cformat `applyRaw` m #|"saveMatrix" 579 c_saveMatrix cname cformat `apply` m #|"saveMatrix"
593 free cname 580 free cname
594 free cformat 581 free cformat
595 return () 582 return ()