summaryrefslogtreecommitdiff
path: root/packages/base/src
diff options
context:
space:
mode:
Diffstat (limited to 'packages/base/src')
-rw-r--r--packages/base/src/Data/Packed/Matrix.hs17
-rw-r--r--packages/base/src/Numeric/LinearAlgebra/Data.hs5
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
254takeRows :: Element t => Int -> Matrix t -> Matrix t 255takeRows :: Element t => Int -> Matrix t -> Matrix t
255takeRows n mt = subMatrix (0,0) (n, cols mt) mt 256takeRows n mt = subMatrix (0,0) (n, cols mt) mt
257-- | Creates a matrix with the last n rows of another matrix
258takeLastRows :: Element t => Int -> Matrix t -> Matrix t
259takeLastRows 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
257dropRows :: Element t => Int -> Matrix t -> Matrix t 261dropRows :: Element t => Int -> Matrix t -> Matrix t
258dropRows n mt = subMatrix (n,0) (rows mt - n, cols mt) mt 262dropRows n mt = subMatrix (n,0) (rows mt - n, cols mt) mt
263-- | Creates a copy of a matrix without the last n rows
264dropLastRows :: Element t => Int -> Matrix t -> Matrix t
265dropLastRows 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
260takeColumns :: Element t => Int -> Matrix t -> Matrix t 267takeColumns :: Element t => Int -> Matrix t -> Matrix t
261takeColumns n mt = subMatrix (0,0) (rows mt, n) mt 268takeColumns n mt = subMatrix (0,0) (rows mt, n) mt
269-- |Creates a matrix with the last n columns of another matrix
270takeLastColumns :: Element t => Int -> Matrix t -> Matrix t
271takeLastColumns 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
263dropColumns :: Element t => Int -> Matrix t -> Matrix t 273dropColumns :: Element t => Int -> Matrix t -> Matrix t
264dropColumns n mt = subMatrix (0,n) (rows mt, cols mt - n) mt 274dropColumns n mt = subMatrix (0,n) (rows mt, cols mt - n) mt
275-- | Creates a copy of a matrix without the last n columns
276dropLastColumns :: Element t => Int -> Matrix t -> Matrix t
277dropLastColumns 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,