summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2014-09-08 11:23:15 +0200
committerAlberto Ruiz <aruiz@um.es>2014-09-08 11:23:15 +0200
commit0c3bdccc5f3b91f3f9f100a9b3756c6b19c7f195 (patch)
treec4e82c395da963d2b6c9edb2174a545a0e999763
parent225901798773228e73b4c98670d56e844c040b3d (diff)
documentation, thanks
linearSolve examples, install, changelog
-rw-r--r--INSTALL.md3
-rw-r--r--packages/base/CHANGELOG6
-rw-r--r--packages/base/THANKS.md11
-rw-r--r--packages/base/src/Data/Packed/Numeric.hs24
-rw-r--r--packages/base/src/Numeric/LinearAlgebra/HMatrix.hs32
5 files changed, 69 insertions, 7 deletions
diff --git a/INSTALL.md b/INSTALL.md
index 00a9838..157036e 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -12,6 +12,9 @@ Ubuntu/Debian:
12 12
13Other distributions may require additional libraries. They can be given in a **--configure-option**. 13Other distributions may require additional libraries. They can be given in a **--configure-option**.
14 14
15Adrian Victor Crisciu has developed an [installation method](http://comments.gmane.org/gmane.comp.lang.haskell.glasgow.user/24976) for systems
16which don't provide shared lapack libraries.
17
15## Mac OS/X ############################################### 18## Mac OS/X ###############################################
16 19
17GSL must be installed via Homebrew or MacPorts. 20GSL must be installed via Homebrew or MacPorts.
diff --git a/packages/base/CHANGELOG b/packages/base/CHANGELOG
index 35ccdbc..95982ac 100644
--- a/packages/base/CHANGELOG
+++ b/packages/base/CHANGELOG
@@ -11,9 +11,11 @@
11 Numeric.LinearAlgebra.Data 11 Numeric.LinearAlgebra.Data
12 Numeric.LinearAlgebra.Devel 12 Numeric.LinearAlgebra.Devel
13 13
14 The documentation is now hidden for Data.Packed.*, Numeric.Container, and 14 For normal usage we only need to import Numeric.LinearAlgebra.HMatrix.
15
16 (The documentation is now hidden for Data.Packed.*, Numeric.Container, and
15 the other Numeric.LinearAlgebra.* modules, but they continue to be exposed 17 the other Numeric.LinearAlgebra.* modules, but they continue to be exposed
16 for backwards compatibility. 18 for backwards compatibility.)
17 19
18 * Added support for empty arrays, extending automatic conformability 20 * Added support for empty arrays, extending automatic conformability
19 (very useful for construction of block matrices). 21 (very useful for construction of block matrices).
diff --git a/packages/base/THANKS.md b/packages/base/THANKS.md
index 805a19e..571f370 100644
--- a/packages/base/THANKS.md
+++ b/packages/base/THANKS.md
@@ -139,7 +139,8 @@ module reorganization, monadic mapVectorM, and many other improvements.
139 139
140- Clemens Lang updated the MacPort installation instructions. 140- Clemens Lang updated the MacPort installation instructions.
141 141
142- Henning Thielemann reported the pinv inefficient implementation. 142- Henning Thielemann reported the pinv inefficient implementation and the need of
143 pkgconfig-depends.
143 144
144- bdoering reported the problem of zero absolute tolerance in the integration functions. 145- bdoering reported the problem of zero absolute tolerance in the integration functions.
145 146
@@ -157,9 +158,13 @@ module reorganization, monadic mapVectorM, and many other improvements.
157 158
158- Denis Laxalde separated the gsl tests from the base ones. 159- Denis Laxalde separated the gsl tests from the base ones.
159 160
160- "idontgetoutmuch" reported a bug in the static diagonal creation functions. 161- Dominic Steinitz (idontgetoutmuch) reported a bug in the static diagonal creation functions.
161 162
162- Dylan Thurston reported an error in the glpk documentation. 163- Dylan Thurston reported an error in the glpk documentation and ambiguity in
164 the description of linearSolve.
165
166- Adrian Victor Crisciu developed an installation method for platforms which
167 don't provide shared lapack libraries.
163 168
164- Ian Ross reported the max/minIndex bug. 169- Ian Ross reported the max/minIndex bug.
165 170
diff --git a/packages/base/src/Data/Packed/Numeric.hs b/packages/base/src/Data/Packed/Numeric.hs
index 7aa53f1..6027f43 100644
--- a/packages/base/src/Data/Packed/Numeric.hs
+++ b/packages/base/src/Data/Packed/Numeric.hs
@@ -160,7 +160,29 @@ instance Mul Vector Matrix Vector where
160 160
161-------------------------------------------------------------------------------- 161--------------------------------------------------------------------------------
162 162
163-- | least squares solution of a linear system, similar to the \\ operator of Matlab\/Octave (based on linearSolveSVD) 163{- | Least squares solution of a linear system, similar to the \\ operator of Matlab\/Octave (based on linearSolveSVD)
164
165@
166a = (3><2)
167 [ 1.0, 2.0
168 , 2.0, 4.0
169 , 2.0, -1.0 ]
170@
171
172@
173v = vector [13.0,27.0,1.0]
174@
175
176>>> let x = a <\> v
177>>> x
178fromList [3.0799999999999996,5.159999999999999]
179
180>>> a #> x
181fromList [13.399999999999999,26.799999999999997,1.0]
182
183It also admits multiple right-hand sides stored as columns in a matrix.
184
185-}
164infixl 7 <\> 186infixl 7 <\>
165(<\>) :: (LSDiv c, Field t) => Matrix t -> c t -> c t 187(<\>) :: (LSDiv c, Field t) => Matrix t -> c t -> c t
166(<\>) = linSolve 188(<\>) = linSolve
diff --git a/packages/base/src/Numeric/LinearAlgebra/HMatrix.hs b/packages/base/src/Numeric/LinearAlgebra/HMatrix.hs
index d2cae6c..c0cc622 100644
--- a/packages/base/src/Numeric/LinearAlgebra/HMatrix.hs
+++ b/packages/base/src/Numeric/LinearAlgebra/HMatrix.hs
@@ -194,7 +194,37 @@ mul :: Numeric t => Matrix t -> Matrix t -> Matrix t
194mul = mXm 194mul = mXm
195 195
196 196
197-- | Solve a linear system (for square coefficient matrix and several right-hand sides) using the LU decomposition, returning Nothing for a singular system. For underconstrained or overconstrained systems use 'linearSolveLS' or 'linearSolveSVD'. 197{- | Solve a linear system (for square coefficient matrix and several right-hand sides) using the LU decomposition, returning Nothing for a singular system. For underconstrained or overconstrained systems use 'linearSolveLS' or 'linearSolveSVD'.
198
199@
200a = (2><2)
201 [ 1.0, 2.0
202 , 3.0, 5.0 ]
203@
204
205@
206b = (2><3)
207 [ 6.0, 1.0, 10.0
208 , 15.0, 3.0, 26.0 ]
209@
210
211>>> linearSolve a b
212Just (2><3)
213 [ -1.4802973661668753e-15, 0.9999999999999997, 1.999999999999997
214 , 3.000000000000001, 1.6653345369377348e-16, 4.000000000000002 ]
215
216>>> let Just x = it
217>>> disp 5 x
2182x3
219-0.00000 1.00000 2.00000
220 3.00000 0.00000 4.00000
221
222>>> a <> x
223(2><3)
224 [ 6.0, 1.0, 10.0
225 , 15.0, 3.0, 26.0 ]
226
227-}
198linearSolve m b = A.mbLinearSolve m b 228linearSolve m b = A.mbLinearSolve m b
199 229
200-- | return an orthonormal basis of the null space of a matrix. See also 'nullspaceSVD'. 230-- | return an orthonormal basis of the null space of a matrix. See also 'nullspaceSVD'.