2011-06-05 36 views

回答

5

看起來它產生一個長度len - 1,這是在外殼9的陣列。這給你在[0-8]範圍內的索引。我同意文件可能更清楚。

如果你看看源,select是在這些方面實現的selectChunkedP

-- | Select indices matching a predicate, in parallel. 
-- The array is chunked up, with one chunk being given to each thread. 
-- The number of elements in the result array depends on how many threads 
-- you're running the program with. 
selectChunkedP 
    :: forall a 
    . Unbox a 
    => (Int -> Bool) --^See if this predicate matches. 
    -> (Int -> a)  -- .. and apply fn to the matching index 
    -> Int    -- Extent of indices to apply to predicate. 

顯然,對於一個給定n '指數的範圍' 包括所有指數x這樣0 <= x < (n-1)

Prelude Data.Array.Repa> extent $ select (const True) id 10 
Z :. 9