diff options
author | Alberto Ruiz <aruiz@um.es> | 2010-09-26 17:05:09 +0000 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2010-09-26 17:05:09 +0000 |
commit | 611ff4782c261a6c6e52fe7ed0c122a0eac22691 (patch) | |
tree | 5b9362a88a568cbb4e8ad442365e26bdef17946d /examples/vector.hs | |
parent | 632c2c5a8b934fd8b54c8be68d178aa49323077d (diff) |
fix imports, examples
Diffstat (limited to 'examples/vector.hs')
-rw-r--r-- | examples/vector.hs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/examples/vector.hs b/examples/vector.hs index eda9290..f531cbd 100644 --- a/examples/vector.hs +++ b/examples/vector.hs | |||
@@ -14,7 +14,7 @@ fromVector :: Storable t => V.Vector t -> H.Vector t | |||
14 | fromVector v = unsafeFromForeignPtr p i n where | 14 | fromVector v = unsafeFromForeignPtr p i n where |
15 | (p,i,n) = V.unsafeToForeignPtr v | 15 | (p,i,n) = V.unsafeToForeignPtr v |
16 | 16 | ||
17 | toVector :: H.Vector t -> V.Vector t | 17 | toVector :: Storable t => H.Vector t -> V.Vector t |
18 | toVector v = V.unsafeFromForeignPtr p i n where | 18 | toVector v = V.unsafeFromForeignPtr p i n where |
19 | (p,i,n) = unsafeToForeignPtr v | 19 | (p,i,n) = unsafeToForeignPtr v |
20 | 20 | ||
@@ -22,11 +22,10 @@ toVector v = V.unsafeFromForeignPtr p i n where | |||
22 | 22 | ||
23 | v = V.slice 5 10 (V.fromList [1 .. 10::Double] V.++ V.replicate 10 7) | 23 | v = V.slice 5 10 (V.fromList [1 .. 10::Double] V.++ V.replicate 10 7) |
24 | 24 | ||
25 | w = subVector 2 3 (linspace 10 (0,2)) | 25 | w = subVector 2 3 (linspace 5 (0,1)) :: Vector Double |
26 | 26 | ||
27 | main = do | 27 | main = do |
28 | print v | 28 | print v |
29 | print $ fromVector v | 29 | print $ fromVector v |
30 | print w | 30 | print w |
31 | print $ toVector w | 31 | print $ toVector w |
32 | |||