diff options
Diffstat (limited to 'packages/base/src/Data/Packed/Internal/Matrix.hs')
-rw-r--r-- | packages/base/src/Data/Packed/Internal/Matrix.hs | 28 |
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 | ||
488 | isT Matrix{order = ColumnMajor} = 1 | ||
489 | isT Matrix{order = RowMajor} = 0 | ||
490 | |||
491 | tt x@Matrix{order = ColumnMajor} = trans x | ||
492 | tt x@Matrix{order = RowMajor} = x | ||
493 | |||
494 | |||
495 | extractAux f m moder vr modec vc = unsafePerformIO $ do | 488 | extractAux 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 | ||
502 | foreign import ccall unsafe "extractD" c_extractD | 495 | type 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 | |||
505 | foreign import ccall unsafe "extractF" c_extractF | ||
506 | :: CInt -> CInt -> CInt -> CIdxs (CIdxs (CM Float (CM Float (IO CInt)))) | ||
507 | |||
508 | foreign import ccall unsafe "extractC" c_extractC | ||
509 | :: CInt -> CInt -> CInt -> CIdxs (CIdxs (CM (Complex Double) (CM (Complex Double) (IO CInt)))) | ||
510 | |||
511 | foreign import ccall unsafe "extractQ" c_extractQ | ||
512 | :: CInt -> CInt -> CInt -> CIdxs (CIdxs (CM (Complex Float) (CM (Complex Float) (IO CInt)))) | ||
513 | 496 | ||
514 | foreign import ccall unsafe "extractI" c_extractI | 497 | foreign import ccall unsafe "extractD" c_extractD :: Extr Double |
515 | :: CInt -> CInt -> CInt -> CIdxs (CIdxs (CM CInt (CM CInt (IO CInt)))) | 498 | foreign import ccall unsafe "extractF" c_extractF :: Extr Float |
499 | foreign import ccall unsafe "extractC" c_extractC :: Extr (Complex Double) | ||
500 | foreign import ccall unsafe "extractQ" c_extractQ :: Extr (Complex Float) | ||
501 | foreign import ccall unsafe "extractI" c_extractI :: Extr CInt | ||
516 | 502 | ||
517 | -------------------------------------------------------------------------------- | 503 | -------------------------------------------------------------------------------- |
518 | 504 | ||