diff options
author | Alberto Ruiz <aruiz@um.es> | 2014-04-23 14:19:34 +0200 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2014-04-23 14:19:34 +0200 |
commit | 7c5adb83c9cb632c39eb2d844a1496e2a7a23e8b (patch) | |
tree | ec80d2d2533fcf1a2c1f1f021bc0669767ec7817 /lib/Data/Packed/Internal | |
parent | eaa21e363a62274b3b457556d8f41b10cc335513 (diff) |
join -> vjoin
Diffstat (limited to 'lib/Data/Packed/Internal')
-rw-r--r-- | lib/Data/Packed/Internal/Matrix.hs | 2 | ||||
-rw-r--r-- | lib/Data/Packed/Internal/Vector.hs | 14 |
2 files changed, 8 insertions, 8 deletions
diff --git a/lib/Data/Packed/Internal/Matrix.hs b/lib/Data/Packed/Internal/Matrix.hs index 7504b39..5e6e649 100644 --- a/lib/Data/Packed/Internal/Matrix.hs +++ b/lib/Data/Packed/Internal/Matrix.hs | |||
@@ -154,7 +154,7 @@ toLists m = splitEvery (cols m) . toList . flatten $ m | |||
154 | fromRows :: Element t => [Vector t] -> Matrix t | 154 | fromRows :: Element t => [Vector t] -> Matrix t |
155 | fromRows vs = case compatdim (map dim vs) of | 155 | fromRows vs = case compatdim (map dim vs) of |
156 | Nothing -> error "fromRows applied to [] or to vectors with different sizes" | 156 | Nothing -> error "fromRows applied to [] or to vectors with different sizes" |
157 | Just c -> reshape c . Data.Packed.Internal.Vector.join . map (adapt c) $ vs | 157 | Just c -> reshape c . vjoin . map (adapt c) $ vs |
158 | where | 158 | where |
159 | adapt c v | dim v == c = v | 159 | adapt c v | dim v == c = v |
160 | | otherwise = constantD (v@>0) c | 160 | | otherwise = constantD (v@>0) c |
diff --git a/lib/Data/Packed/Internal/Vector.hs b/lib/Data/Packed/Internal/Vector.hs index c99f4f0..e5c3196 100644 --- a/lib/Data/Packed/Internal/Vector.hs +++ b/lib/Data/Packed/Internal/Vector.hs | |||
@@ -16,7 +16,7 @@ | |||
16 | module Data.Packed.Internal.Vector ( | 16 | module Data.Packed.Internal.Vector ( |
17 | Vector, dim, | 17 | Vector, dim, |
18 | fromList, toList, (|>), | 18 | fromList, toList, (|>), |
19 | Data.Packed.Internal.Vector.join, (@>), safe, at, at', subVector, takesV, | 19 | vjoin, (@>), safe, at, at', subVector, takesV, |
20 | mapVector, mapVectorWithIndex, zipVectorWith, unzipVectorWith, | 20 | mapVector, mapVectorWithIndex, zipVectorWith, unzipVectorWith, |
21 | mapVectorM, mapVectorM_, mapVectorWithIndexM, mapVectorWithIndexM_, | 21 | mapVectorM, mapVectorM_, mapVectorWithIndexM, mapVectorWithIndexM_, |
22 | foldVector, foldVectorG, foldLoop, foldVectorWithIndex, | 22 | foldVector, foldVectorG, foldLoop, foldVectorWithIndex, |
@@ -183,16 +183,16 @@ infixl 9 @> | |||
183 | (@>) = at | 183 | (@>) = at |
184 | 184 | ||
185 | 185 | ||
186 | {- | creates a new Vector by joining a list of Vectors | 186 | {- | concatenate a list of vectors |
187 | 187 | ||
188 | @> join [fromList [1..5], constant 1 3] | 188 | @> vjoin [fromList [1..5], constant 1 3] |
189 | 8 |> [1.0,2.0,3.0,4.0,5.0,1.0,1.0,1.0]@ | 189 | 8 |> [1.0,2.0,3.0,4.0,5.0,1.0,1.0,1.0]@ |
190 | 190 | ||
191 | -} | 191 | -} |
192 | join :: Storable t => [Vector t] -> Vector t | 192 | vjoin :: Storable t => [Vector t] -> Vector t |
193 | join [] = error "joining zero vectors" | 193 | vjoin [] = error "vjoin zero vectors" |
194 | join [v] = v | 194 | vjoin [v] = v |
195 | join as = unsafePerformIO $ do | 195 | vjoin as = unsafePerformIO $ do |
196 | let tot = sum (map dim as) | 196 | let tot = sum (map dim as) |
197 | r <- createVector tot | 197 | r <- createVector tot |
198 | unsafeWith r $ \ptr -> | 198 | unsafeWith r $ \ptr -> |