summaryrefslogtreecommitdiff
path: root/lib/Data
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2011-02-22 09:10:40 +0000
committerAlberto Ruiz <aruiz@um.es>2011-02-22 09:10:40 +0000
commit11b5d06fba6105b5da1306569a298ebdde51af79 (patch)
tree797fad0cd67cbe25436a8e69d33fe84e4578d440 /lib/Data
parent656c174d7200f702cdaba31ce55a6a8a71e71a38 (diff)
minor change and thanks
Diffstat (limited to 'lib/Data')
-rw-r--r--lib/Data/Packed/Internal/Vector.hs10
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
202subVector = Vector.slice 202subVector = Vector.slice
203 203
204{-
205subVector 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
206subVector k l v@V{idim = n, ioff = i} 214subVector 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{-
210subVectorCopy k l (v@V {idim=n}) 219subVectorCopy 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