diff options
author | Alberto Ruiz <aruiz@um.es> | 2014-05-27 10:41:40 +0200 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2014-05-27 10:41:40 +0200 |
commit | cf3c788f0c44577ac1a5365e8154200b53a36409 (patch) | |
tree | d667ea10609e74b69b11309bb59b7e000b240a92 /packages/base/src/Numeric/HMatrix.hs | |
parent | 365e2435e71de10ebe849acac5a107b6f43817c4 (diff) |
static dimensions, cont.
Diffstat (limited to 'packages/base/src/Numeric/HMatrix.hs')
-rw-r--r-- | packages/base/src/Numeric/HMatrix.hs | 63 |
1 files changed, 35 insertions, 28 deletions
diff --git a/packages/base/src/Numeric/HMatrix.hs b/packages/base/src/Numeric/HMatrix.hs index d5c66fb..1c70ef6 100644 --- a/packages/base/src/Numeric/HMatrix.hs +++ b/packages/base/src/Numeric/HMatrix.hs | |||
@@ -10,16 +10,16 @@ Stability : provisional | |||
10 | ----------------------------------------------------------------------------- | 10 | ----------------------------------------------------------------------------- |
11 | module Numeric.HMatrix ( | 11 | module Numeric.HMatrix ( |
12 | 12 | ||
13 | -- * Basic types and data processing | 13 | -- * Basic types and data processing |
14 | module Numeric.LinearAlgebra.Data, | 14 | module Numeric.LinearAlgebra.Data, |
15 | 15 | ||
16 | -- * Arithmetic and numeric classes | 16 | -- * Arithmetic and numeric classes |
17 | -- | | 17 | -- | |
18 | -- The standard numeric classes are defined elementwise: | 18 | -- The standard numeric classes are defined elementwise: |
19 | -- | 19 | -- |
20 | -- >>> fromList [1,2,3] * fromList [3,0,-2 :: Double] | 20 | -- >>> fromList [1,2,3] * fromList [3,0,-2 :: Double] |
21 | -- fromList [3.0,0.0,-6.0] | 21 | -- fromList [3.0,0.0,-6.0] |
22 | -- | 22 | -- |
23 | -- >>> (3><3) [1..9] * ident 3 :: Matrix Double | 23 | -- >>> (3><3) [1..9] * ident 3 :: Matrix Double |
24 | -- (3><3) | 24 | -- (3><3) |
25 | -- [ 1.0, 0.0, 0.0 | 25 | -- [ 1.0, 0.0, 0.0 |
@@ -29,7 +29,7 @@ module Numeric.HMatrix ( | |||
29 | -- In arithmetic operations single-element vectors and matrices | 29 | -- In arithmetic operations single-element vectors and matrices |
30 | -- (created from numeric literals or using 'scalar') automatically | 30 | -- (created from numeric literals or using 'scalar') automatically |
31 | -- expand to match the dimensions of the other operand: | 31 | -- expand to match the dimensions of the other operand: |
32 | -- | 32 | -- |
33 | -- >>> 5 + 2*ident 3 :: Matrix Double | 33 | -- >>> 5 + 2*ident 3 :: Matrix Double |
34 | -- (3><3) | 34 | -- (3><3) |
35 | -- [ 7.0, 5.0, 5.0 | 35 | -- [ 7.0, 5.0, 5.0 |
@@ -37,13 +37,14 @@ module Numeric.HMatrix ( | |||
37 | -- , 5.0, 5.0, 7.0 ] | 37 | -- , 5.0, 5.0, 7.0 ] |
38 | -- | 38 | -- |
39 | 39 | ||
40 | -- * Matrix product | 40 | -- * Products |
41 | (<.>), | 41 | -- ** dot |
42 | 42 | (<·>), | |
43 | -- | The overloaded multiplication operators may need type annotations to remove | 43 | -- ** matrix-vector |
44 | -- ambiguity. In those cases we can also use the specific functions 'mXm', 'mXv', and 'dot'. | 44 | (#>),(!#>), |
45 | -- | 45 | -- ** matrix-matrix |
46 | -- The matrix x matrix product is also implemented in the "Data.Monoid" instance, where | 46 | (<>), |
47 | -- | The matrix x matrix product is also implemented in the "Data.Monoid" instance, where | ||
47 | -- single-element matrices (created from numeric literals or using 'scalar') | 48 | -- single-element matrices (created from numeric literals or using 'scalar') |
48 | -- are used for scaling. | 49 | -- are used for scaling. |
49 | -- | 50 | -- |
@@ -55,12 +56,12 @@ module Numeric.HMatrix ( | |||
55 | -- | 56 | -- |
56 | -- 'mconcat' uses 'optimiseMult' to get the optimal association order. | 57 | -- 'mconcat' uses 'optimiseMult' to get the optimal association order. |
57 | 58 | ||
58 | 59 | ||
59 | -- * Other products | 60 | -- ** other |
60 | outer, kronecker, cross, | 61 | outer, kronecker, cross, |
61 | scale, | 62 | scale, |
62 | sumElements, prodElements, | 63 | sumElements, prodElements, |
63 | 64 | ||
64 | -- * Linear Systems | 65 | -- * Linear Systems |
65 | (<\>), | 66 | (<\>), |
66 | linearSolve, | 67 | linearSolve, |
@@ -70,14 +71,14 @@ module Numeric.HMatrix ( | |||
70 | cholSolve, | 71 | cholSolve, |
71 | cgSolve, | 72 | cgSolve, |
72 | cgSolve', | 73 | cgSolve', |
73 | 74 | ||
74 | -- * Inverse and pseudoinverse | 75 | -- * Inverse and pseudoinverse |
75 | inv, pinv, pinvTol, | 76 | inv, pinv, pinvTol, |
76 | 77 | ||
77 | -- * Determinant and rank | 78 | -- * Determinant and rank |
78 | rcond, rank, ranksv, | 79 | rcond, rank, ranksv, |
79 | det, invlndet, | 80 | det, invlndet, |
80 | 81 | ||
81 | -- * Singular value decomposition | 82 | -- * Singular value decomposition |
82 | svd, | 83 | svd, |
83 | fullSVD, | 84 | fullSVD, |
@@ -85,7 +86,7 @@ module Numeric.HMatrix ( | |||
85 | compactSVD, | 86 | compactSVD, |
86 | singularValues, | 87 | singularValues, |
87 | leftSV, rightSV, | 88 | leftSV, rightSV, |
88 | 89 | ||
89 | -- * Eigensystems | 90 | -- * Eigensystems |
90 | eig, eigSH, eigSH', | 91 | eig, eigSH, eigSH', |
91 | eigenvalues, eigenvaluesSH, eigenvaluesSH', | 92 | eigenvalues, eigenvaluesSH, eigenvaluesSH', |
@@ -105,7 +106,7 @@ module Numeric.HMatrix ( | |||
105 | 106 | ||
106 | -- * LU | 107 | -- * LU |
107 | lu, luPacked, | 108 | lu, luPacked, |
108 | 109 | ||
109 | -- * Matrix functions | 110 | -- * Matrix functions |
110 | expm, | 111 | expm, |
111 | sqrtm, | 112 | sqrtm, |
@@ -116,7 +117,7 @@ module Numeric.HMatrix ( | |||
116 | nullVector, | 117 | nullVector, |
117 | nullspaceSVD, | 118 | nullspaceSVD, |
118 | null1, null1sym, | 119 | null1, null1sym, |
119 | 120 | ||
120 | orth, | 121 | orth, |
121 | 122 | ||
122 | -- * Norms | 123 | -- * Norms |
@@ -129,30 +130,36 @@ module Numeric.HMatrix ( | |||
129 | 130 | ||
130 | -- * Random arrays | 131 | -- * Random arrays |
131 | 132 | ||
132 | RandDist(..), randomVector, rand, randn, gaussianSample, uniformSample, | 133 | Seed, RandDist(..), randomVector, rand, randn, gaussianSample, uniformSample, |
133 | 134 | ||
134 | -- * Misc | 135 | -- * Misc |
135 | meanCov, peps, relativeError, haussholder, optimiseMult, dot, udot, mXm, mXv, smXv, (<>), (◇), Seed, checkT, | 136 | meanCov, peps, relativeError, haussholder, optimiseMult, udot, |
136 | -- * Auxiliary classes | 137 | -- * Auxiliary classes |
137 | Element, Container, Product, Numeric, Contraction, LSDiv, | 138 | Element, Container, Product, Contraction(..), Numeric, LSDiv, |
138 | Complexable, RealElement, | 139 | Complexable, RealElement, |
139 | RealOf, ComplexOf, SingleOf, DoubleOf, | 140 | RealOf, ComplexOf, SingleOf, DoubleOf, |
140 | IndexOf, | 141 | IndexOf, |
141 | Field, | 142 | Field, |
142 | Normed, | 143 | Normed, |
143 | CGMat, Transposable, | 144 | Transposable, |
144 | ℕ,ℤ,ℝ,ℂ,ℝn,ℂn, 𝑖, i_C --ℍ | 145 | CGState(..), |
146 | Testable(..), | ||
147 | ℕ,ℤ,ℝ,ℂ, 𝑖, i_C --ℍ | ||
145 | ) where | 148 | ) where |
146 | 149 | ||
147 | import Numeric.LinearAlgebra.Data | 150 | import Numeric.LinearAlgebra.Data |
148 | 151 | ||
149 | import Numeric.Matrix() | 152 | import Numeric.Matrix() |
150 | import Numeric.Vector() | 153 | import Numeric.Vector() |
151 | import Data.Packed.Numeric | 154 | import Data.Packed.Numeric hiding ((<>)) |
152 | import Numeric.LinearAlgebra.Algorithms | 155 | import Numeric.LinearAlgebra.Algorithms |
153 | import Numeric.LinearAlgebra.Util | 156 | import Numeric.LinearAlgebra.Util |
154 | import Numeric.LinearAlgebra.Random | 157 | import Numeric.LinearAlgebra.Random |
155 | import Numeric.Sparse(smXv) | 158 | import Numeric.Sparse((!#>)) |
156 | import Numeric.LinearAlgebra.Util.CG | 159 | import Numeric.LinearAlgebra.Util.CG |
157 | 160 | ||
161 | -- | matrix product | ||
162 | (<>) :: Numeric t => Matrix t -> Matrix t -> Matrix t | ||
163 | (<>) = mXm | ||
164 | infixr 8 <> | ||
158 | 165 | ||