summaryrefslogtreecommitdiff
path: root/packages/base/src/Internal/Vector.hs
diff options
context:
space:
mode:
Diffstat (limited to 'packages/base/src/Internal/Vector.hs')
-rw-r--r--packages/base/src/Internal/Vector.hs12
1 files changed, 8 insertions, 4 deletions
diff --git a/packages/base/src/Internal/Vector.hs b/packages/base/src/Internal/Vector.hs
index 67d0416..e1e4aa8 100644
--- a/packages/base/src/Internal/Vector.hs
+++ b/packages/base/src/Internal/Vector.hs
@@ -113,7 +113,8 @@ toList v = safeRead v $ peekArray (dim v)
113 be used, for instance, with infinite lists. 113 be used, for instance, with infinite lists.
114 114
115>>> 5 |> [1..] 115>>> 5 |> [1..]
116fromList [1.0,2.0,3.0,4.0,5.0] 116[1.0,2.0,3.0,4.0,5.0]
117it :: (Enum a, Num a, Foreign.Storable.Storable a) => Vector a
117 118
118-} 119-}
119(|>) :: (Storable a) => Int -> [a] -> Vector a 120(|>) :: (Storable a) => Int -> [a] -> Vector a
@@ -132,7 +133,8 @@ idxs js = fromList (map fromIntegral js) :: Vector I
132{- | takes a number of consecutive elements from a Vector 133{- | takes a number of consecutive elements from a Vector
133 134
134>>> subVector 2 3 (fromList [1..10]) 135>>> subVector 2 3 (fromList [1..10])
135fromList [3.0,4.0,5.0] 136[3.0,4.0,5.0]
137it :: (Enum t, Num t, Foreign.Storable.Storable t) => Vector t
136 138
137-} 139-}
138subVector :: Storable t => Int -- ^ index of the starting element 140subVector :: Storable t => Int -- ^ index of the starting element
@@ -166,7 +168,8 @@ at' v n = safeRead v $ flip peekElemOff n
166{- | concatenate a list of vectors 168{- | concatenate a list of vectors
167 169
168>>> vjoin [fromList [1..5::Double], konst 1 3] 170>>> vjoin [fromList [1..5::Double], konst 1 3]
169fromList [1.0,2.0,3.0,4.0,5.0,1.0,1.0,1.0] 171[1.0,2.0,3.0,4.0,5.0,1.0,1.0,1.0]
172it :: Vector Double
170 173
171-} 174-}
172vjoin :: Storable t => [Vector t] -> Vector t 175vjoin :: Storable t => [Vector t] -> Vector t
@@ -188,7 +191,8 @@ vjoin as = unsafePerformIO $ do
188{- | Extract consecutive subvectors of the given sizes. 191{- | Extract consecutive subvectors of the given sizes.
189 192
190>>> takesV [3,4] (linspace 10 (1,10::Double)) 193>>> takesV [3,4] (linspace 10 (1,10::Double))
191[fromList [1.0,2.0,3.0],fromList [4.0,5.0,6.0,7.0]] 194[[1.0,2.0,3.0],[4.0,5.0,6.0,7.0]]
195it :: [Vector Double]
192 196
193-} 197-}
194takesV :: Storable t => [Int] -> Vector t -> [Vector t] 198takesV :: Storable t => [Int] -> Vector t -> [Vector t]