diff options
author | Alberto Ruiz <aruiz@um.es> | 2010-01-18 09:51:31 +0000 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2010-01-18 09:51:31 +0000 |
commit | 102d6b19beadd76b28d32e1aa40844fad19af756 (patch) | |
tree | 1b7736d5d392b0ef43e2e119fc2d1d1a91cd5831 /lib | |
parent | 830164c7c34d874aa66754206be956f85456842f (diff) |
deprecate .* and */
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Data/Packed/Random.hs | 3 | ||||
-rw-r--r-- | lib/Numeric/LinearAlgebra/Interface.hs | 4 | ||||
-rw-r--r-- | lib/Numeric/LinearAlgebra/Tests.hs | 6 | ||||
-rw-r--r-- | lib/Numeric/LinearAlgebra/Tests/Instances.hs | 2 |
4 files changed, 10 insertions, 5 deletions
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 ( | |||
21 | 21 | ||
22 | import Numeric.GSL.Vector | 22 | import Numeric.GSL.Vector |
23 | import Data.Packed | 23 | import Data.Packed |
24 | import Numeric.LinearAlgebra.Linear | ||
24 | import Numeric.LinearAlgebra.Algorithms | 25 | import Numeric.LinearAlgebra.Algorithms |
25 | import Numeric.LinearAlgebra.Instances() | 26 | import Numeric.LinearAlgebra.Instances() |
26 | import Numeric.LinearAlgebra.Interface | 27 | import Numeric.LinearAlgebra.Interface |
@@ -54,7 +55,7 @@ uniformSample seed n rgs = m where | |||
54 | d = dim a | 55 | d = dim a |
55 | dat = toRows $ reshape n $ randomVector seed Uniform (n*d) | 56 | dat = toRows $ reshape n $ randomVector seed Uniform (n*d) |
56 | am = constant 1 n `outer` a | 57 | am = constant 1 n `outer` a |
57 | m = fromColumns (zipWith (.*) cs dat) + am | 58 | m = fromColumns (zipWith scale cs dat) + am |
58 | 59 | ||
59 | ------------ utilities ------------------------------- | 60 | ------------ utilities ------------------------------- |
60 | 61 | ||
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 <.> | |||
49 | 49 | ||
50 | ---------------------------------------------------- | 50 | ---------------------------------------------------- |
51 | 51 | ||
52 | {-# DEPRECATED (.*) "use scale a x or scalar a * x" #-} | ||
53 | |||
52 | -- | @x .* a = scale x a@ | 54 | -- | @x .* a = scale x a@ |
53 | (.*) :: (Linear c a) => a -> c a -> c a | 55 | (.*) :: (Linear c a) => a -> c a -> c a |
54 | infixl 7 .* | 56 | infixl 7 .* |
@@ -56,6 +58,8 @@ a .* x = scale a x | |||
56 | 58 | ||
57 | ---------------------------------------------------- | 59 | ---------------------------------------------------- |
58 | 60 | ||
61 | {-# DEPRECATED (*/) "use scale (recip a) x or x / scalar a" #-} | ||
62 | |||
59 | -- | @a *\/ x = scale (recip x) a@ | 63 | -- | @a *\/ x = scale (recip x) a@ |
60 | (*/) :: (Linear c a) => c a -> a -> c a | 64 | (*/) :: (Linear c a) => c a -> a -> c a |
61 | infixl 7 */ | 65 | 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 | |||
262 | , utest "expm1" (expmTest1) | 262 | , utest "expm1" (expmTest1) |
263 | , utest "expm2" (expmTest2) | 263 | , utest "expm2" (expmTest2) |
264 | , utest "arith1" $ ((ones (100,100) * 5 + 2)/0.5 - 7)**2 |~| (49 :: RM) | 264 | , utest "arith1" $ ((ones (100,100) * 5 + 2)/0.5 - 7)**2 |~| (49 :: RM) |
265 | , utest "arith2" $ (((1+i) .* ones (100,100) * 5 + 2)/0.5 - 7)**2 |~| ( (140*i-51).*1 :: CM) | 265 | , utest "arith2" $ ((scalar (1+i) * ones (100,100) * 5 + 2)/0.5 - 7)**2 |~| ( scalar (140*i-51) :: CM) |
266 | , utest "arith3" $ exp (i.*ones(10,10)*pi) + 1 |~| 0 | 266 | , utest "arith3" $ exp (scalar i * ones(10,10)*pi) + 1 |~| 0 |
267 | , utest "<\\>" $ (3><2) [2,0,0,3,1,1::Double] <\> 3|>[4,9,5] |~| 2|>[2,3] | 267 | , utest "<\\>" $ (3><2) [2,0,0,3,1,1::Double] <\> 3|>[4,9,5] |~| 2|>[2,3] |
268 | , utest "gamma" (gamma 5 == 24.0) | 268 | , utest "gamma" (gamma 5 == 24.0) |
269 | , besselTest | 269 | , besselTest |
@@ -282,7 +282,7 @@ runTests n = do | |||
282 | ] | 282 | ] |
283 | return () | 283 | return () |
284 | 284 | ||
285 | makeUnitary v | realPart n > 1 = v */ n | 285 | makeUnitary v | realPart n > 1 = v / scalar n |
286 | | otherwise = v | 286 | | otherwise = v |
287 | where n = sqrt (conj v <.> v) | 287 | where n = sqrt (conj v <.> v) |
288 | 288 | ||
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 | |||
180 | l <- replicateM n (choose (0,100)) | 180 | l <- replicateM n (choose (0,100)) |
181 | let s = diag (fromList l) | 181 | let s = diag (fromList l) |
182 | p = v <> real s <> ctrans v | 182 | p = v <> real s <> ctrans v |
183 | return $ PosDef (0.5 .* p + 0.5 .* ctrans p) | 183 | return $ PosDef (0.5 * p + 0.5 * ctrans p) |
184 | 184 | ||
185 | #if MIN_VERSION_QuickCheck(2,0,0) | 185 | #if MIN_VERSION_QuickCheck(2,0,0) |
186 | #else | 186 | #else |