dph-prim-par: add indexs wrapper
authorBen Lippmeier <benl@ouroborus.net>
Tue, 20 Dec 2011 08:59:09 +0000 (19:59 +1100)
committerBen Lippmeier <benl@ouroborus.net>
Tue, 20 Dec 2011 08:59:09 +0000 (19:59 +1100)
dph-prim-par/Data/Array/Parallel/Unlifted.hs
dph-prim-par/Data/Array/Parallel/Unlifted/Parallel.hs
dph-prim-par/Data/Array/Parallel/Unlifted/Parallel/Extracts.hs
dph-prim-seq/Data/Array/Parallel/Unlifted/Stream.hs

index 9362d0e..c3ae417 100644 (file)
@@ -105,6 +105,7 @@ enumFromStepLenEach n starts steps lens
 -- Projections ----------------------------------------------------------------
 length          = Seq.length
 index           = Seq.index
+indexs          = indexsFromVector
 indexs_avs      = indexsFromVectorsUPVSegd
 
 extract arr i n
index 78480df..0a5cbbc 100644 (file)
@@ -47,6 +47,7 @@ module Data.Array.Parallel.Unlifted.Parallel
         , sumRUP
 
           -- * Index and Extracts
+        , indexsFromVector
         , indexsFromVectorsUPVSegd
         , extractsFromNestedUPSSegd
         , extractsFromVectorsUPSSegd
index 09bd0f4..13411ba 100644 (file)
@@ -4,7 +4,8 @@
 -- | Parallel combinators for segmented unboxed arrays
 module Data.Array.Parallel.Unlifted.Parallel.Extracts 
         ( -- * Scattered indexing
-          indexsFromVectorsUPVSegd
+          indexsFromVector
+        , indexsFromVectorsUPVSegd
 
           -- * Scattered extracts
         , extractsFromNestedUPSSegd
@@ -25,6 +26,17 @@ import qualified Data.Vector                                            as V
 
 
 -- Indexvs --------------------------------------------------------------------
+-- | Lookup elements from a `Vector`.
+--
+--   TODO: make this parallel.
+--
+indexsFromVector
+        :: Unbox a
+        => Vector a -> Vector Int -> Vector a
+
+indexsFromVector = Seq.indexsFromVector
+
+
 -- | Lookup elements from some `Vectors` through a `UPVSegd`.
 --
 --   TODO: make this parallel.
@@ -40,7 +52,7 @@ indexsFromVectorsUPVSegd vectors upvsegd vsrcixs
         !upssegd  = UPVSegd.takeUPSSegdRedundant upvsegd
         !ussegd   = UPSSegd.takeUSSegd upssegd
    in   Seq.unstream
-         $ US.streamElemsFromVectors        vectors
+         $ US.streamElemsFromVectors     vectors
          $ US.streamSrcIxsThroughUSSegd  ussegd
          $ US.streamSrcIxsThroughVSegids vsegids
          $ Seq.stream vsrcixs
index 390f742..b60afa2 100644 (file)
@@ -6,6 +6,7 @@ module Data.Array.Parallel.Unlifted.Stream
 
           -- * Element streamers.
         , streamElemsFromVector
+        , streamElemsFromVectors
         , streamElemsFromVectorsVSegd
 
           -- * Segment streamers.