diff options
Diffstat (limited to 'packages/base/src/Numeric')
-rw-r--r-- | packages/base/src/Numeric/LinearAlgebra.hs | 13 | ||||
-rw-r--r-- | packages/base/src/Numeric/LinearAlgebra/Data.hs | 21 | ||||
-rw-r--r-- | packages/base/src/Numeric/LinearAlgebra/HMatrix.hs | 6 | ||||
-rw-r--r-- | packages/base/src/Numeric/LinearAlgebra/Static.hs | 4 |
4 files changed, 31 insertions, 13 deletions
diff --git a/packages/base/src/Numeric/LinearAlgebra.hs b/packages/base/src/Numeric/LinearAlgebra.hs index dd4cc67..9cab635 100644 --- a/packages/base/src/Numeric/LinearAlgebra.hs +++ b/packages/base/src/Numeric/LinearAlgebra.hs | |||
@@ -8,11 +8,16 @@ License : BSD3 | |||
8 | Maintainer : Alberto Ruiz | 8 | Maintainer : Alberto Ruiz |
9 | Stability : provisional | 9 | Stability : provisional |
10 | 10 | ||
11 | |||
11 | -} | 12 | -} |
12 | ----------------------------------------------------------------------------- | 13 | ----------------------------------------------------------------------------- |
13 | module Numeric.LinearAlgebra ( | 14 | module Numeric.LinearAlgebra ( |
14 | 15 | ||
15 | -- * Basic types and data processing | 16 | -- * Basic Types and data manipulation |
17 | -- | This package works with 2D ('Matrix') and 1D ('Vector') | ||
18 | -- arrays of real ('R') or complex ('C') double precision numbers. | ||
19 | -- Single precision and machine integers are also supported for | ||
20 | -- basic arithmetic and data manipulation. | ||
16 | module Numeric.LinearAlgebra.Data, | 21 | module Numeric.LinearAlgebra.Data, |
17 | 22 | ||
18 | -- * Numeric classes | 23 | -- * Numeric classes |
@@ -51,9 +56,9 @@ module Numeric.LinearAlgebra ( | |||
51 | -- ** dot | 56 | -- ** dot |
52 | dot, (<.>), | 57 | dot, (<.>), |
53 | -- ** matrix-vector | 58 | -- ** matrix-vector |
54 | app, (#>), (<#), (!#>), | 59 | (#>), (<#), (!#>), |
55 | -- ** matrix-matrix | 60 | -- ** matrix-matrix |
56 | mul, (<>), | 61 | (<>), |
57 | -- | The matrix product is also implemented in the "Data.Monoid" instance, where | 62 | -- | The matrix product is also implemented in the "Data.Monoid" instance, where |
58 | -- single-element matrices (created from numeric literals or using 'scalar') | 63 | -- single-element matrices (created from numeric literals or using 'scalar') |
59 | -- are used for scaling. | 64 | -- are used for scaling. |
@@ -172,7 +177,7 @@ import Internal.Sparse((!#>)) | |||
172 | import Internal.CG | 177 | import Internal.CG |
173 | import Internal.Conversion | 178 | import Internal.Conversion |
174 | 179 | ||
175 | {- | infix synonym of 'mul' | 180 | {- | dense matrix product |
176 | 181 | ||
177 | >>> let a = (3><5) [1..] | 182 | >>> let a = (3><5) [1..] |
178 | >>> a | 183 | >>> a |
diff --git a/packages/base/src/Numeric/LinearAlgebra/Data.hs b/packages/base/src/Numeric/LinearAlgebra/Data.hs index d2843c2..a389aac 100644 --- a/packages/base/src/Numeric/LinearAlgebra/Data.hs +++ b/packages/base/src/Numeric/LinearAlgebra/Data.hs | |||
@@ -8,21 +8,29 @@ License : BSD3 | |||
8 | Maintainer : Alberto Ruiz | 8 | Maintainer : Alberto Ruiz |
9 | Stability : provisional | 9 | Stability : provisional |
10 | 10 | ||
11 | Basic data processing. | 11 | This module provides functions for creation and manipulation of vectors and matrices, IO, and other utilities. |
12 | 12 | ||
13 | -} | 13 | -} |
14 | -------------------------------------------------------------------------------- | 14 | -------------------------------------------------------------------------------- |
15 | 15 | ||
16 | module Numeric.LinearAlgebra.Data( | 16 | module Numeric.LinearAlgebra.Data( |
17 | 17 | ||
18 | -- * Elements | ||
19 | R,C,I,Z,type(./.), | ||
20 | |||
18 | -- * Vector | 21 | -- * Vector |
19 | -- | 1D arrays are storable vectors from the vector package. There is no distinction | 22 | {- | 1D arrays are storable vectors directly reexported from the vector package. |
20 | -- between row and column vectors. | 23 | -} |
21 | 24 | ||
22 | fromList, toList, (|>), vector, range, idxs, | 25 | fromList, toList, (|>), vector, range, idxs, |
23 | 26 | ||
24 | -- * Matrix | 27 | -- * Matrix |
25 | 28 | ||
29 | {- | The main data type of hmatrix is a 2D dense array defined on top of | ||
30 | a storable vector. The internal representation is suitable for direct | ||
31 | interface with standard numeric libraries. | ||
32 | -} | ||
33 | |||
26 | (><), matrix, tr, tr', | 34 | (><), matrix, tr, tr', |
27 | 35 | ||
28 | -- * Dimensions | 36 | -- * Dimensions |
@@ -56,8 +64,9 @@ module Numeric.LinearAlgebra.Data( | |||
56 | -- * Matrix extraction | 64 | -- * Matrix extraction |
57 | Extractor(..), (??), | 65 | Extractor(..), (??), |
58 | 66 | ||
59 | takeRows, dropRows, takeColumns, dropColumns, | 67 | (?), (¿), fliprl, flipud, |
60 | subMatrix, (?), (¿), fliprl, flipud, | 68 | |
69 | subMatrix, takeRows, dropRows, takeColumns, dropColumns, | ||
61 | 70 | ||
62 | remap, | 71 | remap, |
63 | 72 | ||
@@ -92,7 +101,7 @@ module Numeric.LinearAlgebra.Data( | |||
92 | separable, | 101 | separable, |
93 | fromArray2D, | 102 | fromArray2D, |
94 | module Data.Complex, | 103 | module Data.Complex, |
95 | R,C,I,Z,Mod, type(./.), | 104 | Mod, |
96 | Vector, Matrix, GMatrix, nRows, nCols | 105 | Vector, Matrix, GMatrix, nRows, nCols |
97 | 106 | ||
98 | ) where | 107 | ) where |
diff --git a/packages/base/src/Numeric/LinearAlgebra/HMatrix.hs b/packages/base/src/Numeric/LinearAlgebra/HMatrix.hs index 8adaaaf..bac1c0c 100644 --- a/packages/base/src/Numeric/LinearAlgebra/HMatrix.hs +++ b/packages/base/src/Numeric/LinearAlgebra/HMatrix.hs | |||
@@ -13,7 +13,7 @@ compatibility with previous version, to be removed | |||
13 | 13 | ||
14 | module Numeric.LinearAlgebra.HMatrix ( | 14 | module Numeric.LinearAlgebra.HMatrix ( |
15 | module Numeric.LinearAlgebra, | 15 | module Numeric.LinearAlgebra, |
16 | (¦),(——),ℝ,ℂ,(<·>) | 16 | (¦),(——),ℝ,ℂ,(<·>),app,mul |
17 | ) where | 17 | ) where |
18 | 18 | ||
19 | import Numeric.LinearAlgebra | 19 | import Numeric.LinearAlgebra |
@@ -23,3 +23,7 @@ infixr 8 <·> | |||
23 | (<·>) :: Numeric t => Vector t -> Vector t -> t | 23 | (<·>) :: Numeric t => Vector t -> Vector t -> t |
24 | (<·>) = dot | 24 | (<·>) = dot |
25 | 25 | ||
26 | app m v = m #> v | ||
27 | |||
28 | mul a b = a <> b | ||
29 | |||
diff --git a/packages/base/src/Numeric/LinearAlgebra/Static.hs b/packages/base/src/Numeric/LinearAlgebra/Static.hs index d0a790d..0dab0e6 100644 --- a/packages/base/src/Numeric/LinearAlgebra/Static.hs +++ b/packages/base/src/Numeric/LinearAlgebra/Static.hs | |||
@@ -22,7 +22,7 @@ Stability : experimental | |||
22 | 22 | ||
23 | Experimental interface with statically checked dimensions. | 23 | Experimental interface with statically checked dimensions. |
24 | 24 | ||
25 | This module is under active development and the interface is subject to changes. | 25 | See code examples at http://dis.um.es/~alberto/hmatrix/static.html. |
26 | 26 | ||
27 | -} | 27 | -} |
28 | 28 | ||
@@ -65,7 +65,7 @@ import Numeric.LinearAlgebra hiding ( | |||
65 | row,col,vector,matrix,linspace,toRows,toColumns, | 65 | row,col,vector,matrix,linspace,toRows,toColumns, |
66 | (<\>),fromList,takeDiag,svd,eig,eigSH,eigSH', | 66 | (<\>),fromList,takeDiag,svd,eig,eigSH,eigSH', |
67 | eigenvalues,eigenvaluesSH,eigenvaluesSH',build, | 67 | eigenvalues,eigenvaluesSH,eigenvaluesSH',build, |
68 | qr,size,app,mul,dot,chol,range,R,C) | 68 | qr,size,dot,chol,range,R,C) |
69 | import qualified Numeric.LinearAlgebra as LA | 69 | import qualified Numeric.LinearAlgebra as LA |
70 | import Data.Proxy(Proxy) | 70 | import Data.Proxy(Proxy) |
71 | import Internal.Static | 71 | import Internal.Static |