diff options
Diffstat (limited to 'lib/Data/Packed/Internal/Vector.hs')
-rw-r--r-- | lib/Data/Packed/Internal/Vector.hs | 4 |
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 |
82 | createVector :: Storable a => Int -> IO (Vector a) | 82 | createVector :: Storable a => Int -> IO (Vector a) |
83 | createVector n = do | 83 | createVector 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 | -} |
194 | vjoin :: Storable t => [Vector t] -> Vector t | 194 | vjoin :: Storable t => [Vector t] -> Vector t |
195 | vjoin [] = error "vjoin zero vectors" | 195 | vjoin [] = fromList [] |
196 | vjoin [v] = v | 196 | vjoin [v] = v |
197 | vjoin as = unsafePerformIO $ do | 197 | vjoin as = unsafePerformIO $ do |
198 | let tot = sum (map dim as) | 198 | let tot = sum (map dim as) |