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 dedb822..6271bb6 100644
--- a/packages/base/src/Internal/Vector.hs
+++ b/packages/base/src/Internal/Vector.hs
@@ -116,7 +116,8 @@ toList v = safeRead v $ peekArray (dim v)
116 be used, for instance, with infinite lists. 116 be used, for instance, with infinite lists.
117 117
118>>> 5 |> [1..] 118>>> 5 |> [1..]
119fromList [1.0,2.0,3.0,4.0,5.0] 119[1.0,2.0,3.0,4.0,5.0]
120it :: (Enum a, Num a, Foreign.Storable.Storable a) => Vector a
120 121
121-} 122-}
122(|>) :: (Storable a) => Int -> [a] -> Vector a 123(|>) :: (Storable a) => Int -> [a] -> Vector a
@@ -135,7 +136,8 @@ idxs js = fromList (map fromIntegral js) :: Vector I
135{- | takes a number of consecutive elements from a Vector 136{- | takes a number of consecutive elements from a Vector
136 137
137>>> subVector 2 3 (fromList [1..10]) 138>>> subVector 2 3 (fromList [1..10])
138fromList [3.0,4.0,5.0] 139[3.0,4.0,5.0]
140it :: (Enum t, Num t, Foreign.Storable.Storable t) => Vector t
139 141
140-} 142-}
141subVector :: Storable t => Int -- ^ index of the starting element 143subVector :: Storable t => Int -- ^ index of the starting element
@@ -169,7 +171,8 @@ at' v n = safeRead v $ flip peekElemOff n
169{- | concatenate a list of vectors 171{- | concatenate a list of vectors
170 172
171>>> vjoin [fromList [1..5::Double], konst 1 3] 173>>> vjoin [fromList [1..5::Double], konst 1 3]
172fromList [1.0,2.0,3.0,4.0,5.0,1.0,1.0,1.0] 174[1.0,2.0,3.0,4.0,5.0,1.0,1.0,1.0]
175it :: Vector Double
173 176
174-} 177-}
175vjoin :: Storable t => [Vector t] -> Vector t 178vjoin :: Storable t => [Vector t] -> Vector t
@@ -191,7 +194,8 @@ vjoin as = unsafePerformIO $ do
191{- | Extract consecutive subvectors of the given sizes. 194{- | Extract consecutive subvectors of the given sizes.
192 195
193>>> takesV [3,4] (linspace 10 (1,10::Double)) 196>>> takesV [3,4] (linspace 10 (1,10::Double))
194[fromList [1.0,2.0,3.0],fromList [4.0,5.0,6.0,7.0]] 197[[1.0,2.0,3.0],[4.0,5.0,6.0,7.0]]
198it :: [Vector Double]
195 199
196-} 200-}
197takesV :: Storable t => [Int] -> Vector t -> [Vector t] 201takesV :: Storable t => [Int] -> Vector t -> [Vector t]