diff options
author | Alberto Ruiz <aruiz@um.es> | 2014-09-08 11:23:15 +0200 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2014-09-08 11:23:15 +0200 |
commit | 0c3bdccc5f3b91f3f9f100a9b3756c6b19c7f195 (patch) | |
tree | c4e82c395da963d2b6c9edb2174a545a0e999763 /packages/base/src/Data/Packed/Numeric.hs | |
parent | 225901798773228e73b4c98670d56e844c040b3d (diff) |
documentation, thanks
linearSolve examples, install, changelog
Diffstat (limited to 'packages/base/src/Data/Packed/Numeric.hs')
-rw-r--r-- | packages/base/src/Data/Packed/Numeric.hs | 24 |
1 files changed, 23 insertions, 1 deletions
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 | @ | ||
166 | a = (3><2) | ||
167 | [ 1.0, 2.0 | ||
168 | , 2.0, 4.0 | ||
169 | , 2.0, -1.0 ] | ||
170 | @ | ||
171 | |||
172 | @ | ||
173 | v = vector [13.0,27.0,1.0] | ||
174 | @ | ||
175 | |||
176 | >>> let x = a <\> v | ||
177 | >>> x | ||
178 | fromList [3.0799999999999996,5.159999999999999] | ||
179 | |||
180 | >>> a #> x | ||
181 | fromList [13.399999999999999,26.799999999999997,1.0] | ||
182 | |||
183 | It also admits multiple right-hand sides stored as columns in a matrix. | ||
184 | |||
185 | -} | ||
164 | infixl 7 <\> | 186 | infixl 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 |