{-# OPTIONS_GHC -fglasgow-exts #-} ----------------------------------------------------------------------------- -- | -- Module : Numeric.GSL.Sort -- Copyright : (c) Alexander Vivian Hugh McPhail 2010 -- License : GPL-style -- -- Maintainer : haskell.vivian.mcphail gmail com -- Stability : provisional -- Portability : uses ffi -- -- GSL sorting functions -- ----------------------------------------------------------------------------- module Numeric.GSL.Sort ( sort ) where import Data.Packed.Vector import Data.Packed.Development import Foreign import Foreign.C.Types(CInt) -- | sort the elements of a vector into ascending order sort :: Vector Double -> Vector Double sort v = unsafePerformIO $ do r <- createVector (dim v) app2 sort_sort vec v vec r "sort" return r foreign import ccall "sort-aux.h sort" sort_sort :: CInt -> Ptr Double -> CInt -> Ptr Double -> IO CInt