summaryrefslogtreecommitdiff
path: root/lib/Numeric/LinearAlgebra
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Numeric/LinearAlgebra')
-rw-r--r--lib/Numeric/LinearAlgebra/Algorithms.hs1
-rw-r--r--lib/Numeric/LinearAlgebra/Interface.hs29
-rw-r--r--lib/Numeric/LinearAlgebra/Linear.hs2
3 files changed, 19 insertions, 13 deletions
diff --git a/lib/Numeric/LinearAlgebra/Algorithms.hs b/lib/Numeric/LinearAlgebra/Algorithms.hs
index fc2fcb2..7de9587 100644
--- a/lib/Numeric/LinearAlgebra/Algorithms.hs
+++ b/lib/Numeric/LinearAlgebra/Algorithms.hs
@@ -66,6 +66,7 @@ module Numeric.LinearAlgebra.Algorithms (
66-- * Misc 66-- * Misc
67 ctrans, 67 ctrans,
68 eps, i, 68 eps, i,
69 Linear(..),
69-- * Util 70-- * Util
70 haussholder, 71 haussholder,
71 unpackQR, unpackHess, 72 unpackQR, unpackHess,
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
diff --git a/lib/Numeric/LinearAlgebra/Linear.hs b/lib/Numeric/LinearAlgebra/Linear.hs
index 7e23745..2568410 100644
--- a/lib/Numeric/LinearAlgebra/Linear.hs
+++ b/lib/Numeric/LinearAlgebra/Linear.hs
@@ -21,7 +21,7 @@ module Numeric.LinearAlgebra.Linear (
21import Data.Packed 21import Data.Packed
22import Numeric.GSL.Vector 22import Numeric.GSL.Vector
23 23
24-- | A generic interface for vectors and matrices to a few element-by-element functions in Numeric.GSL.Vector. 24-- | Basic element-by-element functions.
25class (Container c e) => Linear c e where 25class (Container c e) => Linear c e where
26 -- | create a structure with a single element 26 -- | create a structure with a single element
27 scalar :: e -> c e 27 scalar :: e -> c e