From 11095a22c59bed6a011723641dfb782415e2c02b Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Mon, 25 May 2015 08:46:59 +0200 Subject: range --- packages/base/src/Numeric/Vectorized.hs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'packages/base/src/Numeric/Vectorized.hs') diff --git a/packages/base/src/Numeric/Vectorized.hs b/packages/base/src/Numeric/Vectorized.hs index 70bd48b..d0ff562 100644 --- a/packages/base/src/Numeric/Vectorized.hs +++ b/packages/base/src/Numeric/Vectorized.hs @@ -19,7 +19,8 @@ module Numeric.Vectorized ( FunCodeVV(..), vectorZipR, vectorZipC, vectorZipF, vectorZipQ, vectorZipI, vectorScan, saveMatrix, Seed, RandDist(..), randomVector, - sortVector, roundVector + sortVector, roundVector, + range ) where import Data.Packed.Internal.Common @@ -389,3 +390,13 @@ roundVector v = unsafePerformIO $ do foreign import ccall unsafe "round_vector" c_round_vector :: TVV +-------------------------------------------------------------------------------- + +range :: Int -> Idxs +range n = unsafePerformIO $ do + r <- createVector n + app1 c_range_vector vec r "range" + return r + +foreign import ccall unsafe "range_vector" c_range_vector :: CV CInt (IO CInt) + -- cgit v1.2.3