summaryrefslogtreecommitdiff
path: root/lib/Numeric/LinearAlgebra
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2010-09-11 11:10:33 +0000
committerAlberto Ruiz <aruiz@um.es>2010-09-11 11:10:33 +0000
commit6859c5712a85950b5bc3de3fe8352f4592bc273b (patch)
treede9008ebc9c25792237b4df5a4aa8e60057cf55a /lib/Numeric/LinearAlgebra
parent84a5ee4fb1b2185eabf64b761279b4da313bd207 (diff)
added generic konst
Diffstat (limited to 'lib/Numeric/LinearAlgebra')
-rw-r--r--lib/Numeric/LinearAlgebra/Algorithms.hs8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/Numeric/LinearAlgebra/Algorithms.hs b/lib/Numeric/LinearAlgebra/Algorithms.hs
index 6e703fa..5bc9ca5 100644
--- a/lib/Numeric/LinearAlgebra/Algorithms.hs
+++ b/lib/Numeric/LinearAlgebra/Algorithms.hs
@@ -83,8 +83,6 @@ import Data.List(foldl1')
83import Data.Array 83import Data.Array
84import Numeric.Container 84import Numeric.Container
85 85
86constant x = constantD x
87
88-- | Auxiliary typeclass used to define generic computations for both real and complex matrices. 86-- | Auxiliary typeclass used to define generic computations for both real and complex matrices.
89class (Product t, Container Vector t, Container Matrix t) => Field t where 87class (Product t, Container Vector t, Container Matrix t) => Field t where
90 svd' :: Matrix t -> (Matrix t, Vector Double, Matrix t) 88 svd' :: Matrix t -> (Matrix t, Vector Double, Matrix t)
@@ -469,7 +467,7 @@ zh k v = fromList $ replicate (k-1) 0 ++ (1:drop k xs)
469 where xs = toList v 467 where xs = toList v
470 468
471zt 0 v = v 469zt 0 v = v
472zt k v = join [subVector 0 (dim v - k) v, constant 0 k] 470zt k v = join [subVector 0 (dim v - k) v, konst 0 k]
473 471
474 472
475unpackQR :: (Field t) => (Matrix t, Vector t) -> (Matrix t, Matrix t) 473unpackQR :: (Field t) => (Matrix t, Vector t) -> (Matrix t, Matrix t)
@@ -623,10 +621,10 @@ luFact (l_u,perm) | r <= c = (l ,u ,p, s)
623 c = cols l_u 621 c = cols l_u
624 tu = triang r c 0 1 622 tu = triang r c 0 1
625 tl = triang r c 0 0 623 tl = triang r c 0 0
626 l = takeColumns r (l_u |*| tl) |+| diagRect (constant 1 r) r r 624 l = takeColumns r (l_u |*| tl) |+| diagRect (konst 1 r) r r
627 u = l_u |*| tu 625 u = l_u |*| tu
628 (p,s) = fixPerm r perm 626 (p,s) = fixPerm r perm
629 l' = (l_u |*| tl) |+| diagRect (constant 1 c) r c 627 l' = (l_u |*| tl) |+| diagRect (konst 1 c) r c
630 u' = takeRows c (l_u |*| tu) 628 u' = takeRows c (l_u |*| tu)
631 (|+|) = add 629 (|+|) = add
632 (|*|) = mul 630 (|*|) = mul