Opened 8 years ago

Closed 7 years ago

#33 closed defect (fixed)

Unboxing problems in example from Stack Overflow

Reported by: benl Owned by:
Priority: normal Milestone: 3.2.0
Component: library Version: 3.0.0
Keywords: Cc:

Description

import Data.Array.Repa

arr :: Array U DIM2 Int
arr = fromListUnboxed (Z :. 5 :. 5) [1..25]

combined :: Array U DIM2 Int
combined 
  = computeP $ traverse arr (\_ -> Z :. 4 :. 4 :: DIM2) 
  $ \f (Z :. x :. y) -> sumAllS $ extract f (x,y) (2,2)

extract :: (DIM2 -> Int) -> (Int,Int) -> (Int,Int) -> Array D DIM2 Int
extract lookup (x0,y0) (width,height) 
  = fromFunction bounds 
  $ \sh -> offset lookup sh
    where 
    bounds = Z :. width :. height
    offset :: (DIM2 -> Int) -> DIM2 -> Int
    offset f (Z :. x :. y) = f (Z :. x + x0 :. y + y0)

main = print combined

Change History (3)

comment:1 Changed 8 years ago by benl

  • Version changed from 2.1.0.1 to 3.0.0

comment:2 Changed 7 years ago by benl

  • Milestone changed from 3.0.0 to 3.2.0

comment:3 Changed 7 years ago by benl

  • Resolution set to fixed
  • Status changed from new to closed

Works fine if you deepSeqArray arr on entry to combined.

Note: See TracTickets for help on using tickets.