diff options
Diffstat (limited to 'packages/base/src/Numeric/HMatrix.hs')
-rw-r--r-- | packages/base/src/Numeric/HMatrix.hs | 158 |
1 files changed, 158 insertions, 0 deletions
diff --git a/packages/base/src/Numeric/HMatrix.hs b/packages/base/src/Numeric/HMatrix.hs new file mode 100644 index 0000000..a56c3d2 --- /dev/null +++ b/packages/base/src/Numeric/HMatrix.hs | |||
@@ -0,0 +1,158 @@ | |||
1 | ----------------------------------------------------------------------------- | ||
2 | {- | | ||
3 | Module : Numeric.HMatrix | ||
4 | Copyright : (c) Alberto Ruiz 2006-14 | ||
5 | License : BSD3 | ||
6 | Maintainer : Alberto Ruiz | ||
7 | Stability : provisional | ||
8 | |||
9 | -} | ||
10 | ----------------------------------------------------------------------------- | ||
11 | module Numeric.HMatrix ( | ||
12 | |||
13 | -- * Basic types and data processing | ||
14 | module Numeric.LinearAlgebra.Data, | ||
15 | |||
16 | -- * Arithmetic and numeric classes | ||
17 | -- | | ||
18 | -- The standard numeric classes are defined elementwise: | ||
19 | -- | ||
20 | -- >>> fromList [1,2,3] * fromList [3,0,-2 :: Double] | ||
21 | -- fromList [3.0,0.0,-6.0] | ||
22 | -- | ||
23 | -- >>> (3><3) [1..9] * ident 3 :: Matrix Double | ||
24 | -- (3><3) | ||
25 | -- [ 1.0, 0.0, 0.0 | ||
26 | -- , 0.0, 5.0, 0.0 | ||
27 | -- , 0.0, 0.0, 9.0 ] | ||
28 | -- | ||
29 | -- In arithmetic operations single-element vectors and matrices | ||
30 | -- (created from numeric literals or using 'scalar') automatically | ||
31 | -- expand to match the dimensions of the other operand: | ||
32 | -- | ||
33 | -- >>> 5 + 2*ident 3 :: Matrix Double | ||
34 | -- (3><3) | ||
35 | -- [ 7.0, 5.0, 5.0 | ||
36 | -- , 5.0, 7.0, 5.0 | ||
37 | -- , 5.0, 5.0, 7.0 ] | ||
38 | -- | ||
39 | |||
40 | -- * Matrix product | ||
41 | (<.>), | ||
42 | |||
43 | -- | The overloaded multiplication operators may need type annotations to remove | ||
44 | -- ambiguity. In those cases we can also use the specific functions 'mXm', 'mXv', and 'dot'. | ||
45 | -- | ||
46 | -- 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 | -- are used for scaling. | ||
49 | -- | ||
50 | -- >>> let m = (2><3)[1..] :: Matrix Double | ||
51 | -- >>> m <> 2 <> diagl[0.5,1,0] | ||
52 | -- (2><3) | ||
53 | -- [ 1.0, 4.0, 0.0 | ||
54 | -- , 4.0, 10.0, 0.0 ] | ||
55 | -- | ||
56 | -- 'mconcat' uses 'optimiseMult' to get the optimal association order. | ||
57 | |||
58 | |||
59 | -- * Other products | ||
60 | outer, kronecker, cross, | ||
61 | scale, | ||
62 | sumElements, prodElements, | ||
63 | |||
64 | -- * Linear Systems | ||
65 | (<\>), | ||
66 | linearSolve, | ||
67 | linearSolveLS, | ||
68 | linearSolveSVD, | ||
69 | luSolve, | ||
70 | cholSolve, | ||
71 | cgSolve, | ||
72 | cgSolve', | ||
73 | |||
74 | -- * Inverse and pseudoinverse | ||
75 | inv, pinv, pinvTol, | ||
76 | |||
77 | -- * Determinant and rank | ||
78 | rcond, rank, ranksv, | ||
79 | det, invlndet, | ||
80 | |||
81 | -- * Singular value decomposition | ||
82 | svd, | ||
83 | fullSVD, | ||
84 | thinSVD, | ||
85 | compactSVD, | ||
86 | singularValues, | ||
87 | leftSV, rightSV, | ||
88 | |||
89 | -- * Eigensystems | ||
90 | eig, eigSH, eigSH', | ||
91 | eigenvalues, eigenvaluesSH, eigenvaluesSH', | ||
92 | geigSH', | ||
93 | |||
94 | -- * QR | ||
95 | qr, rq, qrRaw, qrgr, | ||
96 | |||
97 | -- * Cholesky | ||
98 | chol, cholSH, mbCholSH, | ||
99 | |||
100 | -- * Hessenberg | ||
101 | hess, | ||
102 | |||
103 | -- * Schur | ||
104 | schur, | ||
105 | |||
106 | -- * LU | ||
107 | lu, luPacked, | ||
108 | |||
109 | -- * Matrix functions | ||
110 | expm, | ||
111 | sqrtm, | ||
112 | matFunc, | ||
113 | |||
114 | -- * Nullspace | ||
115 | nullspacePrec, | ||
116 | nullVector, | ||
117 | nullspaceSVD, | ||
118 | null1, null1sym, | ||
119 | |||
120 | orth, | ||
121 | |||
122 | -- * Norms | ||
123 | norm_0, norm_1, norm_2, norm_Inf, | ||
124 | mnorm_0, mnorm_1, mnorm_2, mnorm_Inf, | ||
125 | norm_Frob, norm_nuclear, | ||
126 | |||
127 | -- * Correlation and convolution | ||
128 | corr, conv, corrMin, corr2, conv2, | ||
129 | |||
130 | -- * Random arrays | ||
131 | |||
132 | RandDist(..), randomVector, rand, randn, gaussianSample, uniformSample, | ||
133 | |||
134 | -- * Misc | ||
135 | meanCov, peps, relativeError, haussholder, optimiseMult, dot, udot, mXm, mXv, smXv, (<>), (◇), Seed, checkT, | ||
136 | -- * Auxiliary classes | ||
137 | Element, Container, Product, Contraction, LSDiv, | ||
138 | Complexable, RealElement, | ||
139 | RealOf, ComplexOf, SingleOf, DoubleOf, | ||
140 | IndexOf, | ||
141 | Field, | ||
142 | Normed, | ||
143 | CGMat, Transposable, | ||
144 | ℕ,ℤ,ℝ,ℂ,ℝn,ℂn, 𝑖, i_C --ℍ | ||
145 | ) where | ||
146 | |||
147 | import Numeric.LinearAlgebra.Data | ||
148 | |||
149 | import Numeric.Matrix() | ||
150 | import Numeric.Vector() | ||
151 | import Data.Packed.Numeric | ||
152 | import Numeric.LinearAlgebra.Algorithms | ||
153 | import Numeric.LinearAlgebra.Util | ||
154 | import Numeric.LinearAlgebra.Random | ||
155 | import Numeric.Sparse(smXv) | ||
156 | import Numeric.LinearAlgebra.Util.CG | ||
157 | |||
158 | |||