From 5b6de561f131d75049fdb999e98a07939ec2e8e7 Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Sat, 24 May 2014 13:32:58 +0200 Subject: backward compatibility --- packages/base/src/Numeric/LinearAlgebra/Util/CG.hs | 2 +- .../base/src/Numeric/LinearAlgebra/Util/Convolution.hs | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) (limited to 'packages/base/src/Numeric/LinearAlgebra/Util') diff --git a/packages/base/src/Numeric/LinearAlgebra/Util/CG.hs b/packages/base/src/Numeric/LinearAlgebra/Util/CG.hs index d21602d..5e2ea84 100644 --- a/packages/base/src/Numeric/LinearAlgebra/Util/CG.hs +++ b/packages/base/src/Numeric/LinearAlgebra/Util/CG.hs @@ -6,7 +6,7 @@ module Numeric.LinearAlgebra.Util.CG( CGMat, CGState(..), R, V ) where -import Numeric.Container +import Data.Packed.Numeric import Numeric.Vector() {- diff --git a/packages/base/src/Numeric/LinearAlgebra/Util/Convolution.hs b/packages/base/src/Numeric/LinearAlgebra/Util/Convolution.hs index e4cba8f..c8c7536 100644 --- a/packages/base/src/Numeric/LinearAlgebra/Util/Convolution.hs +++ b/packages/base/src/Numeric/LinearAlgebra/Util/Convolution.hs @@ -16,16 +16,18 @@ module Numeric.LinearAlgebra.Util.Convolution( corr2, conv2, separable ) where -import Numeric.Container +import Data.Packed.Numeric vectSS :: Element t => Int -> Vector t -> Matrix t vectSS n v = fromRows [ subVector k n v | k <- [0 .. dim v - n] ] -corr :: Product t => Vector t -- ^ kernel - -> Vector t -- ^ source - -> Vector t +corr + :: (Container Vector t, Product t) + => Vector t -- ^ kernel + -> Vector t -- ^ source + -> Vector t {- ^ correlation >>> corr (fromList[1,2,3]) (fromList [1..10]) @@ -33,12 +35,12 @@ fromList [14.0,20.0,26.0,32.0,38.0,44.0,50.0,56.0] -} corr ker v - | dim ker == 0 = constant 0 (dim v) + | dim ker == 0 = konst 0 (dim v) | dim ker <= dim v = vectSS (dim ker) v <> ker | otherwise = error $ "corr: dim kernel ("++show (dim ker)++") > dim vector ("++show (dim v)++")" -conv :: (Product t, Num t) => Vector t -> Vector t -> Vector t +conv :: (Container Vector t, Product t, Num t) => Vector t -> Vector t -> Vector t {- ^ convolution ('corr' with reversed kernel and padded input, equivalent to polynomial product) >>> conv (fromList[1,1]) (fromList [-1,1]) @@ -46,12 +48,12 @@ fromList [-1.0,0.0,1.0] -} conv ker v - | dim ker == 0 = constant 0 (dim v) + | dim ker == 0 = konst 0 (dim v) | otherwise = corr ker' v' where ker' = (flatten.fliprl.asRow) ker v' = vjoin [z,v,z] - z = constant 0 (dim ker -1) + z = konst 0 (dim ker -1) corrMin :: (Container Vector t, RealElement t, Product t) => Vector t -- cgit v1.2.3