summaryrefslogtreecommitdiff
path: root/packages/base/src/Data/Packed/Internal
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2015-05-22 09:02:42 +0200
committerAlberto Ruiz <aruiz@um.es>2015-05-22 09:02:42 +0200
commit0c8a545e67ebef2b3a4e376fac8f23a651dfbe6d (patch)
treeaa34da915f597ccd8cf497834b156a76ea537684 /packages/base/src/Data/Packed/Internal
parentdd595ffe3fe6c710adba253696e455ffd98877c5 (diff)
initial CInt SContainer
Diffstat (limited to 'packages/base/src/Data/Packed/Internal')
-rw-r--r--packages/base/src/Data/Packed/Internal/Numeric.hs29
1 files changed, 29 insertions, 0 deletions
diff --git a/packages/base/src/Data/Packed/Internal/Numeric.hs b/packages/base/src/Data/Packed/Internal/Numeric.hs
index 7359433..9b6b55b 100644
--- a/packages/base/src/Data/Packed/Internal/Numeric.hs
+++ b/packages/base/src/Data/Packed/Internal/Numeric.hs
@@ -39,6 +39,7 @@ module Data.Packed.Internal.Numeric (
39 roundVector, 39 roundVector,
40 RealOf, ComplexOf, SingleOf, DoubleOf, 40 RealOf, ComplexOf, SingleOf, DoubleOf,
41 IndexOf, 41 IndexOf,
42 CInt,
42 module Data.Complex 43 module Data.Complex
43) where 44) where
44 45
@@ -51,6 +52,7 @@ import Data.Complex
51 52
52import Numeric.LinearAlgebra.LAPACK(multiplyR,multiplyC,multiplyF,multiplyQ) 53import Numeric.LinearAlgebra.LAPACK(multiplyR,multiplyC,multiplyF,multiplyQ)
53import Data.Packed.Internal 54import Data.Packed.Internal
55import Foreign.C.Types(CInt)
54 56
55------------------------------------------------------------------- 57-------------------------------------------------------------------
56 58
@@ -123,6 +125,33 @@ class (Complexable c, Fractional e, SContainer c e) => Container c e
123 125
124-------------------------------------------------------------------------- 126--------------------------------------------------------------------------
125 127
128instance SContainer Vector CInt
129 where
130 size' = dim
131-- scale' = vectorMapValF Scale
132-- addConstant = vectorMapValF AddConstant
133-- add = vectorZipF Add
134-- sub = vectorZipF Sub
135-- mul = vectorZipF Mul
136-- equal u v = dim u == dim v && maxElement (vectorMapF Abs (sub u v)) == 0.0
137 scalar' x = fromList [x]
138 konst' = constantD
139 build' = buildV
140 cmap' = mapVector
141 atIndex' = (@>)
142-- minIndex' = emptyErrorV "minIndex" (round . toScalarF MinIdx)
143-- maxIndex' = emptyErrorV "maxIndex" (round . toScalarF MaxIdx)
144-- minElement' = emptyErrorV "minElement" (toScalarF Min)
145-- maxElement' = emptyErrorV "maxElement" (toScalarF Max)
146-- sumElements' = sumF
147-- prodElements' = prodF
148-- step' = stepF
149 find' = findV
150 assoc' = assocV
151 accum' = accumV
152-- cond' = condV condI
153
154
126instance SContainer Vector Float 155instance SContainer Vector Float
127 where 156 where
128 size' = dim 157 size' = dim