diff options
Diffstat (limited to 'packages/base/src/Numeric/LinearAlgebra.hs')
-rw-r--r-- | packages/base/src/Numeric/LinearAlgebra.hs | 149 |
1 files changed, 8 insertions, 141 deletions
diff --git a/packages/base/src/Numeric/LinearAlgebra.hs b/packages/base/src/Numeric/LinearAlgebra.hs index 242122f..ad315e4 100644 --- a/packages/base/src/Numeric/LinearAlgebra.hs +++ b/packages/base/src/Numeric/LinearAlgebra.hs | |||
@@ -1,4 +1,4 @@ | |||
1 | ----------------------------------------------------------------------------- | 1 | -------------------------------------------------------------------------------- |
2 | {- | | 2 | {- | |
3 | Module : Numeric.LinearAlgebra | 3 | Module : Numeric.LinearAlgebra |
4 | Copyright : (c) Alberto Ruiz 2006-14 | 4 | Copyright : (c) Alberto Ruiz 2006-14 |
@@ -7,149 +7,16 @@ Maintainer : Alberto Ruiz | |||
7 | Stability : provisional | 7 | Stability : provisional |
8 | 8 | ||
9 | -} | 9 | -} |
10 | ----------------------------------------------------------------------------- | 10 | -------------------------------------------------------------------------------- |
11 | module Numeric.LinearAlgebra ( | 11 | {-# OPTIONS_HADDOCK hide #-} |
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, absSum, | ||
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 | 12 | ||
114 | -- * Nullspace | 13 | module Numeric.LinearAlgebra ( |
115 | nullspacePrec, | 14 | module Numeric.Container, |
116 | nullVector, | 15 | module Numeric.LinearAlgebra.Algorithms |
117 | nullspaceSVD, | ||
118 | null1, null1sym, | ||
119 | |||
120 | orth, | ||
121 | |||
122 | -- * Norms | ||
123 | norm1, norm2, normInf, pnorm, NormType(..), | ||
124 | |||
125 | -- * Correlation and convolution | ||
126 | corr, conv, corrMin, corr2, conv2, | ||
127 | |||
128 | -- * Random arrays | ||
129 | |||
130 | RandDist(..), randomVector, rand, randn, gaussianSample, uniformSample, | ||
131 | |||
132 | -- * Misc | ||
133 | meanCov, peps, relativeError, haussholder, optimiseMult, dot, udot, mXm, mXv, smXv, (<>), (◇), Seed, checkT, | ||
134 | -- * Auxiliary classes | ||
135 | Element, Container, Product, Contraction, LSDiv, | ||
136 | Complexable(), RealElement(), | ||
137 | RealOf, ComplexOf, SingleOf, DoubleOf, | ||
138 | IndexOf, | ||
139 | Field, Normed, | ||
140 | CGMat, Transposable, | ||
141 | R,V | ||
142 | ) where | 16 | ) where |
143 | 17 | ||
144 | import Numeric.LinearAlgebra.Data | ||
145 | |||
146 | import Numeric.Matrix() | ||
147 | import Numeric.Vector() | ||
148 | import Numeric.Container | 18 | import Numeric.Container |
149 | import Numeric.LinearAlgebra.Algorithms | 19 | import Numeric.LinearAlgebra.Algorithms |
150 | import Numeric.LinearAlgebra.Util | 20 | import Numeric.Matrix() |
151 | import Numeric.LinearAlgebra.Random | 21 | import Numeric.Vector() |
152 | import Numeric.Sparse(smXv) | ||
153 | import Numeric.LinearAlgebra.Util.CG | ||
154 | |||
155 | 22 | ||