summaryrefslogtreecommitdiff
path: root/lib/Numeric/LinearAlgebra/Interface.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Numeric/LinearAlgebra/Interface.hs')
-rw-r--r--lib/Numeric/LinearAlgebra/Interface.hs14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/Numeric/LinearAlgebra/Interface.hs b/lib/Numeric/LinearAlgebra/Interface.hs
index fd076ec..4a9b309 100644
--- a/lib/Numeric/LinearAlgebra/Interface.hs
+++ b/lib/Numeric/LinearAlgebra/Interface.hs
@@ -29,7 +29,7 @@ import Numeric.LinearAlgebra.Algorithms
29class Mul a b c | a b -> c where 29class Mul a b c | a b -> c where
30 infixl 7 <> 30 infixl 7 <>
31 -- | matrix product 31 -- | matrix product
32 (<>) :: Field t => a t -> b t -> c t 32 (<>) :: Element t => a t -> b t -> c t
33 33
34instance Mul Matrix Matrix Matrix where 34instance Mul Matrix Matrix Matrix where
35 (<>) = multiply 35 (<>) = multiply
@@ -43,7 +43,7 @@ instance Mul Vector Matrix Vector where
43--------------------------------------------------- 43---------------------------------------------------
44 44
45-- | @u \<.\> v = dot u v@ 45-- | @u \<.\> v = dot u v@
46(<.>) :: (Field t) => Vector t -> Vector t -> t 46(<.>) :: (Element t) => Vector t -> Vector t -> t
47infixl 7 <.> 47infixl 7 <.>
48(<.>) = dot 48(<.>) = dot
49 49
@@ -62,15 +62,15 @@ infixl 7 */
62v */ x = scale (recip x) v 62v */ x = scale (recip x) v
63 63
64-- | least squares solution of a linear system, similar to the \\ operator of Matlab\/Octave (based on linearSolveSVD). 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 65(<\>) :: (Field a) => Matrix a -> Vector a -> Vector a
66infixl 7 <\> 66infixl 7 <\>
67m <\> v = flatten (linearSolveSVD m (reshape 1 v)) 67m <\> v = flatten (linearSolveSVD m (reshape 1 v))
68 68
69------------------------------------------------ 69------------------------------------------------
70 70
71class Joinable a b where 71class Joinable a b where
72 joinH :: Field t => a t -> b t -> Matrix t 72 joinH :: Element t => a t -> b t -> Matrix t
73 joinV :: Field t => a t -> b t -> Matrix t 73 joinV :: Element t => a t -> b t -> Matrix t
74 74
75instance Joinable Matrix Matrix where 75instance Joinable Matrix Matrix where
76 joinH m1 m2 = fromBlocks [[m1,m2]] 76 joinH m1 m2 = fromBlocks [[m1,m2]]
@@ -98,9 +98,9 @@ infixl 3 <->
98 , 0.0, 3.0, 0.0, 5.0 98 , 0.0, 3.0, 0.0, 5.0
99 , 0.0, 0.0, 3.0, 6.0 ]@ 99 , 0.0, 0.0, 3.0, 6.0 ]@
100-} 100-}
101(<|>) :: (Field t, Joinable a b) => a t -> b t -> Matrix t 101(<|>) :: (Element t, Joinable a b) => a t -> b t -> Matrix t
102a <|> b = joinH a b 102a <|> b = joinH a b
103 103
104-- | Vertical concatenation of matrices and vectors. 104-- | Vertical concatenation of matrices and vectors.
105(<->) :: (Field t, Joinable a b) => a t -> b t -> Matrix t 105(<->) :: (Element t, Joinable a b) => a t -> b t -> Matrix t
106a <-> b = joinV a b 106a <-> b = joinV a b