summaryrefslogtreecommitdiff
path: root/packages/base/src/Data/Packed/Internal/Matrix.hs
diff options
context:
space:
mode:
Diffstat (limited to 'packages/base/src/Data/Packed/Internal/Matrix.hs')
-rw-r--r--packages/base/src/Data/Packed/Internal/Matrix.hs28
1 files changed, 7 insertions, 21 deletions
diff --git a/packages/base/src/Data/Packed/Internal/Matrix.hs b/packages/base/src/Data/Packed/Internal/Matrix.hs
index ddeddae..9f446b2 100644
--- a/packages/base/src/Data/Packed/Internal/Matrix.hs
+++ b/packages/base/src/Data/Packed/Internal/Matrix.hs
@@ -485,34 +485,20 @@ instance (Storable t, NFData t) => NFData (Matrix t)
485 485
486--------------------------------------------------------------- 486---------------------------------------------------------------
487 487
488isT Matrix{order = ColumnMajor} = 1
489isT Matrix{order = RowMajor} = 0
490
491tt x@Matrix{order = ColumnMajor} = trans x
492tt x@Matrix{order = RowMajor} = x
493
494
495extractAux f m moder vr modec vc = unsafePerformIO $ do 488extractAux f m moder vr modec vc = unsafePerformIO $ do
496 let nr = if moder == 0 then fromIntegral $ vr@>1 - vr@>0 + 1 else dim vr 489 let nr = if moder == 0 then fromIntegral $ vr@>1 - vr@>0 + 1 else dim vr
497 nc = if modec == 0 then fromIntegral $ vc@>1 - vc@>0 + 1 else dim vc 490 nc = if modec == 0 then fromIntegral $ vc@>1 - vc@>0 + 1 else dim vc
498 r <- createMatrix RowMajor nr nc 491 r <- createMatrix RowMajor nr nc
499 app4 (f moder modec (isT m)) vec vr vec vc mat (tt m) mat r "extractAux" 492 app4 (f moder modec) vec vr vec vc omat m omat r "extractAux"
500 return r 493 return r
501 494
502foreign import ccall unsafe "extractD" c_extractD 495type Extr x = CInt -> CInt -> CIdxs (CIdxs (OM x (OM x (IO CInt))))
503 :: CInt -> CInt -> CInt -> CIdxs (CIdxs (CM Double (CM Double (IO CInt))))
504
505foreign import ccall unsafe "extractF" c_extractF
506 :: CInt -> CInt -> CInt -> CIdxs (CIdxs (CM Float (CM Float (IO CInt))))
507
508foreign import ccall unsafe "extractC" c_extractC
509 :: CInt -> CInt -> CInt -> CIdxs (CIdxs (CM (Complex Double) (CM (Complex Double) (IO CInt))))
510
511foreign import ccall unsafe "extractQ" c_extractQ
512 :: CInt -> CInt -> CInt -> CIdxs (CIdxs (CM (Complex Float) (CM (Complex Float) (IO CInt))))
513 496
514foreign import ccall unsafe "extractI" c_extractI 497foreign import ccall unsafe "extractD" c_extractD :: Extr Double
515 :: CInt -> CInt -> CInt -> CIdxs (CIdxs (CM CInt (CM CInt (IO CInt)))) 498foreign import ccall unsafe "extractF" c_extractF :: Extr Float
499foreign import ccall unsafe "extractC" c_extractC :: Extr (Complex Double)
500foreign import ccall unsafe "extractQ" c_extractQ :: Extr (Complex Float)
501foreign import ccall unsafe "extractI" c_extractI :: Extr CInt
516 502
517-------------------------------------------------------------------------------- 503--------------------------------------------------------------------------------
518 504