diff options
author | Alberto Ruiz <aruiz@um.es> | 2015-05-26 20:17:07 +0200 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2015-05-26 20:17:07 +0200 |
commit | 6827aa04b1c21b08875c58d38de5d90195aefb46 (patch) | |
tree | b4919b1a79988e155000c73a588b6d9b4bf112fd /packages/base/src/Numeric | |
parent | 7df149d9a3381aa609ffc36c9b14d87fdcfa5f20 (diff) |
general sortVector, sortIndex
Diffstat (limited to 'packages/base/src/Numeric')
-rw-r--r-- | packages/base/src/Numeric/Vectorized.hs | 21 |
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 | ||
26 | import Data.Packed.Internal.Common | 28 | import 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 | ||
377 | sortVector v = unsafePerformIO $ do | ||
378 | r <- createVector (dim v) | ||
379 | app2 c_sort_values vec v vec r "sortVector" | ||
380 | return r | ||
381 | |||
382 | foreign import ccall unsafe "sort_values" c_sort_values :: TVV | ||
383 | |||
384 | -------------------------------------------------------------------------------- | ||
385 | |||
386 | roundVector v = unsafePerformIO $ do | 379 | roundVector 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 | ||
395 | range :: Int -> Idxs | 388 | -- | |
389 | -- >>> range 5 | ||
390 | -- fromList [0,1,2,3,4] | ||
391 | -- | ||
392 | range :: Int -> Vector I | ||
396 | range n = unsafePerformIO $ do | 393 | range 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" |