Custom Query (35 matches)

Filters
 
Or
 
  
 
Columns

Show under each result:


Results (19 - 21 of 35)

1 2 3 4 5 6 7 8 9 10 11 12
Ticket Resolution Summary Owner Reporter
#22 fixed Represent bitmaps as arrays of tuples Ben Lippmeier
Description

Representing bitmaps as a 3D array isn't ideal because there's no way to perform a map over all the pixels.

With this representation:

Array DIM3 Word8

Suppose we want to convert the image to greyscale in a single operation. We'd really need a function like:

map1 :: (Array DIM1 a -> Array DIM1 a) -> Array DIM3 a -> Array DIM3 a

However, that doesn't work because we can't guarantee that the worker function always returns an array of the same length as the original. Because of this we can't guarantee that the result is rectangular, and Repa can only deal with rectangular arrays.

If instead we represented Bitmaps as:

Array DIM2 (Word8, Word8, Word8)

Then we could use the original map function and there'd be no problem.

Note that using triples is just as efficient as using a DIM3 array. Repa uses unboxed Data.Vectors to store the manifest array elements, and this library will unpack a vector of triples into three separate vectors holding each of the elements. There are no intermediate tuple constructors or pointers in the underlying representation.

#23 fixed Add array update operator (//) Ben Lippmeier
Description

From SO:

(//) :: Shape sh => Array sh a -> [(sh,a)] -> Array sh a
(//) arr us = fromFunction (extent arr) (\sh -> case lookup sh us of
                                                 Just a  -> a
                                                 Nothing -> index arr sh)
#24 fixed Unneeded Elt constraint in type of traverse functions Ben Lippmeier
Description

traverse2 has an Elt constraint for the element type of the result array, but plain traverse doesn't.

1 2 3 4 5 6 7 8 9 10 11 12
Note: See TracQuery for help on using queries.