summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Data/Packed/Vector.hs6
-rw-r--r--lib/Numeric/LinearAlgebra/Linear.hs28
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
31import Numeric.GSL.Vector 31import Numeric.GSL.Vector
32-- import Data.Packed.ST 32-- import Data.Packed.ST
33 33
34
34import Data.Binary 35import Data.Binary
35import Foreign.Storable 36import Foreign.Storable
36import Control.Monad(replicateM) 37import Control.Monad(replicateM)
@@ -101,13 +102,16 @@ vectorMax = toScalarR Max
101 102
102vectorMin :: Vector Double -> Double 103vectorMin :: Vector Double -> Double
103vectorMin = toScalarR Min 104vectorMin = toScalarR Min
105-}
104 106
107{-# DEPRECATED vectorMaxIndex "use minIdx" #-}
105vectorMaxIndex :: Vector Double -> Int 108vectorMaxIndex :: Vector Double -> Int
106vectorMaxIndex = round . toScalarR MaxIdx 109vectorMaxIndex = round . toScalarR MaxIdx
107 110
111{-# DEPRECATED vectorMinIndex "use maxIdx" #-}
108vectorMinIndex :: Vector Double -> Int 112vectorMinIndex :: Vector Double -> Int
109vectorMinIndex = round . toScalarR MinIdx 113vectorMinIndex = 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
41instance Vectors Vector Float where 41instance 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
51instance Vectors Vector Double where 51instance 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
61instance Vectors Vector (Complex Float) where 61instance 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
71instance Vectors Vector (Complex Double) where 71instance 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----------------------------------------------------