diff options
Diffstat (limited to 'packages/base/src')
-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 | 22 | module Internal.Element where | |
23 | module Data.Packed.Matrix ( | 23 | |
24 | Matrix, | 24 | import Internal.Tools |
25 | Element, | 25 | import Internal.Vector |
26 | rows,cols, | 26 | import Internal.Matrix |
27 | (><), | 27 | import 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 | |||
45 | import Data.Packed.Internal | ||
46 | import qualified Data.Packed.ST as ST | ||
47 | import Data.Array | 28 | import Data.Array |
48 | 29 | ||
30 | import Data.Vector.Storable(fromList) | ||
49 | import Data.List(transpose,intersperse) | 31 | import Data.List(transpose,intersperse) |
50 | import Foreign.Storable(Storable) | 32 | import Foreign.Storable(Storable) |
51 | import Control.Monad(liftM) | 33 | import 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 |
221 | takeDiag :: (Element t) => Matrix t -> Vector t | 203 | takeDiag :: (Element t) => Matrix t -> Vector t |
222 | takeDiag m = fromList [flatten m `at` (k*cols m+k) | k <- [0 .. min (rows m) (cols m) -1]] | 204 | takeDiag 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 | ||
506 | mapMatrix :: (Storable a, Storable b) => (a -> b) -> Matrix a -> Matrix b | 488 | mapMatrix :: (Storable a, Storable b) => (a -> b) -> Matrix a -> Matrix b |
507 | mapMatrix f = liftMatrix (mapVector f) | 489 | mapMatrix f = liftMatrix (mapVector f) |
490 | |||