diff options
Diffstat (limited to 'lib/Numeric/HMatrix.hs')
-rw-r--r-- | lib/Numeric/HMatrix.hs | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/lib/Numeric/HMatrix.hs b/lib/Numeric/HMatrix.hs index 8e0b4a2..a2f09df 100644 --- a/lib/Numeric/HMatrix.hs +++ b/lib/Numeric/HMatrix.hs | |||
@@ -16,25 +16,45 @@ module Numeric.HMatrix ( | |||
16 | -- * Basic types and data processing | 16 | -- * Basic types and data processing |
17 | module Numeric.HMatrix.Data, | 17 | module Numeric.HMatrix.Data, |
18 | 18 | ||
19 | -- | The standard numeric classes are defined elementwise. | 19 | -- | The standard numeric classes are defined elementwise: |
20 | -- | 20 | -- |
21 | -- >>> fromList [1,2,3] * fromList [3,0,-2 :: Double] | 21 | -- >>> fromList [1,2,3] * fromList [3,0,-2 :: Double] |
22 | -- fromList [3.0,0.0,-6.0] | 22 | -- fromList [3.0,0.0,-6.0] |
23 | -- | 23 | -- |
24 | -- In arithmetic operations single-element vectors and matrices automatically | 24 | -- >>> (3><3) [1..9] * ident 3 :: Matrix Double |
25 | -- expand to match the dimensions of the other operand. | 25 | -- (3><3) |
26 | -- [ 1.0, 0.0, 0.0 | ||
27 | -- , 0.0, 5.0, 0.0 | ||
28 | -- , 0.0, 0.0, 9.0 ] | ||
29 | -- | ||
30 | -- In arithmetic operations single-element vectors and matrices | ||
31 | -- (created from numeric literals or using 'scalar') automatically | ||
32 | -- expand to match the dimensions of the other operand: | ||
26 | -- | 33 | -- |
27 | -- >>> 2 * ident 3 | 34 | -- >>> 5 + 2*ident 3 :: Matrix Double |
28 | -- 2 * ident 3 :: Matrix Double | ||
29 | -- (3><3) | 35 | -- (3><3) |
30 | -- [ 2.0, 0.0, 0.0 | 36 | -- [ 7.0, 5.0, 5.0 |
31 | -- , 0.0, 2.0, 0.0 | 37 | -- , 5.0, 7.0, 5.0 |
32 | -- , 0.0, 0.0, 2.0 ] | 38 | -- , 5.0, 5.0, 7.0 ] |
33 | -- | 39 | -- |
34 | 40 | ||
35 | -- * Products | 41 | -- * Products |
36 | (<>), (·), outer, kronecker, cross, | 42 | (×), |
37 | optimiseMult, scale, | 43 | |
44 | -- | The matrix product is also implemented in the "Data.Monoid" instance for Matrix, where | ||
45 | -- single-element matrices (created from numeric literals or using 'scalar') | ||
46 | -- are used for scaling. | ||
47 | -- | ||
48 | -- >>> let m = (2><3)[1..] :: Matrix Double | ||
49 | -- >>> m <> 2 <> diagl[0.5,1,0] | ||
50 | -- (2><3) | ||
51 | -- [ 1.0, 4.0, 0.0 | ||
52 | -- , 4.0, 10.0, 0.0 ] | ||
53 | -- | ||
54 | -- mconcat uses 'optimiseMult' to get the optimal association order. | ||
55 | |||
56 | (·), outer, kronecker, cross, | ||
57 | scale, | ||
38 | sumElements, prodElements, absSum, | 58 | sumElements, prodElements, absSum, |
39 | 59 | ||
40 | -- * Linear Systems | 60 | -- * Linear Systems |
@@ -103,7 +123,7 @@ module Numeric.HMatrix ( | |||
103 | rand, randn, RandDist(..), randomVector, gaussianSample, uniformSample, | 123 | rand, randn, RandDist(..), randomVector, gaussianSample, uniformSample, |
104 | 124 | ||
105 | -- * Misc | 125 | -- * Misc |
106 | meanCov, peps, relativeError, haussholder | 126 | meanCov, peps, relativeError, haussholder, optimiseMult, udot, cdot, mmul |
107 | ) where | 127 | ) where |
108 | 128 | ||
109 | import Numeric.HMatrix.Data | 129 | import Numeric.HMatrix.Data |
@@ -114,4 +134,3 @@ import Numeric.Container | |||
114 | import Numeric.LinearAlgebra.Algorithms | 134 | import Numeric.LinearAlgebra.Algorithms |
115 | import Numeric.LinearAlgebra.Util | 135 | import Numeric.LinearAlgebra.Util |
116 | 136 | ||
117 | |||