summaryrefslogtreecommitdiff
path: root/lib/Numeric
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Numeric')
-rw-r--r--lib/Numeric/LinearAlgebra/Linear.hs28
1 files changed, 14 insertions, 14 deletions
diff --git a/lib/Numeric/LinearAlgebra/Linear.hs b/lib/Numeric/LinearAlgebra/Linear.hs
index aed6a2b..e817642 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 minIdx :: a e -> Int 37 vectorMinIndex :: a e -> Int
38 maxIdx :: a e -> Int 38 vectorMaxIndex :: 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 minIdx = round . toScalarF MinIdx 47 vectorMinIndex = round . toScalarF MinIdx
48 maxIdx = round . toScalarF MaxIdx 48 vectorMaxIndex = 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 minIdx = round . toScalarR MinIdx 57 vectorMinIndex = round . toScalarR MinIdx
58 maxIdx = round . toScalarR MaxIdx 58 vectorMaxIndex = 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 (@>) minIdx 65 vectorMin = ap (@>) vectorMinIndex
66 vectorMax = ap (@>) maxIdx 66 vectorMax = ap (@>) vectorMaxIndex
67 minIdx = minIdx . fst . fromComplex . (zipVector (*) `ap` mapVector conjugate) 67 vectorMinIndex = vectorMinIndex . fst . fromComplex . (zipVector (*) `ap` mapVector conjugate)
68 maxIdx = maxIdx . fst . fromComplex . (zipVector (*) `ap` mapVector conjugate) 68 vectorMaxIndex = vectorMaxIndex . 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 (@>) minIdx 75 vectorMin = ap (@>) vectorMinIndex
76 vectorMax = ap (@>) maxIdx 76 vectorMax = ap (@>) vectorMaxIndex
77 minIdx = minIdx . fst . fromComplex . (zipVector (*) `ap` mapVector conjugate) 77 vectorMinIndex = vectorMinIndex . fst . fromComplex . (zipVector (*) `ap` mapVector conjugate)
78 maxIdx = maxIdx . fst . fromComplex . (zipVector (*) `ap` mapVector conjugate) 78 vectorMaxIndex = vectorMaxIndex . fst . fromComplex . (zipVector (*) `ap` mapVector conjugate)
79 dot = dotC 79 dot = dotC
80 80
81---------------------------------------------------- 81----------------------------------------------------