diff options
author | Vivian McPhail <haskell.vivian.mcphail@gmail.com> | 2010-07-07 09:30:56 +0000 |
---|---|---|
committer | Vivian McPhail <haskell.vivian.mcphail@gmail.com> | 2010-07-07 09:30:56 +0000 |
commit | 9eba8eaa9bd25377f10fd5a62cc6f8771824a0cf (patch) | |
tree | 1007ebe02dd51a7e97fe91fd50e4a0f99493f364 | |
parent | 0bcf8cb0860177376cdb04e54761432ccbe63bda (diff) |
rerename minIdx/maxIdx and deprecate vectorMinIdx
-rw-r--r-- | lib/Data/Packed/Vector.hs | 6 | ||||
-rw-r--r-- | lib/Numeric/LinearAlgebra/Linear.hs | 28 |
2 files changed, 19 insertions, 15 deletions
diff --git a/lib/Data/Packed/Vector.hs b/lib/Data/Packed/Vector.hs index 62fc8af..bb89506 100644 --- a/lib/Data/Packed/Vector.hs +++ b/lib/Data/Packed/Vector.hs | |||
@@ -31,6 +31,7 @@ import Data.Packed.Internal | |||
31 | import Numeric.GSL.Vector | 31 | import Numeric.GSL.Vector |
32 | -- import Data.Packed.ST | 32 | -- import Data.Packed.ST |
33 | 33 | ||
34 | |||
34 | import Data.Binary | 35 | import Data.Binary |
35 | import Foreign.Storable | 36 | import Foreign.Storable |
36 | import Control.Monad(replicateM) | 37 | import Control.Monad(replicateM) |
@@ -101,13 +102,16 @@ vectorMax = toScalarR Max | |||
101 | 102 | ||
102 | vectorMin :: Vector Double -> Double | 103 | vectorMin :: Vector Double -> Double |
103 | vectorMin = toScalarR Min | 104 | vectorMin = toScalarR Min |
105 | -} | ||
104 | 106 | ||
107 | {-# DEPRECATED vectorMaxIndex "use minIdx" #-} | ||
105 | vectorMaxIndex :: Vector Double -> Int | 108 | vectorMaxIndex :: Vector Double -> Int |
106 | vectorMaxIndex = round . toScalarR MaxIdx | 109 | vectorMaxIndex = round . toScalarR MaxIdx |
107 | 110 | ||
111 | {-# DEPRECATED vectorMinIndex "use maxIdx" #-} | ||
108 | vectorMinIndex :: Vector Double -> Int | 112 | vectorMinIndex :: Vector Double -> Int |
109 | vectorMinIndex = round . toScalarR MinIdx | 113 | vectorMinIndex = round . toScalarR MinIdx |
110 | -} | 114 | |
111 | 115 | ||
112 | {- | creates a vector with a given number of equal components: | 116 | {- | creates a vector with a given number of equal components: |
113 | 117 | ||
diff --git a/lib/Numeric/LinearAlgebra/Linear.hs b/lib/Numeric/LinearAlgebra/Linear.hs index e817642..aed6a2b 100644 --- a/lib/Numeric/LinearAlgebra/Linear.hs +++ b/lib/Numeric/LinearAlgebra/Linear.hs | |||
@@ -34,8 +34,8 @@ class Num e => Vectors a e where | |||
34 | absSum :: a e -> e | 34 | absSum :: a e -> e |
35 | vectorMin :: a e -> e | 35 | vectorMin :: a e -> e |
36 | vectorMax :: a e -> e | 36 | vectorMax :: a e -> e |
37 | vectorMinIndex :: a e -> Int | 37 | minIdx :: a e -> Int |
38 | vectorMaxIndex :: a e -> Int | 38 | maxIdx :: a e -> Int |
39 | dot :: a e -> a e -> e | 39 | dot :: a e -> a e -> e |
40 | 40 | ||
41 | instance Vectors Vector Float where | 41 | instance Vectors Vector Float where |
@@ -44,8 +44,8 @@ instance Vectors Vector Float where | |||
44 | absSum = toScalarF AbsSum | 44 | absSum = toScalarF AbsSum |
45 | vectorMin = toScalarF Min | 45 | vectorMin = toScalarF Min |
46 | vectorMax = toScalarF Max | 46 | vectorMax = toScalarF Max |
47 | vectorMinIndex = round . toScalarF MinIdx | 47 | minIdx = round . toScalarF MinIdx |
48 | vectorMaxIndex = round . toScalarF MaxIdx | 48 | maxIdx = round . toScalarF MaxIdx |
49 | dot = dotF | 49 | dot = dotF |
50 | 50 | ||
51 | instance Vectors Vector Double where | 51 | instance Vectors Vector Double where |
@@ -54,28 +54,28 @@ instance Vectors Vector Double where | |||
54 | absSum = toScalarR AbsSum | 54 | absSum = toScalarR AbsSum |
55 | vectorMin = toScalarR Min | 55 | vectorMin = toScalarR Min |
56 | vectorMax = toScalarR Max | 56 | vectorMax = toScalarR Max |
57 | vectorMinIndex = round . toScalarR MinIdx | 57 | minIdx = round . toScalarR MinIdx |
58 | vectorMaxIndex = round . toScalarR MaxIdx | 58 | maxIdx = round . toScalarR MaxIdx |
59 | dot = dotR | 59 | dot = dotR |
60 | 60 | ||
61 | instance Vectors Vector (Complex Float) where | 61 | instance Vectors Vector (Complex Float) where |
62 | vectorSum = sumQ | 62 | vectorSum = sumQ |
63 | euclidean = (:+ 0) . toScalarQ Norm2 | 63 | euclidean = (:+ 0) . toScalarQ Norm2 |
64 | absSum = (:+ 0) . toScalarQ AbsSum | 64 | absSum = (:+ 0) . toScalarQ AbsSum |
65 | vectorMin = ap (@>) vectorMinIndex | 65 | vectorMin = ap (@>) minIdx |
66 | vectorMax = ap (@>) vectorMaxIndex | 66 | vectorMax = ap (@>) maxIdx |
67 | vectorMinIndex = vectorMinIndex . fst . fromComplex . (zipVector (*) `ap` mapVector conjugate) | 67 | minIdx = minIdx . fst . fromComplex . (zipVector (*) `ap` mapVector conjugate) |
68 | vectorMaxIndex = vectorMaxIndex . fst . fromComplex . (zipVector (*) `ap` mapVector conjugate) | 68 | maxIdx = maxIdx . fst . fromComplex . (zipVector (*) `ap` mapVector conjugate) |
69 | dot = dotQ | 69 | dot = dotQ |
70 | 70 | ||
71 | instance Vectors Vector (Complex Double) where | 71 | instance Vectors Vector (Complex Double) where |
72 | vectorSum = sumC | 72 | vectorSum = sumC |
73 | euclidean = (:+ 0) . toScalarC Norm2 | 73 | euclidean = (:+ 0) . toScalarC Norm2 |
74 | absSum = (:+ 0) . toScalarC AbsSum | 74 | absSum = (:+ 0) . toScalarC AbsSum |
75 | vectorMin = ap (@>) vectorMinIndex | 75 | vectorMin = ap (@>) minIdx |
76 | vectorMax = ap (@>) vectorMaxIndex | 76 | vectorMax = ap (@>) maxIdx |
77 | vectorMinIndex = vectorMinIndex . fst . fromComplex . (zipVector (*) `ap` mapVector conjugate) | 77 | minIdx = minIdx . fst . fromComplex . (zipVector (*) `ap` mapVector conjugate) |
78 | vectorMaxIndex = vectorMaxIndex . fst . fromComplex . (zipVector (*) `ap` mapVector conjugate) | 78 | maxIdx = maxIdx . fst . fromComplex . (zipVector (*) `ap` mapVector conjugate) |
79 | dot = dotC | 79 | dot = dotC |
80 | 80 | ||
81 | ---------------------------------------------------- | 81 | ---------------------------------------------------- |