summaryrefslogtreecommitdiff
path: root/lib/Numeric/LinearAlgebra/Interface.hs
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2010-05-11 09:07:52 +0000
committerAlberto Ruiz <aruiz@um.es>2010-05-11 09:07:52 +0000
commitaa8debb5ab389de7bc5b47c5ae5f038349b6efc1 (patch)
treeceb1ae6932ef0769616089fd05a7ba099b9a5b30 /lib/Numeric/LinearAlgebra/Interface.hs
parent0c1b8611b9cc55cc646c708b63442f3aaac1249d (diff)
simplify modules
Diffstat (limited to 'lib/Numeric/LinearAlgebra/Interface.hs')
-rw-r--r--lib/Numeric/LinearAlgebra/Interface.hs29
1 files changed, 17 insertions, 12 deletions
diff --git a/lib/Numeric/LinearAlgebra/Interface.hs b/lib/Numeric/LinearAlgebra/Interface.hs
index b74180f..750670b 100644
--- a/lib/Numeric/LinearAlgebra/Interface.hs
+++ b/lib/Numeric/LinearAlgebra/Interface.hs
@@ -9,7 +9,12 @@ Maintainer : Alberto Ruiz (aruiz at um dot es)
9Stability : provisional 9Stability : provisional
10Portability : portable 10Portability : portable
11 11
12(Very provisional) operators for frequent operations. 12Operators for frequent operations.
13
14This module exports Show, Read, Eq, Num, Fractional, and Floating instances for Vector and Matrix.
15
16In the context of the standard numeric operators, one-component vectors and matrices automatically expand to match the dimensions of the other operand.
17
13 18
14-} 19-}
15----------------------------------------------------------------------------- 20-----------------------------------------------------------------------------
@@ -21,14 +26,14 @@ module Numeric.LinearAlgebra.Interface(
21 (<|>),(<->), 26 (<|>),(<->),
22) where 27) where
23 28
24import Numeric.LinearAlgebra.Linear 29import Numeric.LinearAlgebra.Instances()
25import Data.Packed.Vector 30import Data.Packed.Vector
26import Data.Packed.Matrix 31import Data.Packed.Matrix
27import Numeric.LinearAlgebra.Algorithms 32import Numeric.LinearAlgebra.Algorithms
28 33
29class Mul a b c | a b -> c where 34class Mul a b c | a b -> c where
30 infixl 7 <> 35 infixl 7 <>
31 -- | matrix product 36 -- | Matrix-matrix, matrix-vector, and vector-matrix products.
32 (<>) :: Field t => a t -> b t -> c t 37 (<>) :: Field t => a t -> b t -> c t
33 38
34instance Mul Matrix Matrix Matrix where 39instance Mul Matrix Matrix Matrix where
@@ -42,7 +47,7 @@ instance Mul Vector Matrix Vector where
42 47
43--------------------------------------------------- 48---------------------------------------------------
44 49
45-- | @u \<.\> v = dot u v@ 50-- | Dot product: @u \<.\> v = dot u v@
46(<.>) :: (Field t) => Vector t -> Vector t -> t 51(<.>) :: (Field t) => Vector t -> Vector t -> t
47infixl 7 <.> 52infixl 7 <.>
48(<.>) = dot 53(<.>) = dot
@@ -51,8 +56,8 @@ infixl 7 <.>
51 56
52{-# DEPRECATED (.*) "use scale a x or scalar a * x" #-} 57{-# DEPRECATED (.*) "use scale a x or scalar a * x" #-}
53 58
54-- | @x .* a = scale x a@ 59-- -- | @x .* a = scale x a@
55(.*) :: (Linear c a) => a -> c a -> c a 60-- (.*) :: (Linear c a) => a -> c a -> c a
56infixl 7 .* 61infixl 7 .*
57a .* x = scale a x 62a .* x = scale a x
58 63
@@ -60,8 +65,8 @@ a .* x = scale a x
60 65
61{-# DEPRECATED (*/) "use scale (recip a) x or x / scalar a" #-} 66{-# DEPRECATED (*/) "use scale (recip a) x or x / scalar a" #-}
62 67
63-- | @a *\/ x = scale (recip x) a@ 68-- -- | @a *\/ x = scale (recip x) a@
64(*/) :: (Linear c a) => c a -> a -> c a 69-- (*/) :: (Linear c a) => c a -> a -> c a
65infixl 7 */ 70infixl 7 */
66v */ x = scale (recip x) v 71v */ x = scale (recip x) v
67 72
@@ -94,7 +99,7 @@ instance Joinable Vector Matrix where
94infixl 4 <|> 99infixl 4 <|>
95infixl 3 <-> 100infixl 3 <->
96 101
97{- | Horizontal concatenation of matrices and vectors: 102{-- - | Horizontal concatenation of matrices and vectors:
98 103
99@> (ident 3 \<-\> 3 * ident 3) \<|\> fromList [1..6.0] 104@> (ident 3 \<-\> 3 * ident 3) \<|\> fromList [1..6.0]
100(6><4) 105(6><4)
@@ -105,10 +110,10 @@ infixl 3 <->
105 , 0.0, 3.0, 0.0, 5.0 110 , 0.0, 3.0, 0.0, 5.0
106 , 0.0, 0.0, 3.0, 6.0 ]@ 111 , 0.0, 0.0, 3.0, 6.0 ]@
107-} 112-}
108(<|>) :: (Element t, Joinable a b) => a t -> b t -> Matrix t 113-- (<|>) :: (Element t, Joinable a b) => a t -> b t -> Matrix t
109a <|> b = joinH a b 114a <|> b = joinH a b
110 115
111-- | Vertical concatenation of matrices and vectors. 116-- -- | Vertical concatenation of matrices and vectors.
112(<->) :: (Element t, Joinable a b) => a t -> b t -> Matrix t 117-- (<->) :: (Element t, Joinable a b) => a t -> b t -> Matrix t
113a <-> b = joinV a b 118a <-> b = joinV a b
114 119