summaryrefslogtreecommitdiff
path: root/lib/Data/Packed/Internal/Vector.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Data/Packed/Internal/Vector.hs')
-rw-r--r--lib/Data/Packed/Internal/Vector.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Data/Packed/Internal/Vector.hs b/lib/Data/Packed/Internal/Vector.hs
index 415c972..6d03438 100644
--- a/lib/Data/Packed/Internal/Vector.hs
+++ b/lib/Data/Packed/Internal/Vector.hs
@@ -81,7 +81,7 @@ vec x f = unsafeWith x $ \p -> do
81-- allocates memory for a new vector 81-- allocates memory for a new vector
82createVector :: Storable a => Int -> IO (Vector a) 82createVector :: Storable a => Int -> IO (Vector a)
83createVector n = do 83createVector n = do
84 when (n <= 0) $ error ("trying to createVector of dim "++show n) 84 when (n < 0) $ error ("trying to createVector of negative dim: "++show n)
85 fp <- doMalloc undefined 85 fp <- doMalloc undefined
86 return $ unsafeFromForeignPtr fp 0 n 86 return $ unsafeFromForeignPtr fp 0 n
87 where 87 where
@@ -192,7 +192,7 @@ fromList [1.0,2.0,3.0,4.0,5.0,1.0,1.0,1.0]
192 192
193-} 193-}
194vjoin :: Storable t => [Vector t] -> Vector t 194vjoin :: Storable t => [Vector t] -> Vector t
195vjoin [] = error "vjoin zero vectors" 195vjoin [] = fromList []
196vjoin [v] = v 196vjoin [v] = v
197vjoin as = unsafePerformIO $ do 197vjoin as = unsafePerformIO $ do
198 let tot = sum (map dim as) 198 let tot = sum (map dim as)