diff options
author | Alberto Ruiz <aruiz@um.es> | 2014-05-04 21:08:51 +0200 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2014-05-04 21:08:51 +0200 |
commit | 4078cf44c98b42960be27843782f6983bb66017f (patch) | |
tree | bee20c3c811a98247aab99738991ab4b2bcc2312 /lib/Numeric/GSL/Vector.hs | |
parent | ae104ebd5891c84f9c8b4a40501fefdeeb1280c4 (diff) |
allow empty arrays
Diffstat (limited to 'lib/Numeric/GSL/Vector.hs')
-rw-r--r-- | lib/Numeric/GSL/Vector.hs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Numeric/GSL/Vector.hs b/lib/Numeric/GSL/Vector.hs index db34041..6204b8e 100644 --- a/lib/Numeric/GSL/Vector.hs +++ b/lib/Numeric/GSL/Vector.hs | |||
@@ -33,6 +33,7 @@ import Foreign.Marshal.Array(newArray) | |||
33 | import Foreign.Ptr(Ptr) | 33 | import Foreign.Ptr(Ptr) |
34 | import Foreign.C.Types | 34 | import Foreign.C.Types |
35 | import System.IO.Unsafe(unsafePerformIO) | 35 | import System.IO.Unsafe(unsafePerformIO) |
36 | import Control.Monad(when) | ||
36 | 37 | ||
37 | fromei x = fromIntegral (fromEnum x) :: CInt | 38 | fromei x = fromIntegral (fromEnum x) :: CInt |
38 | 39 | ||
@@ -201,7 +202,7 @@ vectorMapValAux fun code val v = unsafePerformIO $ do | |||
201 | 202 | ||
202 | vectorZipAux fun code u v = unsafePerformIO $ do | 203 | vectorZipAux fun code u v = unsafePerformIO $ do |
203 | r <- createVector (dim u) | 204 | r <- createVector (dim u) |
204 | app3 (fun (fromei code)) vec u vec v vec r "vectorZipAux" | 205 | when (dim u > 0) $ app3 (fun (fromei code)) vec u vec v vec r "vectorZipAux" |
205 | return r | 206 | return r |
206 | 207 | ||
207 | --------------------------------------------------------------------- | 208 | --------------------------------------------------------------------- |