diff options
author | Alberto Ruiz <aruiz@um.es> | 2011-02-22 09:10:40 +0000 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2011-02-22 09:10:40 +0000 |
commit | 11b5d06fba6105b5da1306569a298ebdde51af79 (patch) | |
tree | 797fad0cd67cbe25436a8e69d33fe84e4578d440 /lib | |
parent | 656c174d7200f702cdaba31ce55a6a8a71e71a38 (diff) |
minor change and thanks
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Data/Packed/Internal/Vector.hs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Data/Packed/Internal/Vector.hs b/lib/Data/Packed/Internal/Vector.hs index b68d16a..078cb36 100644 --- a/lib/Data/Packed/Internal/Vector.hs +++ b/lib/Data/Packed/Internal/Vector.hs | |||
@@ -201,12 +201,21 @@ subVector :: Storable t => Int -- ^ index of the starting element | |||
201 | 201 | ||
202 | subVector = Vector.slice | 202 | subVector = Vector.slice |
203 | 203 | ||
204 | {- | ||
205 | subVector k l v | ||
206 | | k<0 || k >= n || k+l > n || l < 0 = error "subVector out of range" | ||
207 | | otherwise = unsafeFromForeignPtr fp (i+k) l | ||
208 | where | ||
209 | (fp, i, n) = unsafeToForeignPtr v | ||
210 | -} | ||
211 | |||
204 | #else | 212 | #else |
205 | 213 | ||
206 | subVector k l v@V{idim = n, ioff = i} | 214 | subVector k l v@V{idim = n, ioff = i} |
207 | | k<0 || k >= n || k+l > n || l < 0 = error "subVector out of range" | 215 | | k<0 || k >= n || k+l > n || l < 0 = error "subVector out of range" |
208 | | otherwise = v {idim = l, ioff = i+k} | 216 | | otherwise = v {idim = l, ioff = i+k} |
209 | 217 | ||
218 | {- | ||
210 | subVectorCopy k l (v@V {idim=n}) | 219 | subVectorCopy k l (v@V {idim=n}) |
211 | | k<0 || k >= n || k+l > n || l < 0 = error "subVector out of range" | 220 | | k<0 || k >= n || k+l > n || l < 0 = error "subVector out of range" |
212 | | otherwise = unsafePerformIO $ do | 221 | | otherwise = unsafePerformIO $ do |
@@ -214,6 +223,7 @@ subVectorCopy k l (v@V {idim=n}) | |||
214 | let f _ s _ d = copyArray d (advancePtr s k) l >> return 0 | 223 | let f _ s _ d = copyArray d (advancePtr s k) l >> return 0 |
215 | app2 f vec v vec r "subVector" | 224 | app2 f vec v vec r "subVector" |
216 | return r | 225 | return r |
226 | -} | ||
217 | 227 | ||
218 | #endif | 228 | #endif |
219 | 229 | ||