diff options
author | Alberto Ruiz <aruiz@um.es> | 2007-11-12 10:01:39 +0000 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2007-11-12 10:01:39 +0000 |
commit | c41d21fefa04c66039a0b218daaa53c2577ef838 (patch) | |
tree | 3dd182457a89edbf52688fb43fdc8b2a130829e8 /lib/Numeric/LinearAlgebra/Linear.hs | |
parent | 9e6500bf8e925b363e74e01834f81dde0810f808 (diff) |
data structures simplification
Diffstat (limited to 'lib/Numeric/LinearAlgebra/Linear.hs')
-rw-r--r-- | lib/Numeric/LinearAlgebra/Linear.hs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Numeric/LinearAlgebra/Linear.hs b/lib/Numeric/LinearAlgebra/Linear.hs index 13d69ab..3403591 100644 --- a/lib/Numeric/LinearAlgebra/Linear.hs +++ b/lib/Numeric/LinearAlgebra/Linear.hs | |||
@@ -20,7 +20,7 @@ module Numeric.LinearAlgebra.Linear ( | |||
20 | ) where | 20 | ) where |
21 | 21 | ||
22 | 22 | ||
23 | import Data.Packed.Internal | 23 | import Data.Packed.Internal(multiply,at,partit) |
24 | import Data.Packed | 24 | import Data.Packed |
25 | import Numeric.GSL.Vector | 25 | import Numeric.GSL.Vector |
26 | import Complex | 26 | import Complex |
@@ -68,7 +68,7 @@ instance Linear Matrix Double where | |||
68 | sub = liftMatrix2 sub | 68 | sub = liftMatrix2 sub |
69 | mul = liftMatrix2 mul | 69 | mul = liftMatrix2 mul |
70 | divide = liftMatrix2 divide | 70 | divide = liftMatrix2 divide |
71 | equal a b = cols a == cols b && cdat a `equal` cdat b | 71 | equal a b = cols a == cols b && flatten a `equal` flatten b |
72 | 72 | ||
73 | 73 | ||
74 | instance Linear Matrix (Complex Double) where | 74 | instance Linear Matrix (Complex Double) where |
@@ -79,13 +79,13 @@ instance Linear Matrix (Complex Double) where | |||
79 | sub = liftMatrix2 sub | 79 | sub = liftMatrix2 sub |
80 | mul = liftMatrix2 mul | 80 | mul = liftMatrix2 mul |
81 | divide = liftMatrix2 divide | 81 | divide = liftMatrix2 divide |
82 | equal a b = cols a == cols b && cdat a `equal` cdat b | 82 | equal a b = cols a == cols b && flatten a `equal` flatten b |
83 | 83 | ||
84 | -------------------------------------------------- | 84 | -------------------------------------------------- |
85 | 85 | ||
86 | -- | euclidean inner product | 86 | -- | euclidean inner product |
87 | dot :: (Element t) => Vector t -> Vector t -> t | 87 | dot :: (Element t) => Vector t -> Vector t -> t |
88 | dot u v = dat (multiply r c) `at` 0 | 88 | dot u v = multiply r c @@> (0,0) |
89 | where r = asRow u | 89 | where r = asRow u |
90 | c = asColumn v | 90 | c = asColumn v |
91 | 91 | ||