diff options
Diffstat (limited to 'lib/Numeric/LinearAlgebra/Real.hs')
-rw-r--r-- | lib/Numeric/LinearAlgebra/Real.hs | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/lib/Numeric/LinearAlgebra/Real.hs b/lib/Numeric/LinearAlgebra/Real.hs index 6cba045..08a218c 100644 --- a/lib/Numeric/LinearAlgebra/Real.hs +++ b/lib/Numeric/LinearAlgebra/Real.hs | |||
@@ -13,7 +13,7 @@ Additional functions for real arrays. | |||
13 | ----------------------------------------------------------------------------- | 13 | ----------------------------------------------------------------------------- |
14 | 14 | ||
15 | module Numeric.LinearAlgebra.Real( | 15 | module Numeric.LinearAlgebra.Real( |
16 | (<>), (*>), (<*), (<\>), (\>), | 16 | (<>), (<\>), |
17 | vector, | 17 | vector, |
18 | linspace, | 18 | linspace, |
19 | eye, | 19 | eye, |
@@ -22,7 +22,8 @@ module Numeric.LinearAlgebra.Real( | |||
22 | row, | 22 | row, |
23 | col, | 23 | col, |
24 | (#),(&), (//), blocks, | 24 | (#),(&), (//), blocks, |
25 | rand, randn | 25 | rand, randn, |
26 | module Numeric.LinearAlgebra | ||
26 | ) where | 27 | ) where |
27 | 28 | ||
28 | import Numeric.LinearAlgebra hiding ((<>), (<\>), linspace) | 29 | import Numeric.LinearAlgebra hiding ((<>), (<\>), linspace) |
@@ -34,30 +35,16 @@ linspace = LA.linspace | |||
34 | 35 | ||
35 | 36 | ||
36 | infixl 7 <> | 37 | infixl 7 <> |
37 | -- | Matrix product ('multiply') | 38 | -- | Matrix product |
38 | (<>) :: Field t => Matrix t -> Matrix t -> Matrix t | 39 | (<>) ::Mul a b c => a Double -> b Double -> c Double |
39 | (<>) = multiply | 40 | (<>) = (LA.<>) |
40 | 41 | ||
41 | infixl 7 *> | ||
42 | -- | matrix x vector | ||
43 | (*>) :: Field t => Matrix t -> Vector t -> Vector t | ||
44 | m *> v = flatten $ m <> (asColumn v) | ||
45 | 42 | ||
46 | infixl 7 <* | ||
47 | -- | vector x matrix | ||
48 | (<*) :: Field t => Vector t -> Matrix t -> Vector t | ||
49 | v <* m = flatten $ (asRow v) <> m | ||
50 | |||
51 | |||
52 | -- | Least squares solution of a linear system for several right-hand sides, similar to the \\ operator of Matlab\/Octave. (\<\\\>) = 'linearSolveSVD'. | ||
53 | (<\>) :: (Field a) => Matrix a -> Matrix a -> Matrix a | ||
54 | infixl 7 <\> | 43 | infixl 7 <\> |
55 | (<\>) = linearSolveSVD | 44 | -- | Least squares solution of a linear system |
45 | (<\>) ::LSDiv b c => Matrix Double -> b Double -> c Double | ||
46 | (<\>) = (LA.<\>) | ||
56 | 47 | ||
57 | -- | Least squares solution of a linear system for a single right-hand side. See '(\<\\\>)'. | ||
58 | (\>) :: (Field a) => Matrix a -> Vector a -> Vector a | ||
59 | infixl 7 \> | ||
60 | m \> v = flatten (m <\> reshape 1 v) | ||
61 | 48 | ||
62 | -- | Pseudorandom matrix with uniform elements between 0 and 1. | 49 | -- | Pseudorandom matrix with uniform elements between 0 and 1. |
63 | randm :: RandDist | 50 | randm :: RandDist |