summaryrefslogtreecommitdiff
path: root/lib/Numeric
diff options
context:
space:
mode:
authorKhudyakov Alexey <alexey.skladnoy@gmail.com>2010-09-29 12:35:11 +0000
committerKhudyakov Alexey <alexey.skladnoy@gmail.com>2010-09-29 12:35:11 +0000
commit49df400d892d4f51cbe724f5677aec70753b0408 (patch)
treea49eaa7f4bb6301c4225aab8ec25718bc4870634 /lib/Numeric
parenta3d3e0bd63a1c8215d4138195d128201ffa424e8 (diff)
[hlint] Remove redundant brackets and $'s
Diffstat (limited to 'lib/Numeric')
-rw-r--r--lib/Numeric/Chain.hs14
-rw-r--r--lib/Numeric/Container.hs4
-rw-r--r--lib/Numeric/LinearAlgebra/Algorithms.hs5
-rw-r--r--lib/Numeric/LinearAlgebra/Tests/Instances.hs2
4 files changed, 12 insertions, 13 deletions
diff --git a/lib/Numeric/Chain.hs b/lib/Numeric/Chain.hs
index 03ca88d..e1ab7da 100644
--- a/lib/Numeric/Chain.hs
+++ b/lib/Numeric/Chain.hs
@@ -98,11 +98,11 @@ minimum_cost :: (Sizes,Cost,Indexes) -> (Int,Int) -> (Sizes,Cost,Indexes)
98minimum_cost sci fu = foldl (smaller_cost fu) sci (fulcrum_order fu) 98minimum_cost sci fu = foldl (smaller_cost fu) sci (fulcrum_order fu)
99 99
100smaller_cost :: (Int,Int) -> (Sizes,Cost,Indexes) -> ((Int,Int),(Int,Int)) -> (Sizes,Cost,Indexes) 100smaller_cost :: (Int,Int) -> (Sizes,Cost,Indexes) -> ((Int,Int),(Int,Int)) -> (Sizes,Cost,Indexes)
101smaller_cost (r,c) (mz,cost,ixes) ix@((lr,lc),(rr,rc)) = let op_cost = (fromJust ((cost A.! lr) A.! lc)) 101smaller_cost (r,c) (mz,cost,ixes) ix@((lr,lc),(rr,rc)) = let op_cost = fromJust ((cost A.! lr) A.! lc)
102 + (fromJust ((cost A.! rr) A.! rc)) 102 + fromJust ((cost A.! rr) A.! rc)
103 + ((fst $ mz A.! (lr-lc+1)) 103 + fst (mz A.! (lr-lc+1))
104 *(snd $ mz A.! lc) 104 * snd (mz A.! lc)
105 *(snd $ mz A.! rr)) 105 * snd (mz A.! rr)
106 cost' = (cost A.! r) A.! c 106 cost' = (cost A.! r) A.! c
107 in case cost' of 107 in case cost' of
108 Nothing -> let cost'' = update cost (r,c) (Just op_cost) 108 Nothing -> let cost'' = update cost (r,c) (Just op_cost)
@@ -118,10 +118,10 @@ smaller_cost (r,c) (mz,cost,ixes) ix@((lr,lc),(rr,rc)) = let op_cost = (fromJust
118fulcrum_order (r,c) = let fs' = zip (repeat r) [1..(c-1)] 118fulcrum_order (r,c) = let fs' = zip (repeat r) [1..(c-1)]
119 in map (partner (r,c)) fs' 119 in map (partner (r,c)) fs'
120 120
121partner (r,c) (a,b) = (((r-b),(c-b)),(a,b)) 121partner (r,c) (a,b) = ((r-b, c-b), (a,b))
122 122
123order 0 = [] 123order 0 = []
124order n = (order (n-1)) ++ (zip (repeat n) [1..n]) 124order n = order (n-1) ++ zip (repeat n) [1..n]
125 125
126chain_paren :: Product a => (Int,Int) -> Indexes -> Matrices a -> Matrix a 126chain_paren :: Product a => (Int,Int) -> Indexes -> Matrices a -> Matrix a
127chain_paren (r,c) ixes ma = let ((lr,lc),(rr,rc)) = fromJust $ (ixes A.! r) A.! c 127chain_paren (r,c) ixes ma = let ((lr,lc),(rr,rc)) = fromJust $ (ixes A.! r) A.! c
diff --git a/lib/Numeric/Container.hs b/lib/Numeric/Container.hs
index 45b33e0..621574e 100644
--- a/lib/Numeric/Container.hs
+++ b/lib/Numeric/Container.hs
@@ -117,10 +117,10 @@ instance Mul Matrix Matrix Matrix where
117 (<>) = mXm 117 (<>) = mXm
118 118
119instance Mul Matrix Vector Vector where 119instance Mul Matrix Vector Vector where
120 (<>) m v = flatten $ m <> (asColumn v) 120 (<>) m v = flatten $ m <> asColumn v
121 121
122instance Mul Vector Matrix Vector where 122instance Mul Vector Matrix Vector where
123 (<>) v m = flatten $ (asRow v) <> m 123 (<>) v m = flatten $ asRow v <> m
124 124
125-------------------------------------------------------- 125--------------------------------------------------------
126 126
diff --git a/lib/Numeric/LinearAlgebra/Algorithms.hs b/lib/Numeric/LinearAlgebra/Algorithms.hs
index f4f8bca..dd93db2 100644
--- a/lib/Numeric/LinearAlgebra/Algorithms.hs
+++ b/lib/Numeric/LinearAlgebra/Algorithms.hs
@@ -392,7 +392,7 @@ eps = 2.22044604925031e-16
392 392
393-- | 1 + 0.5*peps == 1, 1 + 0.6*peps /= 1 393-- | 1 + 0.5*peps == 1, 1 + 0.6*peps /= 1
394peps :: RealFloat x => x 394peps :: RealFloat x => x
395peps = x where x = 2.0**(fromIntegral $ 1-floatDigits x) 395peps = x where x = 2.0 ** fromIntegral (1 - floatDigits x)
396 396
397 397
398-- | The imaginary unit: @i = 0.0 :+ 1.0@ 398-- | The imaginary unit: @i = 0.0 :+ 1.0@
@@ -553,8 +553,7 @@ epslist = [ (fromIntegral k, golubeps k k) | k <- [1..]]
553geps delta = head [ k | (k,g) <- epslist, g<delta] 553geps delta = head [ k | (k,g) <- epslist, g<delta]
554 554
555expGolub m = iterate msq f !! j 555expGolub m = iterate msq f !! j
556 where j = max 0 $ floor $ log2 $ pnorm Infinity m 556 where j = max 0 $ floor $ logBase 2 $ pnorm Infinity m
557 log2 x = log x / log 2
558 a = m */ fromIntegral ((2::Int)^j) 557 a = m */ fromIntegral ((2::Int)^j)
559 q = geps eps -- 7 steps 558 q = geps eps -- 7 steps
560 eye = ident (rows m) 559 eye = ident (rows m)
diff --git a/lib/Numeric/LinearAlgebra/Tests/Instances.hs b/lib/Numeric/LinearAlgebra/Tests/Instances.hs
index 771739a..6dd9cfe 100644
--- a/lib/Numeric/LinearAlgebra/Tests/Instances.hs
+++ b/lib/Numeric/LinearAlgebra/Tests/Instances.hs
@@ -84,7 +84,7 @@ instance (Element a, Arbitrary a) => Arbitrary (Matrix a) where
84 84
85#if MIN_VERSION_QuickCheck(2,0,0) 85#if MIN_VERSION_QuickCheck(2,0,0)
86 -- shrink any one of the components 86 -- shrink any one of the components
87 shrink a = map ((rows a) >< (cols a)) 87 shrink a = map (rows a >< cols a)
88 . shrinkListElementwise 88 . shrinkListElementwise
89 . concat . toLists 89 . concat . toLists
90 $ a 90 $ a