diff options
Diffstat (limited to 'lib/LinearAlgebra/Interface.hs')
-rw-r--r-- | lib/LinearAlgebra/Interface.hs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/LinearAlgebra/Interface.hs b/lib/LinearAlgebra/Interface.hs index 3392d54..0c65a8b 100644 --- a/lib/LinearAlgebra/Interface.hs +++ b/lib/LinearAlgebra/Interface.hs | |||
@@ -16,6 +16,7 @@ Operators for frequent operations. | |||
16 | 16 | ||
17 | module LinearAlgebra.Interface( | 17 | module LinearAlgebra.Interface( |
18 | (<>),(<.>), | 18 | (<>),(<.>), |
19 | (<\>), | ||
19 | (.*),(*/), | 20 | (.*),(*/), |
20 | (<|>),(<->), | 21 | (<|>),(<->), |
21 | ) where | 22 | ) where |
@@ -23,6 +24,7 @@ module LinearAlgebra.Interface( | |||
23 | import LinearAlgebra.Linear | 24 | import LinearAlgebra.Linear |
24 | import Data.Packed.Vector | 25 | import Data.Packed.Vector |
25 | import Data.Packed.Matrix | 26 | import Data.Packed.Matrix |
27 | import LinearAlgebra.Algorithms | ||
26 | 28 | ||
27 | class Mul a b c | a b -> c where | 29 | class Mul a b c | a b -> c where |
28 | infixl 7 <> | 30 | infixl 7 <> |
@@ -59,6 +61,11 @@ a .* x = scale a x | |||
59 | infixl 7 */ | 61 | infixl 7 */ |
60 | v */ x = scale (recip x) v | 62 | v */ x = scale (recip x) v |
61 | 63 | ||
64 | -- | least squares solution of a linear system, similar to the \\ operator of Matlab\/Octave (based on linearSolveSVD). | ||
65 | (<\>) :: (GenMat a) => Matrix a -> Vector a -> Vector a | ||
66 | infixl 7 <\> | ||
67 | m <\> v = flatten (linearSolveSVD m (reshape 1 v)) | ||
68 | |||
62 | ------------------------------------------------ | 69 | ------------------------------------------------ |
63 | 70 | ||
64 | class Joinable a b where | 71 | class Joinable a b where |