summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/base/src/Internal/Element.hs (renamed from packages/base/src/Data/Packed/Matrix.hs)37
1 files changed, 10 insertions, 27 deletions
diff --git a/packages/base/src/Data/Packed/Matrix.hs b/packages/base/src/Internal/Element.hs
index 3690293..6fc2981 100644
--- a/packages/base/src/Data/Packed/Matrix.hs
+++ b/packages/base/src/Internal/Element.hs
@@ -18,34 +18,16 @@
18-- This module provides basic functions for manipulation of structure. 18-- This module provides basic functions for manipulation of structure.
19 19
20----------------------------------------------------------------------------- 20-----------------------------------------------------------------------------
21{-# OPTIONS_HADDOCK hide #-} 21
22 22module Internal.Element where
23module Data.Packed.Matrix ( 23
24 Matrix, 24import Internal.Tools
25 Element, 25import Internal.Vector
26 rows,cols, 26import Internal.Matrix
27 (><), 27import qualified Internal.ST as ST
28 trans,
29 reshape, flatten,
30 fromLists, toLists, buildMatrix,
31 (@@>),
32 asRow, asColumn,
33 fromRows, toRows, fromColumns, toColumns,
34 fromBlocks, diagBlock, toBlocks, toBlocksEvery,
35 repmat,
36 flipud, fliprl, subMatrix,
37 takeRows, takeLastRows, dropRows, dropLastRows,
38 takeColumns, takeLastColumns, dropColumns, dropLastColumns,
39 extractRows, extractColumns,
40 diagRect, takeDiag,
41 mapMatrix, mapMatrixWithIndex, mapMatrixWithIndexM, mapMatrixWithIndexM_,
42 liftMatrix, liftMatrix2, liftMatrix2Auto,fromArray2D
43) where
44
45import Data.Packed.Internal
46import qualified Data.Packed.ST as ST
47import Data.Array 28import Data.Array
48 29
30import Data.Vector.Storable(fromList)
49import Data.List(transpose,intersperse) 31import Data.List(transpose,intersperse)
50import Foreign.Storable(Storable) 32import Foreign.Storable(Storable)
51import Control.Monad(liftM) 33import Control.Monad(liftM)
@@ -219,7 +201,7 @@ diagRect z v r c = ST.runSTMatrix $ do
219 201
220-- | extracts the diagonal from a rectangular matrix 202-- | extracts the diagonal from a rectangular matrix
221takeDiag :: (Element t) => Matrix t -> Vector t 203takeDiag :: (Element t) => Matrix t -> Vector t
222takeDiag m = fromList [flatten m `at` (k*cols m+k) | k <- [0 .. min (rows m) (cols m) -1]] 204takeDiag m = fromList [flatten m @> (k*cols m+k) | k <- [0 .. min (rows m) (cols m) -1]]
223 205
224------------------------------------------------------------ 206------------------------------------------------------------
225 207
@@ -505,3 +487,4 @@ mapMatrixWithIndex g m = reshape c . mapVectorWithIndex (mk c g) . flatten $ m
505 487
506mapMatrix :: (Storable a, Storable b) => (a -> b) -> Matrix a -> Matrix b 488mapMatrix :: (Storable a, Storable b) => (a -> b) -> Matrix a -> Matrix b
507mapMatrix f = liftMatrix (mapVector f) 489mapMatrix f = liftMatrix (mapVector f)
490