summaryrefslogtreecommitdiff
path: root/lib/LinearAlgebra/Interface.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/LinearAlgebra/Interface.hs')
-rw-r--r--lib/LinearAlgebra/Interface.hs7
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
17module LinearAlgebra.Interface( 17module LinearAlgebra.Interface(
18 (<>),(<.>), 18 (<>),(<.>),
19 (<\>),
19 (.*),(*/), 20 (.*),(*/),
20 (<|>),(<->), 21 (<|>),(<->),
21) where 22) where
@@ -23,6 +24,7 @@ module LinearAlgebra.Interface(
23import LinearAlgebra.Linear 24import LinearAlgebra.Linear
24import Data.Packed.Vector 25import Data.Packed.Vector
25import Data.Packed.Matrix 26import Data.Packed.Matrix
27import LinearAlgebra.Algorithms
26 28
27class Mul a b c | a b -> c where 29class Mul a b c | a b -> c where
28 infixl 7 <> 30 infixl 7 <>
@@ -59,6 +61,11 @@ a .* x = scale a x
59infixl 7 */ 61infixl 7 */
60v */ x = scale (recip x) v 62v */ 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
66infixl 7 <\>
67m <\> v = flatten (linearSolveSVD m (reshape 1 v))
68
62------------------------------------------------ 69------------------------------------------------
63 70
64class Joinable a b where 71class Joinable a b where