Work Efficient Higher-Order Vectorisation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Ben Lippmeier, Manuel Chakravarty, Gabriele Keller Roman Leschinskiy, Simon Peyton Jones This is a sequential reference implementation of the the nested array representation defined in the paper. A parallel production implementation is available in the dph-lifted-vseg and dph-prim-par packages of DPH 0.6.1. Primitive, flat unboxed arrays are provided by the 'vector' package (Data.Vector). A parallel implementation of our array representation would need a parallel version of the Data.Vector primitives. All the primitives we use are re-exported from the Data.Array.Unboxed and Data.Array.Vector modules in this distribution. Tested with GHC 7.0.4 and 7.4.1 You need the Leijen pretty printer package installed: $ cabal update $ cabal install wl-pprint Then load the examples: $ ghci Examples.hs Once in GHCi you can display the logical and physical views of an array like so: > logical arr5 ["AB", "CDE", "H"] > physical arr5 PArray 3 PNested VSegd segmap: [0,1,2] SSegd sources: [0,0,1] starts: [1,3,4] Segd lengths: [2,3,1] indices: [0,2,5] PChars 0: "XABCDE" 1: "FGXXHXXX" > physical (concat arr5) PArray 6 PChar ("ABCDEH") The Examples.hs file contains all the example arrays from the paper. The Vectorised/ directory contains derivations of the vectorised code for the 'retsum', 'retrieve' and 'furthest' examples. You can also run this from the main Examples.hs module. > logical $ retsum_v sec5_xss sec5_iss [[5,4,5], [20,21], [16]]