From 102d6b19beadd76b28d32e1aa40844fad19af756 Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Mon, 18 Jan 2010 09:51:31 +0000 Subject: deprecate .* and */ --- lib/Data/Packed/Random.hs | 3 ++- lib/Numeric/LinearAlgebra/Interface.hs | 4 ++++ lib/Numeric/LinearAlgebra/Tests.hs | 6 +++--- lib/Numeric/LinearAlgebra/Tests/Instances.hs | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/Data/Packed/Random.hs b/lib/Data/Packed/Random.hs index a6145be..fea3cdd 100644 --- a/lib/Data/Packed/Random.hs +++ b/lib/Data/Packed/Random.hs @@ -21,6 +21,7 @@ module Data.Packed.Random ( import Numeric.GSL.Vector import Data.Packed +import Numeric.LinearAlgebra.Linear import Numeric.LinearAlgebra.Algorithms import Numeric.LinearAlgebra.Instances() import Numeric.LinearAlgebra.Interface @@ -54,7 +55,7 @@ uniformSample seed n rgs = m where d = dim a dat = toRows $ reshape n $ randomVector seed Uniform (n*d) am = constant 1 n `outer` a - m = fromColumns (zipWith (.*) cs dat) + am + m = fromColumns (zipWith scale cs dat) + am ------------ utilities ------------------------------- diff --git a/lib/Numeric/LinearAlgebra/Interface.hs b/lib/Numeric/LinearAlgebra/Interface.hs index 0ae9698..509b91c 100644 --- a/lib/Numeric/LinearAlgebra/Interface.hs +++ b/lib/Numeric/LinearAlgebra/Interface.hs @@ -49,6 +49,8 @@ infixl 7 <.> ---------------------------------------------------- +{-# DEPRECATED (.*) "use scale a x or scalar a * x" #-} + -- | @x .* a = scale x a@ (.*) :: (Linear c a) => a -> c a -> c a infixl 7 .* @@ -56,6 +58,8 @@ a .* x = scale a x ---------------------------------------------------- +{-# DEPRECATED (*/) "use scale (recip a) x or x / scalar a" #-} + -- | @a *\/ x = scale (recip x) a@ (*/) :: (Linear c a) => c a -> a -> c a infixl 7 */ diff --git a/lib/Numeric/LinearAlgebra/Tests.hs b/lib/Numeric/LinearAlgebra/Tests.hs index 063ae86..c1dae4a 100644 --- a/lib/Numeric/LinearAlgebra/Tests.hs +++ b/lib/Numeric/LinearAlgebra/Tests.hs @@ -262,8 +262,8 @@ runTests n = do , utest "expm1" (expmTest1) , utest "expm2" (expmTest2) , utest "arith1" $ ((ones (100,100) * 5 + 2)/0.5 - 7)**2 |~| (49 :: RM) - , utest "arith2" $ (((1+i) .* ones (100,100) * 5 + 2)/0.5 - 7)**2 |~| ( (140*i-51).*1 :: CM) - , utest "arith3" $ exp (i.*ones(10,10)*pi) + 1 |~| 0 + , utest "arith2" $ ((scalar (1+i) * ones (100,100) * 5 + 2)/0.5 - 7)**2 |~| ( scalar (140*i-51) :: CM) + , utest "arith3" $ exp (scalar i * ones(10,10)*pi) + 1 |~| 0 , utest "<\\>" $ (3><2) [2,0,0,3,1,1::Double] <\> 3|>[4,9,5] |~| 2|>[2,3] , utest "gamma" (gamma 5 == 24.0) , besselTest @@ -282,7 +282,7 @@ runTests n = do ] return () -makeUnitary v | realPart n > 1 = v */ n +makeUnitary v | realPart n > 1 = v / scalar n | otherwise = v where n = sqrt (conj v <.> v) diff --git a/lib/Numeric/LinearAlgebra/Tests/Instances.hs b/lib/Numeric/LinearAlgebra/Tests/Instances.hs index 4995e39..d0adfba 100644 --- a/lib/Numeric/LinearAlgebra/Tests/Instances.hs +++ b/lib/Numeric/LinearAlgebra/Tests/Instances.hs @@ -180,7 +180,7 @@ instance (Field a, Arbitrary a, Num (Vector a)) => Arbitrary (PosDef a) where l <- replicateM n (choose (0,100)) let s = diag (fromList l) p = v <> real s <> ctrans v - return $ PosDef (0.5 .* p + 0.5 .* ctrans p) + return $ PosDef (0.5 * p + 0.5 * ctrans p) #if MIN_VERSION_QuickCheck(2,0,0) #else -- cgit v1.2.3