diff options
Diffstat (limited to 'packages/base')
-rw-r--r-- | packages/base/src/Data/Packed/Matrix.hs | 17 | ||||
-rw-r--r-- | packages/base/src/Numeric/LinearAlgebra/Data.hs | 5 |
2 files changed, 18 insertions, 4 deletions
diff --git a/packages/base/src/Data/Packed/Matrix.hs b/packages/base/src/Data/Packed/Matrix.hs index 70b9232..3690293 100644 --- a/packages/base/src/Data/Packed/Matrix.hs +++ b/packages/base/src/Data/Packed/Matrix.hs | |||
@@ -33,8 +33,9 @@ module Data.Packed.Matrix ( | |||
33 | fromRows, toRows, fromColumns, toColumns, | 33 | fromRows, toRows, fromColumns, toColumns, |
34 | fromBlocks, diagBlock, toBlocks, toBlocksEvery, | 34 | fromBlocks, diagBlock, toBlocks, toBlocksEvery, |
35 | repmat, | 35 | repmat, |
36 | flipud, fliprl, | 36 | flipud, fliprl, subMatrix, |
37 | subMatrix, takeRows, dropRows, takeColumns, dropColumns, | 37 | takeRows, takeLastRows, dropRows, dropLastRows, |
38 | takeColumns, takeLastColumns, dropColumns, dropLastColumns, | ||
38 | extractRows, extractColumns, | 39 | extractRows, extractColumns, |
39 | diagRect, takeDiag, | 40 | diagRect, takeDiag, |
40 | mapMatrix, mapMatrixWithIndex, mapMatrixWithIndexM, mapMatrixWithIndexM_, | 41 | mapMatrix, mapMatrixWithIndex, mapMatrixWithIndexM, mapMatrixWithIndexM_, |
@@ -253,15 +254,27 @@ r >< c = f where | |||
253 | -- | Creates a matrix with the first n rows of another matrix | 254 | -- | Creates a matrix with the first n rows of another matrix |
254 | takeRows :: Element t => Int -> Matrix t -> Matrix t | 255 | takeRows :: Element t => Int -> Matrix t -> Matrix t |
255 | takeRows n mt = subMatrix (0,0) (n, cols mt) mt | 256 | takeRows n mt = subMatrix (0,0) (n, cols mt) mt |
257 | -- | Creates a matrix with the last n rows of another matrix | ||
258 | takeLastRows :: Element t => Int -> Matrix t -> Matrix t | ||
259 | takeLastRows n mt = subMatrix (rows mt - n, 0) (n, cols mt) mt | ||
256 | -- | Creates a copy of a matrix without the first n rows | 260 | -- | Creates a copy of a matrix without the first n rows |
257 | dropRows :: Element t => Int -> Matrix t -> Matrix t | 261 | dropRows :: Element t => Int -> Matrix t -> Matrix t |
258 | dropRows n mt = subMatrix (n,0) (rows mt - n, cols mt) mt | 262 | dropRows n mt = subMatrix (n,0) (rows mt - n, cols mt) mt |
263 | -- | Creates a copy of a matrix without the last n rows | ||
264 | dropLastRows :: Element t => Int -> Matrix t -> Matrix t | ||
265 | dropLastRows n mt = subMatrix (0,0) (rows mt - n, cols mt) mt | ||
259 | -- |Creates a matrix with the first n columns of another matrix | 266 | -- |Creates a matrix with the first n columns of another matrix |
260 | takeColumns :: Element t => Int -> Matrix t -> Matrix t | 267 | takeColumns :: Element t => Int -> Matrix t -> Matrix t |
261 | takeColumns n mt = subMatrix (0,0) (rows mt, n) mt | 268 | takeColumns n mt = subMatrix (0,0) (rows mt, n) mt |
269 | -- |Creates a matrix with the last n columns of another matrix | ||
270 | takeLastColumns :: Element t => Int -> Matrix t -> Matrix t | ||
271 | takeLastColumns n mt = subMatrix (0, cols mt - n) (rows mt, n) mt | ||
262 | -- | Creates a copy of a matrix without the first n columns | 272 | -- | Creates a copy of a matrix without the first n columns |
263 | dropColumns :: Element t => Int -> Matrix t -> Matrix t | 273 | dropColumns :: Element t => Int -> Matrix t -> Matrix t |
264 | dropColumns n mt = subMatrix (0,n) (rows mt, cols mt - n) mt | 274 | dropColumns n mt = subMatrix (0,n) (rows mt, cols mt - n) mt |
275 | -- | Creates a copy of a matrix without the last n columns | ||
276 | dropLastColumns :: Element t => Int -> Matrix t -> Matrix t | ||
277 | dropLastColumns n mt = subMatrix (0,0) (rows mt, cols mt - n) mt | ||
265 | 278 | ||
266 | ---------------------------------------------------------------- | 279 | ---------------------------------------------------------------- |
267 | 280 | ||
diff --git a/packages/base/src/Numeric/LinearAlgebra/Data.hs b/packages/base/src/Numeric/LinearAlgebra/Data.hs index 9935c15..2161e75 100644 --- a/packages/base/src/Numeric/LinearAlgebra/Data.hs +++ b/packages/base/src/Numeric/LinearAlgebra/Data.hs | |||
@@ -53,8 +53,9 @@ module Numeric.LinearAlgebra.Data( | |||
53 | 53 | ||
54 | -- * Matrix extraction | 54 | -- * Matrix extraction |
55 | Extractor(..), (??), | 55 | Extractor(..), (??), |
56 | takeRows, dropRows, takeColumns, dropColumns, subMatrix, (?), (¿), fliprl, flipud, | 56 | takeRows, takeLastRows, dropRows, dropLastRows, |
57 | remap, | 57 | takeColumns, takeLastColumns, dropColumns, dropLastColumns, |
58 | subMatrix, (?), (¿), fliprl, flipud, remap, | ||
58 | 59 | ||
59 | -- * Block matrix | 60 | -- * Block matrix |
60 | fromBlocks, (|||), (===), diagBlock, repmat, toBlocks, toBlocksEvery, | 61 | fromBlocks, (|||), (===), diagBlock, repmat, toBlocks, toBlocksEvery, |