summaryrefslogtreecommitdiff
path: root/packages/base/src/Numeric
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2015-05-26 20:17:07 +0200
committerAlberto Ruiz <aruiz@um.es>2015-05-26 20:17:07 +0200
commit6827aa04b1c21b08875c58d38de5d90195aefb46 (patch)
treeb4919b1a79988e155000c73a588b6d9b4bf112fd /packages/base/src/Numeric
parent7df149d9a3381aa609ffc36c9b14d87fdcfa5f20 (diff)
general sortVector, sortIndex
Diffstat (limited to 'packages/base/src/Numeric')
-rw-r--r--packages/base/src/Numeric/Vectorized.hs21
1 files changed, 9 insertions, 12 deletions
diff --git a/packages/base/src/Numeric/Vectorized.hs b/packages/base/src/Numeric/Vectorized.hs
index d0ff562..589cb49 100644
--- a/packages/base/src/Numeric/Vectorized.hs
+++ b/packages/base/src/Numeric/Vectorized.hs
@@ -19,8 +19,10 @@ module Numeric.Vectorized (
19 FunCodeVV(..), vectorZipR, vectorZipC, vectorZipF, vectorZipQ, vectorZipI, 19 FunCodeVV(..), vectorZipR, vectorZipC, vectorZipF, vectorZipQ, vectorZipI,
20 vectorScan, saveMatrix, 20 vectorScan, saveMatrix,
21 Seed, RandDist(..), randomVector, 21 Seed, RandDist(..), randomVector,
22 sortVector, roundVector, 22 roundVector,
23 range 23 range,
24-- compareD, compareF, compareI,
25-- chooseD, chooseF, chooseI
24) where 26) where
25 27
26import Data.Packed.Internal.Common 28import Data.Packed.Internal.Common
@@ -374,15 +376,6 @@ foreign import ccall unsafe "random_vector" c_random_vector :: CInt -> CInt -> T
374 376
375-------------------------------------------------------------------------------- 377--------------------------------------------------------------------------------
376 378
377sortVector v = unsafePerformIO $ do
378 r <- createVector (dim v)
379 app2 c_sort_values vec v vec r "sortVector"
380 return r
381
382foreign import ccall unsafe "sort_values" c_sort_values :: TVV
383
384--------------------------------------------------------------------------------
385
386roundVector v = unsafePerformIO $ do 379roundVector v = unsafePerformIO $ do
387 r <- createVector (dim v) 380 r <- createVector (dim v)
388 app2 c_round_vector vec v vec r "roundVector" 381 app2 c_round_vector vec v vec r "roundVector"
@@ -392,7 +385,11 @@ foreign import ccall unsafe "round_vector" c_round_vector :: TVV
392 385
393-------------------------------------------------------------------------------- 386--------------------------------------------------------------------------------
394 387
395range :: Int -> Idxs 388-- |
389-- >>> range 5
390-- fromList [0,1,2,3,4]
391--
392range :: Int -> Vector I
396range n = unsafePerformIO $ do 393range n = unsafePerformIO $ do
397 r <- createVector n 394 r <- createVector n
398 app1 c_range_vector vec r "range" 395 app1 c_range_vector vec r "range"