summaryrefslogtreecommitdiff
path: root/lib/Data/Packed/Internal
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2010-09-23 09:49:04 +0000
committerAlberto Ruiz <aruiz@um.es>2010-09-23 09:49:04 +0000
commit3cfce69bf3cb7d7f7976abb454b64f6fa3a32c97 (patch)
tree6c8d4b0ccbfc2eb289d9112c9106a53af58c6820 /lib/Data/Packed/Internal
parent778e63dcc2b348914a4f6975f5328ff7fd25638a (diff)
minor doc fix, clean Plot
Diffstat (limited to 'lib/Data/Packed/Internal')
-rw-r--r--lib/Data/Packed/Internal/Matrix.hs26
1 files changed, 14 insertions, 12 deletions
diff --git a/lib/Data/Packed/Internal/Matrix.hs b/lib/Data/Packed/Internal/Matrix.hs
index 7b823de..b616442 100644
--- a/lib/Data/Packed/Internal/Matrix.hs
+++ b/lib/Data/Packed/Internal/Matrix.hs
@@ -75,7 +75,11 @@ import Foreign.C.String
75 75
76data MatrixOrder = RowMajor | ColumnMajor deriving (Show,Eq) 76data MatrixOrder = RowMajor | ColumnMajor deriving (Show,Eq)
77 77
78-- | Matrix representation suitable for GSL and LAPACK computations. 78{- | Matrix representation suitable for GSL and LAPACK computations.
79
80The elements are stored in a continuous memory array.
81
82-}
79data Matrix t = MC { irows :: {-# UNPACK #-} !Int 83data Matrix t = MC { irows :: {-# UNPACK #-} !Int
80 , icols :: {-# UNPACK #-} !Int 84 , icols :: {-# UNPACK #-} !Int
81 , cdat :: {-# UNPACK #-} !(Vector t) } 85 , cdat :: {-# UNPACK #-} !(Vector t) }
@@ -245,9 +249,14 @@ compat m1 m2 = rows m1 == rows m2 && cols m1 == cols m2
245 249
246------------------------------------------------------------------ 250------------------------------------------------------------------
247 251
248-- | Supported element types for basic matrix operations. 252{- | Supported matrix elements.
249-- provides unoptimised defaults for all (Storable a) instances 253
250-- @instance Element Foo where@ 254 This class provides optimized internal
255 operations for selected element types.
256 It provides unoptimised defaults for any 'Storable' type,
257 so you can create instances simply as:
258 @instance Element Foo@.
259-}
251class (Storable a) => Element a where 260class (Storable a) => Element a where
252 subMatrixD :: (Int,Int) -- ^ (r0,c0) starting position 261 subMatrixD :: (Int,Int) -- ^ (r0,c0) starting position
253 -> (Int,Int) -- ^ (rt,ct) dimensions of submatrix 262 -> (Int,Int) -- ^ (rt,ct) dimensions of submatrix
@@ -257,30 +266,23 @@ class (Storable a) => Element a where
257 transdata = transdataP -- transdata' 266 transdata = transdataP -- transdata'
258 constantD :: a -> Int -> Vector a 267 constantD :: a -> Int -> Vector a
259 constantD = constantP -- constant' 268 constantD = constantP -- constant'
260{- 269
261 conjugateD :: Vector a -> Vector a
262 conjugateD = id
263-}
264 270
265instance Element Float where 271instance Element Float where
266 transdata = transdataAux ctransF 272 transdata = transdataAux ctransF
267 constantD = constantAux cconstantF 273 constantD = constantAux cconstantF
268-- conjugateD = id
269 274
270instance Element Double where 275instance Element Double where
271 transdata = transdataAux ctransR 276 transdata = transdataAux ctransR
272 constantD = constantAux cconstantR 277 constantD = constantAux cconstantR
273-- conjugateD = id
274 278
275instance Element (Complex Float) where 279instance Element (Complex Float) where
276 transdata = transdataAux ctransQ 280 transdata = transdataAux ctransQ
277 constantD = constantAux cconstantQ 281 constantD = constantAux cconstantQ
278-- conjugateD = conjugateQ
279 282
280instance Element (Complex Double) where 283instance Element (Complex Double) where
281 transdata = transdataAux ctransC 284 transdata = transdataAux ctransC
282 constantD = constantAux cconstantC 285 constantD = constantAux cconstantC
283-- conjugateD = conjugateC
284 286
285------------------------------------------------------------------- 287-------------------------------------------------------------------
286 288