From 197e88c3b56d28840217010a2871c6ea3a4dd1a4 Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Wed, 21 May 2014 10:30:55 +0200 Subject: update dependencies, move examples etc --- packages/hmatrix/examples/vector.hs | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 packages/hmatrix/examples/vector.hs (limited to 'packages/hmatrix/examples/vector.hs') diff --git a/packages/hmatrix/examples/vector.hs b/packages/hmatrix/examples/vector.hs deleted file mode 100644 index f531cbd..0000000 --- a/packages/hmatrix/examples/vector.hs +++ /dev/null @@ -1,31 +0,0 @@ --- conversion to/from Data.Vector.Storable --- from Roman Leshchinskiy "vector" package --- --- In the future Data.Packed.Vector will be replaced by Data.Vector.Storable - -------------------------------------------- - -import Numeric.LinearAlgebra as H -import Data.Packed.Development(unsafeFromForeignPtr, unsafeToForeignPtr) -import Foreign.Storable -import qualified Data.Vector.Storable as V - -fromVector :: Storable t => V.Vector t -> H.Vector t -fromVector v = unsafeFromForeignPtr p i n where - (p,i,n) = V.unsafeToForeignPtr v - -toVector :: Storable t => H.Vector t -> V.Vector t -toVector v = V.unsafeFromForeignPtr p i n where - (p,i,n) = unsafeToForeignPtr v - -------------------------------------------- - -v = V.slice 5 10 (V.fromList [1 .. 10::Double] V.++ V.replicate 10 7) - -w = subVector 2 3 (linspace 5 (0,1)) :: Vector Double - -main = do - print v - print $ fromVector v - print w - print $ toVector w -- cgit v1.2.3