summaryrefslogtreecommitdiff
path: root/lib/Data/Packed/Vector.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Data/Packed/Vector.hs')
-rw-r--r--lib/Data/Packed/Vector.hs19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/Data/Packed/Vector.hs b/lib/Data/Packed/Vector.hs
index 472240c..f6b3fc6 100644
--- a/lib/Data/Packed/Vector.hs
+++ b/lib/Data/Packed/Vector.hs
@@ -29,6 +29,25 @@ import Data.Packed.Internal
29import Numeric.GSL.Vector 29import Numeric.GSL.Vector
30-- import Data.Packed.ST 30-- import Data.Packed.ST
31 31
32import Data.Binary
33import Foreign.Storable
34import Control.Monad(replicateM)
35
36-------------------------------------------------------------------
37
38instance (Binary a, Storable a) => Binary (Vector a) where
39 put v = do
40 let d = dim v
41 put d
42 mapM_ (\i -> put $ v @> i) [0..(d-1)]
43 get = do
44 d <- get
45 xs <- replicateM d get
46 return $ fromList xs
47
48-------------------------------------------------------------------
49
50
32{- | Creates a real vector containing a range of values: 51{- | Creates a real vector containing a range of values:
33 52
34@\> linspace 5 (-3,7) 53@\> linspace 5 (-3,7)