summaryrefslogtreecommitdiff
path: root/packages/base/src
diff options
context:
space:
mode:
Diffstat (limited to 'packages/base/src')
-rw-r--r--packages/base/src/C/vector-aux.c10
-rw-r--r--packages/base/src/Data/Packed/Internal/Numeric.hs3
-rw-r--r--packages/base/src/Data/Packed/Numeric.hs3
-rw-r--r--packages/base/src/Numeric/Vectorized.hs11
4 files changed, 22 insertions, 5 deletions
diff --git a/packages/base/src/C/vector-aux.c b/packages/base/src/C/vector-aux.c
index b176089..efb82af 100644
--- a/packages/base/src/C/vector-aux.c
+++ b/packages/base/src/C/vector-aux.c
@@ -783,3 +783,13 @@ int sort_values(KDVEC(v),DVEC(r)) {
783 OK 783 OK
784} 784}
785 785
786////////////////////////////////////////////////////////////////////////////////
787
788int round_vector(KDVEC(v),DVEC(r)) {
789 int k;
790 for(k=0; k<vn; k++) {
791 rp[k] = round(vp[k]);
792 }
793 OK
794}
795
diff --git a/packages/base/src/Data/Packed/Internal/Numeric.hs b/packages/base/src/Data/Packed/Internal/Numeric.hs
index 56ecdfe..9adc023 100644
--- a/packages/base/src/Data/Packed/Internal/Numeric.hs
+++ b/packages/base/src/Data/Packed/Internal/Numeric.hs
@@ -36,9 +36,8 @@ module Data.Packed.Internal.Numeric (
36 Convert(..), 36 Convert(..),
37 Complexable(), 37 Complexable(),
38 RealElement(), 38 RealElement(),
39 39 roundVector,
40 RealOf, ComplexOf, SingleOf, DoubleOf, 40 RealOf, ComplexOf, SingleOf, DoubleOf,
41
42 IndexOf, 41 IndexOf,
43 module Data.Complex 42 module Data.Complex
44) where 43) where
diff --git a/packages/base/src/Data/Packed/Numeric.hs b/packages/base/src/Data/Packed/Numeric.hs
index cc26d7a..ab9e8a2 100644
--- a/packages/base/src/Data/Packed/Numeric.hs
+++ b/packages/base/src/Data/Packed/Numeric.hs
@@ -57,9 +57,8 @@ module Data.Packed.Numeric (
57 Convert(..), 57 Convert(..),
58 Complexable(), 58 Complexable(),
59 RealElement(), 59 RealElement(),
60
61 RealOf, ComplexOf, SingleOf, DoubleOf, 60 RealOf, ComplexOf, SingleOf, DoubleOf,
62 61 roundVector,
63 IndexOf, 62 IndexOf,
64 module Data.Complex, 63 module Data.Complex,
65 -- * IO 64 -- * IO
diff --git a/packages/base/src/Numeric/Vectorized.hs b/packages/base/src/Numeric/Vectorized.hs
index 82504a9..936daba 100644
--- a/packages/base/src/Numeric/Vectorized.hs
+++ b/packages/base/src/Numeric/Vectorized.hs
@@ -19,7 +19,7 @@ module Numeric.Vectorized (
19 FunCodeVV(..), vectorZipR, vectorZipC, vectorZipF, vectorZipQ, 19 FunCodeVV(..), vectorZipR, vectorZipC, vectorZipF, vectorZipQ,
20 vectorScan, saveMatrix, 20 vectorScan, saveMatrix,
21 Seed, RandDist(..), randomVector, 21 Seed, RandDist(..), randomVector,
22 sortVector 22 sortVector, roundVector
23) where 23) where
24 24
25import Data.Packed.Internal.Common 25import Data.Packed.Internal.Common
@@ -354,3 +354,12 @@ sortVector v = unsafePerformIO $ do
354 354
355foreign import ccall unsafe "sort_values" c_sort_values :: TVV 355foreign import ccall unsafe "sort_values" c_sort_values :: TVV
356 356
357--------------------------------------------------------------------------------
358
359roundVector v = unsafePerformIO $ do
360 r <- createVector (dim v)
361 app2 c_round_vector vec v vec r "roundVector"
362 return r
363
364foreign import ccall unsafe "round_vector" c_round_vector :: TVV
365