! FM      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                 ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S TUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~         ! " # $ % & ' ( ) * + , -./0123456789:;<=>?@ABCDEFGHIJKLq B[2017] Manuel M T Chakravarty, Gabriele Keller, Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)Safe MN H[2009..2017] Manuel M T Chakravarty, Gabriele Keller, Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)NoneD*O accelerate2Spawn an asynchronous action in a separate thread.P accelerateLike O , but using Q internally.R accelerateLike O , but using S internally.T accelerateRBlock the calling thread until the computation completes, then return the result.U accelerateaTest whether the asynchronous computation has already completed. If so, return the result, else .V accelerate*Cancel a running asynchronous computation.WOPRTUVc[2008..2017] Manuel M T Chakravarty, Gabriele Keller [2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)SafeST1 X accelerate8Conditional execution of a monadic debugging expression.?This does nothing unless the program is compiled in debug mode.Y accelerateThe opposite of X.?This does nothing unless the program is compiled in debug mode.$Z[\]^_`abcdefghijklmnopqrstXYuvwxyz{c[2008..2017] Manuel M T Chakravarty, Gabriele Keller [2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None4 |}~c[2008..2017] Manuel M T Chakravarty, Gabriele Keller [2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)SafeL accelerateShow a signed . value using SI unit prefixes. In the call to: showFFloatSIBase prec base valIf prec is . the value is shown to full precision, and if prec is  d, then at most d1 digits are shown after the decimal place. Here base represents the increment size between multiples of the original unit. For measures in base-10 this will be 1000 and for values in base-2 this is usually 1024, for example when measuring seconds versus bytes, respectively. accelerateThe  function outputs the message given as its second argument when the debug mode indicated by the first argument is enabled, before returning the third argument as its result. The message is prefixed with a time stamp. accelerateThe  function outputs the trace message together with a time stamp from the IO monad. This sequences the output with respect to other IO actions. accelerateThe  function behaves like p with the difference that the message is emitted to the eventlog, if eventlog profiling is enabled at runtime. accelerateBPrint a message prefixed with the current elapsed wall-clock time. accelerateThe f function emits a message to the eventlog, if eventlog profiling is available and enabled at runtime. Compared to , 7 sequences the event with respect to other IO actions.H[2016..2017] Manuel M T Chakravarty, Gabriele Keller, Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)SafeR accelerateMExecute an action and time the results. If GC stats have been enabled (with +RTS -tq for example) then timing and memory usage information is displayed, otherwise only timing information is shown.H[2009..2017] Manuel M T Chakravarty, Gabriele Keller, Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None"#] accelerateIssue an internal error message'$internalError :: String -> String -> a accelerateSThrow an error if the condition evaluates to False, otherwise evaluate the result.4$internalCheck :: String -> String -> Bool -> a -> a accelerateKThrow an error if the index is not in range, otherwise evaluate the result..$boundsCheck :: String -> Int -> Int -> a -> a accelerate<Print a warning message if the condition evaluates to False.6$internalWarning :: String -> String -> Bool -> a -> a [2008..2017] Manuel M T Chakravarty, Gabriele Keller [2009..2017] Trevor L. McDonell [2013..2017] Robert Clifton-Everest [2014..2014] Frederik M. MadsenBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None&';<=FNSTVl accelerateXGeneralised array index, which may index only in a subset of the dimensions of a shape. accelerateSlice representation7Class of slice representations (which are nested pairs) accelerateIndex representation7Class of index representations (which are nested pairs) accelerate1Project the shape of a slice from the full shape. accelerateYEnumerate all slices within a given bound. The innermost dimension changes most rapidly.See  for an example. accelerate.number of dimensions (>= 0); rank of the array accelerate-total number of elements in an array of this shape accelerate empty shape.`[2015..2017] Manuel M T Chakravarty, Gabriele Keller, Trevor L. McDonell, Robert Clifton-EverestBSD31Robert Clifton-Everest <robertce@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)NoneDN+ acceleratejA lifetime represents a value with attached finalizers. This is similar to the functionality provided by System.Mem.Weak-, but has the following stronger properties:FUnless explicitly forced, finalizers will not fire until after the K has become unreachable, where "reachability" is the same as defined in System.Mem.Weak7. That is to say, there is no issue with creating a U for a non-primitve type and finalizers firing while an object is still reachable.YFinalizers are fired sequentially in reverse of the order in which they were attached.&As the finalizers are attached to the l and not the underlying value, there is no danger in storing it UNPACKED as part of another structure. accelerateConstruct a new  from the given value. accelerate5This provides a way of looking at the value inside a 9. The supplied function is executed immediately and the L kept alive throughout its execution. It is important to not let the value leak= outside the function, either by returning it or by lazy IO. acceleratenEnsure that the lifetime is alive at the given place in a sequence of IO actions. Does not force the payload. accelerateAttaches a finalizer to a  . Like in System.Mem.Weak, there is no guarantee that the finalizers will eventually run. If they do run, they will be executed in the order in which they were supplied. acceleratefCauses any finalizers associated with the given lifetime to be run immediately on the calling thread.Because the finalizer is run on the calling thread. Care should be taken to ensure that the it does not try to acquire any locks the calling thread might already possess. This can result in deadlock and is in contrast to calling  on . accelerateCreate a weak pointer from a  to the supplied value.fBecause weak pointers have their own concept of finalizers, it is important to note these behaviours:Calling  causes the finalizers attached to the lifetime to be scheduled, and run in the correct order, but does not guarantee they will execute on the calling thread.If  deRefWeakP returns Nothing, there is no guarantee that the finalizers have already run. accelerateHRetrieve the value from a lifetime. This is unsafe because, unless the R is still reachable, the finalizers may fire, potentially invalidating the value. `[2016..2017] Manuel M T Chakravarty, Gabriele Keller, Trevor L. McDonell, Robert Clifton-EverestBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)NoneS accelerateA uniquely identifiable array.For the purposes of memory management, we use arrays as keys in a table. For this reason we need a way to uniquely identify each array we create. We do this by attaching a unique identifier to each array.Note: [Unique array strictness]nThe actual array data is in many cases unnecessary. For discrete memory backends such as for GPUs, we require the unique identifier to track the data in the remote memory space, but the data will in most cases never be copied back to the host. Thus, the array payload field is only lazily allocated, and we should be careful not to make this field overly strict. accelerateCreate a new UniqueArray accelerate,Access the pointer backing the unique array.The array data is kept alive at least during the whole action, even if it is not directly used inside. Note that it is not safe to return the pointer from the action and use it after the action completes. All uses of the pointer should be inside the bracketed function. accelerate-Extract the pointer backing the unique array.This is potentially unsafe, as if the argument is the last occurrence of this unique array then the finalisers will be run, potentially invalidating the plain pointer just obtained. See also: , . accelerateEnsure that the unique array is alive at the given place in a sequence of IO actions. Note that this does not force the actual array payload.See: [Unique array strictness]H[2015..2017] Manuel M T Chakravarty, Gabriele Keller, Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)Safe%0KH[2015..2017] Manuel M T Chakravarty, Gabriele Keller, Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)Safe"#[2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None1ST    c[2008..2018] Manuel M T Chakravarty, Gabriele Keller [2009..2018] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimental'non-portable (GHC extensions) /Scalar types supported in array computations/ Integral types: * Int * Int8 * Int16 * Int32 * Int64 * Word * Word8 * Word16 * Word32 * Word64 * CShort * CUShort * CInt * CUInt * CLong * CULong * CLLong * CULLong Floating types: * Half * Float * Double * CFloat * CDouble Non-numeric types: * Bool * Char * CChar * CSChar * CUChar SIMD vector types: * V2 * V3 * V4 * V8 * V16None&'+-1;=FST  accelerateAConstraint that values of these two types have the same bit widthi accelerateAll scalar types accelerateAll single value typesj accelerate Bounded typesk accelerate Numeric typesl accelerateNon-numeric typesm accelerateFloating typesn accelerateIntegral types accelerate+All scalar element types implement Eq & Ord accelerate'Bounded element types implement Bounded accelerate*Numeric element types implement Num & Real accelerate2Non-numeric types supported in array computations. accelerate5Floating-point types supported in array computations. accelerate/Integral types supported in array computations.{  123456789:;<=hgf !" #$%&i'(j)k*l+m,n-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`a[2008..2017] Manuel M T Chakravarty, Gabriele Keller [2009..2017] Trevor L. McDonell [2013..2017] Robert Clifton-EverestBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None &'+;=>?FTb accelerateHConversion between surface product types and our product representation.DWe parameterise our products by a constraint on their elements (the cst| argument). Every element in the product must obey this constraint, but the products themselves do necessarily not have to.c accelerateProduct reificationd accelerate(Type-safe projection indices for tuples.:NB: We index tuples by starting to count from the *right*! befghcijdkl H[2016..2017] Manuel M T Chakravarty, Gabriele Keller, Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)NoneDm accelerateA mutable atomic integern accelerateEDecrement the atomic value by the given amount. Return the old value.o accelerateBBitwise AND the atomic with the given value. Return the old value.p accelerate?Increase the atomic by the given amount. Returns the old value.q accelerate"Set the atomic to the given value.r accelerateGet the current value.msnopqr!H[2016..2017] Manuel M T Chakravarty, Gabriele Keller, Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None"#kt accelerateLaunch a monitoring server that will collect statistics on the running application. This should be called as soon as the application starts. The program will need to be run with the RTS option -T.u accelerateaInitialise and return the Accelerate monitoring store. To enable monitoring of your application: import Data.Array.Accelerate.Debug import System.Metrics import System.Remote.Monitoring main :: IO () main = do store <- initAccMetrics registerGcMetrics store -- optional server <- forkServerWith store "localhost" 8000 ...bNote that aside from the processor load metrics, counters are shared between all active backends.Registered rates: acc.load.llvm_nativeCurrent processor load (%) of the LLVM CPU backend. This only includes time spent executing Accelerate functions; compare this to the total processor load (e.g. via top) to estimate the productivity of the Accelerate program.acc.load.llvm_ptxCurrent processor load (%) of the GPU in the LLVM PTX backend. This only takes into account how much time the GPU spent executing Accelerate code, and does not consider the number of active cores during that time.Registered gauges: acc.gc.current_bytes_remoteMTotal number of bytes currently considered live in the remote address space.acc.gc.current_bytes_nurseryqTotal number of bytes allocated in the remote address space but not currently live (available for reallocation).Registered counters: acc.gc.bytes_allocated_local<Total number of bytes allocated in the local address space.acc.gc.bytes_allocated_remote=Total number of bytes allocated in the remote address space.acc.gc.bytes_copied_to_remotegTotal number of bytes copied from the host to the remote address space (e.g. from the CPU to the GPU).acc.gc.bytes_copied_from_remoteqTotal number of bytes copied from the remote address space back to the host (e.g. from the GPU back to the CPU). acc.gc.bytes_evicted_from_remoteTotal number of bytes evicted from the remote address space by the LRU memory manager, in order to make space for new allocations. A subset of acc.gc.bytes_copied_from_remote.acc.gc.num_gcsENumber of garbage collections of the remote address space performed.acc.gc.num_lru_evictCTotal number of evictions from the remote address space performed.v accelerateqExecute the given action and assign the elapsed wall-clock time as active time for the given processing element.w accelerate_Record the given number of seconds as active processing time for the given processing element.x accelerate7Allocated the number of bytes in the local memory spacey accelerate6Copied data between the local and remote memory spacesz accelerate/Performed a major GC of the remote memory space{ accelerateDPerformed an eviction of a remote array of the given number of bytes|}~tuvwxyz{"c[2008..2017] Manuel M T Chakravarty, Gabriele Keller [2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None&'01DFTV#~ accelerateGADT to reify the  class. accelerateMutable array representation accelerateImmutable array representation accelerate=Safe combination of creating and fast freezing of array data. accelerateRegister the given function as the callback to use to allocate new array data on the host containing the specified number of bytes. The returned array must be pinned (with respect to Haskell's GC), so that it can be passed to foreign code. acceleratedAllocate the given number of bytes with 16-byte alignment. This is essential for SIMD instructions.\Additionally, we return a plain ForeignPtr, which unlike a regular ForeignPtr created with  carries no finalisers. It is an error to try to add a finaliser to the plain ForeignPtr. For our purposes this is fine, since in Accelerate finalisers are handled using Lifetime_[2008..2017] Manuel M T Chakravarty, Gabriele Keller [2009..2017] Trevor L. McDonell [2013..2017] Robert Clifton-Everest [2014..2014] Frederik M. MadsenBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None&'+01;<=FNSTV3 accelerateGeneralised array division, like above but use for splitting an array into many subarrays, as opposed to extracting a single subarray.o accelerate$Slices, aka generalised indices, as nQ-tuples and mappings of slice indices to slices, co-slices, and slice dimensionst accelerate.Shapes and indices of multi-dimensional arrays accelerateNumber of dimensions of a shape or index (>= 0). accelerate2Total number of elements in an array of the given shape. accelerateEmpty shape. accelerate,Magic value identifying elements ignored in permute. accelerate$Yield the intersection of two shapes accelerateYield the union of two shapes acceleraterMap a multi-dimensional index into one in a linear, row-major representation of the array (first argument is the shape!, second argument is the index). accelerate Inverse of . accelerateIterate through the entire shape, applying the function; third argument combines results and fourth is returned in case of an empty iteration space; the index space is traversed in row-major order. accelerate Variant of  without an initial value accelerate)Convert a minpoint-maxpoint index into a shape. accelerate Convert a shape into a minpoint-maxpoint index. accelerate(Convert a shape to a list of dimensions. accelerate*Convert a list of dimensions into a shape. accelerate,The slice index for slice specifier 'Any sh' accelerateJThe slice index for specifying a slice with only the Z component projected accelerate/Segment descriptor (vector of segment lengths).fTo represent nested one-dimensional arrays, we use a flat array of data values in conjunction with a segment descriptor-, which stores the lengths of the subarrays. accelerate#Matrices are two-dimensional arrays accelerate"Vectors are one-dimensional arrays accelerate#Scalar arrays hold a single element accelerate)Dense, regular, multi-dimensional arrays.The  is the core computational unit of Accelerate; all programs in Accelerate take zero or more arrays as input and produce one or more arrays as output. The  type has two type parameters:shu: is the shape of the array, tracking the dimensionality and extent of each dimension of the array; for example, } for one-dimensional s, |) for two-dimensional matrices, and so on.eE: represents the type of each element of the array; for example,  ,   , et cetera.Array data is store unboxed in an unzipped struct-of-array representation. Elements are laid out in row-major order (the right-most index of a tQ is the fastest varying). The allowable array element types are members of the " class, which roughly consists of:;Signed and unsigned integers (8, 16, 32, and 64-bits wide).4Floating point numbers (single and double precision)  ()Shapes formed from  and ()@Nested tuples of all of these, currently up to 15-elements wide. Note that j itself is not an allowable element type---there are no nested arrays in Accelerate, regular arrays only!If device and host memory are separate, arrays will be transferred to the device when necessary (possibly asynchronously and in parallel with other tasks) and cached on the device if sufficient memory is available. Arrays are made available to embedded language computations via #.PSection "Getting data in" lists functions for getting data into and out of the  type. accelerateTuple reification accelerate.Tuples of Arrays. Note that this carries the ! class constraint rather than " in the case of tuples of scalars. accelerateAWe represent tuples as heterogeneous lists, typed by a type list. accelerateEThe tuple representation is equivalent to the product representation. accelerate) consists of nested tuples of individual cs, currently up to 15-elements wide. Accelerate computations can thereby return multiple results. accelerateThe  class characterises the allowable array element types, and hence the types which can appear in scalar Accelerate expressions.Accelerate arrays consist of simple atomic types as well as nested tuples thereof, stored efficiently in memory as consecutive unpacked elements without pointers. It roughly consists of::Signed and unsigned integers (8, 16, 32, and 64-bits wide);Floating point numbers (half, single, and double precision)  ()Shapes formed from  and ()?Nested tuples of all of these, currently up to 15-elements wideAdding new instances for ~ consists of explaining to Accelerate how to map between your data type and a (tuple of) primitive values. For examples see:"Data.Array.Accelerate.Data.Complex!Data.Array.Accelerate.Data.Monoid 5https://hackage.haskell.org/package/linear-acceleratelinear-accelerate 5https://hackage.haskell.org/package/colour-acceleratecolour-accelerate accelerateType representation mappingWe represent tuples by using '()' and '(,)' as type-level nil and snoc to construct snoc-lists of types, and are flattened all the way down to primitive types. acceleratewMarker for arbitrary shapes in slices descriptors, where it is desired to split along an unknown number of dimensions.*For example, in the following definition, P matches against any shape and flattens everything but the innermost dimension. ivectors :: (Shape sh, Elt e) => Acc (Array (sh:.Int) e) -> Seq [Vector e] vectors = toSeq (Divide :. All) accelerateGMarker for splitting along an entire dimension in division descriptors.;For example, when used in a division descriptor passed to $, a n indicates that the array should be divided along this dimension forming the elements of the output sequence. accelerate#Marker for arbitrary dimensions in %& and %' descriptors.< can be used in the leftmost position of a slice instead of E, indicating that any dimensionality is admissible in that position.See %& and %' for examples. accelerate Marker for entire dimensions in %& and %' descriptors.Occurrences of Z indicate the dimensions into which the array's existing extent will be placed unchanged.See %& and %' for examples. accelerate.Increase an index rank by one dimension. The 7 operator is used to construct both values and types. accelerate Rank-0 index accelerateConvenience functions accelerateYield an array's shape accelerate@Change the shape of an array without altering its contents. The 4 of the source and result arrays must be identical. accelerateArray indexing accelerateVCreate an array from its representation function, applied at each index of the array. accelerate?Create an array using a monadic function applied at each index. accelerateDCreate a vector from the concatenation of the given list of vectors. accelerate.Creates a new, uninitialized Accelerate array. accelerate.Convert elements of a list into an Accelerate .*This will generate a new multidimensional y of the specified shape and extent by consuming elements from the list and adding them to the array in row-major order.$fromList (Z:.10) [0..] :: Vector Int&Vector (Z :. 10) [0,1,2,3,4,5,6,7,8,9]PNote that we pull elements off the list lazily, so infinite lists are accepted:.fromList (Z:.5:.10) (repeat 0) :: Matrix FloatMatrix (Z :. 5 :. 10)5 [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,5 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,5 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,5 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,5 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]You can also make use of the OverloadedLists6 extension to produce one-dimensional vectors from a finite list.[0..9] :: Vector Int&Vector (Z :. 10) [0,1,2,3,4,5,6,7,8,9]Note that this requires first traversing the list to determine its length, and then traversing it a second time to collect the elements into the array, thus forcing the spine of the list to be manifest on the heap. accelerateConvert an accelerated  to a list in row-major order. accelerate!Nicely format a shape as a string accelerate1Project the shape of a slice from the full shape. accelerateYEnumerate all slices within a given bound. The innermost dimension changes most rapidly.Example: let slix = sliceIndex (undefined :: Z :. Int :. Int :. All) sh = Z :. 2 :. 3 :. 1 :: DIM3 in enumSlices slix sh :: [ Z :. Int :. Int :. All ]  accelerateOrphansk  opqrstuvwxyz{|}~   !"#$%&'()*+,-./01339 19 (`[2012..2017] Manuel M T Chakravarty, Gabriele Keller, Trevor L. McDonell, Robert Clifton-EverestBSD31Robert Clifton-Everest <robertce@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None&'+1>?FQTVZ23456789:;<=>?@){[2015..2017] Manuel M T Chakravarty, Gabriele Keller, Robert Clifton-Everest [2016..2017] Trevor L. McDonellBSD31Robert Clifton-Everest <robertce@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None+FTz A accelerateAccelerate backends can provide an instance of this class in order to take advantage of the automated memory managers we provide as part of the base package.B accelerate,Pointers into this particular remote memory.C acceleratefAttempt to allocate the given number of bytes in the remote memory space. Returns Nothing on failure.D accelerateICopy the given number of elements from the host array into remote memory.E accelerateGCopy the given number of elements from remote memory to the host array.F accelerateCast a remote pointer.G accelerate3Returns the total remote memory available in bytes.H accelerate/Returns, in bytes, the available remote memory.I accelerate"The chunk allocation size (bytes).J accelerate/Matches array element types to primitive types. ABCDEFGHIJ*[2008..2017] Manuel M T Chakravarty, Gabriele Keller [2009..2017] Trevor L. McDonell [2010..2011] Ben Lever [2013..2017] Robert Clifton-Everest [2014..2014] Frederik M. MadsenBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None&'01;<=>?FQSTVK acceleratePrimitive scalar operationsL acceleratePrimitive constant valuesM accelerateParametrised open expressions using de Bruijn indices for variables ranging over tuples of scalars and arrays of tuples. All code, except Cond, is evaluated eagerly. N-tuples are represented as nested pairs.SThe data type is parametrised over the surface types (not the representation type).N accelerate0Vanilla expression without free scalar variablesO accelerate5Parametrised expression without free scalar variablesP accelerateVanilla open expressionQ accelerate.Vanilla function without free scalar variablesR accelerate3Parametrised function without free scalar variablesS accelerate!Vanilla open function abstractionT accelerate&Parametrised open function abstractionU accelerateGADT reifying the V classV accelerateOperations on stencilsW accelerate7Boundary condition specification for stencil operationsX accelerate"Vanilla stencil boundary conditionY acceleratedCollective array computations parametrised over array variables represented with de Bruijn indices.Scalar functions and expressions embedded in well-formed array computations cannot contain free scalar variable indices. The latter cannot be bound in array computations, and hence, cannot appear in any well-formed program.The let-form is used to represent the sharing discovered by common subexpression elimination as well as to control evaluation order. (We need to hoist array expressions out of scalar expressions - they occur in scalar indexing and in determining an arrays shape.)UThe data type is parameterised over the surface types (not the representation type).|We use a non-recursive variant parametrised over the recursive closure, to facilitate attribute calculation in the backend.Z accelerate,Closed array expression aka an array program[ accelerate?Vanilla array-computation function without free array variables\ accelerateDParametrised array-computation function without free array variables] accelerate9Function abstraction over parametrised array computations^_K`abcdefghijklmnopqrstuvwxyz{|}~LMNOPQRSTUVWXYZ[\]     +H[2012..2017] Manuel M T Chakravarty, Gabriele Keller, Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None &'+;=FQSTV accelerateOReplace the first variable with the given expression. The environment shrinks. accelerateReplace an expression that uses the top environment variable with another. The result of the first is let bound into the second. accelerateComposition of unary functions. !"#$%&'()*  ,H[2012..2017] Manuel M T Chakravarty, Gabriele Keller, Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None&'V+,-[2008..2017] Manuel M T Chakravarty, Gabriele Keller [2009..2017] Trevor L. McDonell [2013..2017] Robert Clifton-Everest [2014..2014] Frederik M. MadsenBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None&'01;<=>?FSTV accelerate7Boundary condition specification for stencil operations- accelerateScalar expressions to parametrise collective array operations, themselves parameterised over the type of collective array operations. accelerate The type R represents embedded scalar expressions. The collective operations of Accelerate ? consist of many scalar expressions executed in data-parallel.^Note that scalar expressions can not initiate new collective operations: doing so introduces nested data parallelismv, which is difficult to execute efficiently on constrained hardware such as GPUs, and is thus currently unsupported.. accelerate=Array-valued collective computations without a recursive knot accelerateAccelerate is an embedded languageV that distinguishes between vanilla arrays (e.g. in Haskell memory on the CPU) and embedded arrays (e.g. in device memory on a GPU), as well as the computations on both of these. Since Accelerate is an embedded language, programs written in Accelerate are not compiled by the Haskell compiler (GHC). Rather, each Accelerate backend is a runtime compilerX which generates and executes parallel SIMD code of the target language at application runtime.The type constructor B represents embedded collective array operations. A term of type Acc aN is an Accelerate program which, once executed, will produce a value of type a (an  or a tuple of "). Collective operations of type Acc a comprise many scalar expressions, wrapped in type constructor , which will be executed in parallel. Although collective operations comprise many scalar operations executed in parallel, scalar operations cannotW initiate new collective operations: this stratification between scalar operations in  and array operations in  helps statically exclude nested data parallelismR, which is difficult to execute efficiently on constrained hardware such as GPUs. A simple exampleBAs a simple example, to compute a vector dot product we can write: dotp :: Num a => Vector a -> Vector a -> Acc (Scalar a) dotp xs ys = let xs' = use xs ys' = use ys in fold (+) 0 ( zipWith (*) xs' ys' ) The function dotp& consumes two one-dimensional arrays (&s) of values, and produces a single (?) result as output. As the return type is wrapped in the type V, we see that it is an embedded Accelerate computation - it will be evaluated in the objectC language of dynamically generated parallel code, rather than the meta language of vanilla Haskell.As the arguments to dotpo are plain Haskell arrays, to make these available to Accelerate computations they must be embedded with the %# function.An Accelerate backend is used to evaluate the embedded computation and return the result back to vanilla Haskell. Calling the run function of a backend will generate code for the target architecture, compile, and execute it. For example, the following backends are available: 9http://hackage.haskell.org/package/accelerate-llvm-nativeaccelerate-llvm-native!: for execution on multicore CPUs 6http://hackage.haskell.org/package/accelerate-llvm-ptxaccelerate-llvm-ptx+: for execution on NVIDIA CUDA-capable GPUs See also , which encapsulates embedded scalar computations. Avoiding nested parallelism9As mentioned above, embedded scalar computations of type 1 can not initiate further collective operations.&Suppose we wanted to extend our above dotpE function to matrix-vector multiplication. First, let's rewrite our dotp function to take 4 arrays as input (which is typically what we want): qdotp :: Num a => Acc (Vector a) -> Acc (Vector a) -> Acc (Scalar a) dotp xs ys = fold (+) 0 ( zipWith (*) xs ys ){We might then be inclined to lift our dot-product program to the following (incorrect) matrix-vector product, by applying dotp" to each row of the input matrix: mvm_ndp :: Num a => Acc (Matrix a) -> Acc (Vector a) -> Acc (Vector a) mvm_ndp mat vec = let Z :. rows :. cols = unlift (shape mat) :: Z :. Exp Int :. Exp Int in generate (index1 rows) (\row -> the $ dotp vec (slice mat (lift (row :. All)))) Here, we use .M to create a one-dimensional vector by applying at each index a function to & out the corresponding row of the matrix to pass to the dotp function. However, since both . and &2 are data-parallel operations, and moreover that &  depends on the argument row given to it by the . function, this definition requires nested data-parallelism, and is thus not permitted. The clue that this definition is invalid is that in order to create a program which will be accepted by the type checker, we must use the function / to retrieve the result of the dotp) operation, effectively concealing that dotpK is a collective array computation in order to match the type expected by ., which is that of scalar expressions. Additionally, since we have fooled the type-checker, this problem will only be discovered at program runtime._In order to avoid this problem, we can make use of the fact that operations in Accelerate are rank polymorphic. The 0 operation reduces along the innermost dimension of an array of arbitrary rank, reducing the rank (dimensionality) of the array by one. Thus, we can ' the input vector to as many rowsj there are in the input matrix, and perform the dot-product of the vector with every row simultaneously:  mvm :: A.Num a => Acc (Matrix a) -> Acc (Vector a) -> Acc (Vector a) mvm mat vec = let Z :. rows :. cols = unlift (shape mat) :: Z :. Exp Int :. Exp Int vec' = A.replicate (lift (Z :. rows :. All)) vec in A.fold (+) 0 ( A.zipWith (*) mat vec' )-Note that the intermediate, replicated array vec' is never actually created in memory; it will be fused directly into the operation which consumes it. We discuss fusion next. FusionArray computations of type  will be subject to  array fusion&; Accelerate will combine individual  computations into a single computation, which reduces the number of traversals over the input data and thus improves performance. As such, it is often useful to have some intuition on when fusion should occur.IThe main idea is to first partition array operations into two categories: !Element-wise operations, such as 1, . , and 2U. Each element of these operations can be computed independently of all others.Collective operations such as 0, 3, and 4|. To compute each output element of these operations requires reading multiple elements from the input array(s).Element-wise operations fuse together whenever the consumer operation uses a single element of the input array. Element-wise operations can both fuse their inputs into themselves, as well be fused into later operations. Both these examples should fuse into a single loop: images/fusion_example_1.png images/fusion_example_2.pngYIf the consumer operation uses more than one element of the input array (typically, via . indexing an array multiple times), then the input array will be completely evaluated first; no fusion occurs in this case, because fusing the first operation into the second implies duplicating work.On the other hand, collective operations can fuse their input arrays into themselves, but on output always evaluate to an array; collective operations will not be fused into a later step. For example: images/fusion_example_3.png Here the element-wise sequence (# + . + 5L) will fuse into a single operation, which then fuses into the collective 0. operation. At this point in the program the 0/ must now be evaluated. In the final step the 1! reads in the array produced by 0%. As there is no fusion between the 0 and 1; steps, this program consists of two "loops"; one for the # + . + 5 + 0 step, and one for the final 1 step.JYou can see how many operations will be executed in the fused program by / -ing the + program, or by using the debugging option  -ddump-dot- to save the program as a graphviz DOT file."As a special note, the operations 6 and 7x, when applied to a real array, are executed in constant time, so in this situation these operations will not be fused. TipsSince  represents embedded computations that will only be executed when evaluated by a backend, we can programatically generate these computations using the meta language Haskell; for example, unrolling loops or embedding input values into the generated code.<It is usually best to keep all intermediate computations in , and only run the computation at the very end to produce the final result. This enables optimisations between intermediate results (e.g. array fusion) and, if the target architecture has a separate memory space, as is the case of GPUs, to prevent excessive data transfers. acceleratekScalar expression inlet: make a Haskell value available for processing in an Accelerate scalar expression.?Note that this embeds the value directly into the expression. Depending on the backend used to execute the computation, this might not always be desirable. For example, a backend that does external code generation may embed this constant directly into the generated code, which means new code will need to be generated and compiled every time the value changes. In such cases, consider instead lifting scalar values into (singleton) arrays so that they can be passed as an input to the computation and thus the value can change without the need to generate fresh code. accelerate can be used anywhere a constant is expected, and indicates that the consumer of the value can receive an unspecified bit pattern.This is useful because a store of an undefined value can be assumed to not have any effect; we can assume that the value is overwritten with bits that happen to match what was already there. However, a store tox an undefined location could clobber arbitrary memory, therefore, its use in such a context would introduce undefined  behaviour.>There are (at least) two cases where you may want to use this: The %8 function requires an array of default values, into which the new values are combined. However, if you are sure the default values are not used, and will (eventually) be completely overwritten, then 9:King an array with this value will give you a new uninitialised array.;In the definition of sum data types. See for example  Data.Array.Accelerate.Data.Maybe and !Data.Array.Accelerate.Data.Either.012345678-9:;<=>?@ABCDEFGHIJKLMNOPQ.RSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~0000H[2009..2018] Manuel M T Chakravarty, Gabriele Keller, Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None accelerate The function  allows you to convert a value between any two types whose underlying representations have the same bit size at each component. For example: ncoerce (x :: Exp Double) :: Exp Word64 coerce (x :: Exp (Int64,Float)) :: Exp (Complex Float, Word32)CFurthermore, as we typically declare newtype wrappers similarly to: /type instance EltRepr (Sum a) = ((), EltRepr a)This can be used instead of the newtype constructor, to go from the newtype's abstract type to the concrete type by dropping the extra ()* from the representation, and vice-versa.]You will get a runtime error if it fails to find a coercion between the two representations.;H[2016..2017] Manuel M T Chakravarty, Gabriele Keller, Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None ;<=>?FSTLJ  accelerateDA limited subset of types which can be lifted, can also be unlifted. accelerateUnlift the outermost constructor through the surface type. This is only possible if the constructor is fully determined by its type - i.e., it is a singleton. accelerateThe class of types e which can be lifted into c. acceleratejAn associated-type (i.e. a type-level function) that strips all instances of surface type constructors c from the input type e.For example, the tuple types (Exp Int, Int) and (Int, Exp Int)V have the same "Plain" representation. That is, the following type equality holds: 7Plain (Exp Int, Int) ~ (Int,Int) ~ Plain (Int, Exp Int) accelerate)Lift the given value into a surface type c --- either  for scalar expressions or J for array computations. The value may already contain subexpressions in c. accelerateLift a unary function into . accelerateLift a binary function into . accelerateLift a ternary function into . accelerate;Lift a unary function to a computation over rank-1 indices. accelerate<Lift a binary function to a computation over rank-1 indices. accelerate=Lift a ternary function to a computation over rank-1 indices. [2018] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None*8 accelerateThe H class is used for scalar types which can be mapped over. Instances of # should satisfy the following laws: 2fmap id == id fmap (f . g) == fmap f . fmap g accelerateSReplace all locations in the input with the same value. The default definition is  fmap . const<, but this may be overridden with a more efficient version. accelerateAn infix synonym for ,The name of this operator is an allusion to <=-. Note the similarities between their types: } ($) :: (Exp a -> Exp b) -> Exp a -> Exp b (<$>) :: Functor f => (Exp a -> Exp b) -> Exp (f a) -> Exp (f b)Whereas <= is function application, ( is function application lifted over a . accelerateA flipped version of '(<$)'. accelerate value. discards or ignores the result of evaluation.444>H[2016..2017] Manuel M T Chakravarty, Gabriele Keller, Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None+;<= accelerateBasic numeric class accelerateConversion from an .>An integer literal represents the application of the function # to the appropriate value of type K. We export this specialised version where the return type is fixed to an D term in order to improve type checking in Accelerate modules when RebindableSyntax is enabled.\]^_?H[2016..2017] Manuel M T Chakravarty, Gabriele Keller, Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None+;<= accelerate,Fractional numbers, supporting real division accelerateConversion from a .JA floating point literal representations the application of the function  to a value of type K. We export this specialised version where the return type is fixed to an D term in order to improve type checking in Accelerate modules when RebindableSyntax is enabled.VW@H[2016..2017] Manuel M T Chakravarty, Gabriele Keller, Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None+;<= accelerate<Trigonometric and hyperbolic functions and related functionsJKMLN>?@ABCDEFGHIOAH[2016..2017] Manuel M T Chakravarty, Gabriele Keller, Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None +;<=>?p accelerate(Accelerate lacks an arbitrary-precision <B type, which the standard <C uses as an intermediate value when coercing to floating-point types. Instead, we use this class to capture a direct coercion between to types. accelerate"General coercion to floating typesDH[2016..2017] Manuel M T Chakravarty, Gabriele Keller, Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None;<=$ accelerateThe  class defines equality  and inequality $ for scalar Accelerate expressions.For convenience, we include  as a superclass. accelerateConjunction: True if both arguments are true. This is a short-circuit operator, so the second argument will be evaluated only if the first is true. accelerateDisjunction: True if either argument is true. This is a short-circuit operator, so the second argument will be evaluated only if the first is false. accelerateLogical negation4432EH[2016..2017] Manuel M T Chakravarty, Gabriele Keller, Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None*;<=FTk accelerateThe $ class for totally ordered datatypes  !"4444FH[2016..2017] Manuel M T Chakravarty, Gabriele Keller, Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None+;<=GH[2016..2017] Manuel M T Chakravarty, Gabriele Keller, Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None+;<= accelerate#Extracting components of fractions. accelerate truncate x returns the integer nearest x between zero and x accelerate x returns the nearest integer to x; the even integer if x% is equidistant between two integers accelerate x) returns the least integer not less than x accelerate x/ returns the greatest integer not greater than x accelerateGeneralisation of S to any instance of  accelerateGeneralisation of R to any instance of  accelerateGeneralisation of P to any instance of  HH[2016..2017] Manuel M T Chakravarty, Gabriele Keller, Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None+;<= accelerate*Operations over sequentially ordered typesZ[IH[2016..2017] Manuel M T Chakravarty, Gabriele Keller, Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None+;<= accelerate.Integral numbers, supporting integral divisionPQRSTU%[2008..2017] Manuel M T Chakravarty, Gabriele Keller [2009..2017] Trevor L. McDonell [2014..2014] Frederik M. MadsenBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None %+<FSTV8 accelerateeMake an array from vanilla Haskell available for processing within embedded Accelerate computations.PDepending upon which backend is used to eventually execute array computations, * may entail data transfer (e.g. to a GPU)./ is overloaded so that it can accept tuples of :.let vec = fromList (Z:.10) [0..] :: Vector Intvec&Vector (Z :. 10) [0,1,2,3,4,5,6,7,8,9]1let mat = fromList (Z:.5:.10) [0..] :: Matrix IntmatMatrix (Z :. 5 :. 10)+ [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,+ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49].let vec' = use vec :: Acc (Vector Int).let mat' = use mat :: Acc (Matrix Int):let tup = use (vec, mat) :: Acc (Vector Int, Matrix Int) accelerate[Construct a singleton (one element) array from a scalar value (or tuple of scalar values). accelerateFReplicate an array across one or more dimensions as specified by the  generalised, array index provided as the first argument.(For example, given the following vector:.let vec = fromList (Z:.10) [0..] :: Vector Intvec&Vector (Z :. 10) [0,1,2,3,4,5,6,7,8,9]u...we can replicate these elements to form a two-dimensional array either by replicating those elements as new rows:;run $ replicate (constant (Z :. (4::Int) :. All)) (use vec)Matrix (Z :. 4 :. 10)! [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,! 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,! 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,! 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]...or as columns:7run $ replicate (lift (Z :. All :. (4::Int))) (use vec) Matrix (Z :. 10 :. 4) [ 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9]Replication along more than one dimension is also possible. Here we replicate twice across the first dimension and three times across the third dimension:Grun $ replicate (constant (Z :. (2::Int) :. All :. (3::Int))) (use vec)Array (Z :. 2 :. 10 :. 3) [0,0,0,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7,8,8,8,9,9,9,0,0,0,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7,8,8,8,9,9,9] The marker f can be used in the slice specification to match against some arbitrary dimension. For example, here / matches against whatever shape type variable sh takes.:{[ let rep0 :: (Shape sh, Elt e) => Exp Int -> Acc (Array sh e) -> Acc (Array (sh :. Int) e). rep0 n a = replicate (lift (Any :. n)) a:}#let x = unit 42 :: Acc (Scalar Int)run $ rep0 10 x0Vector (Z :. 10) [42,42,42,42,42,42,42,42,42,42]run $ rep0 5 (use vec) Matrix (Z :. 10 :. 5) [ 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9] Of course,  and  can be used together.:{k let rep1 :: (Shape sh, Elt e) => Exp Int -> Acc (Array (sh :. Int) e) -> Acc (Array (sh :. Int :. Int) e)5 rep1 n a = replicate (lift (Any :. n :. All)) a:}run $ rep1 5 (use vec)Matrix (Z :. 5 :. 10)! [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,! 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,! 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,! 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,! 0, 1, 2, 3, 4, 5, 6, 7, 8, 9] accelerate;Construct a new array by applying a function to each index.CFor example, the following will generate a one-dimensional array (") of three floating point numbers:5run $ generate (index1 3) (\_ -> 1.2) :: Vector FloatVector (Z :. 3) [1.2,1.2,1.2]Or equivalently:2run $ fill (constant (Z :. 3)) 1.2 :: Vector FloatVector (Z :. 3) [1.2,1.2,1.2]5The following will create a vector with the elements [1..10]:Arun $ generate (index1 10) (\ix -> unindex1 ix + 1) :: Vector Int'Vector (Z :. 10) [1,2,3,4,5,6,7,8,9,10] NOTE:Using ], it is possible to introduce nested data parallelism, which will cause the program to fail.yIf the index given by the scalar function is then used to dispatch further parallel work, whose result is returned into . terms by array indexing operations such as () or 9/*, the program will fail with the error: p./Data/Array/Accelerate/Trafo/Sharing.hs:447 (convertSharingExp): inconsistent valuation @ shared 'Exp' tree .... accelerate@Change the shape of an array without altering its contents. The 4 of the source and result arrays must be identical. +precondition: shapeSize sh == shapeSize sh'-If the argument array is manifest in memory, J is a no-op. If the argument is to be fused into a subsequent operation, ; corresponds to an index transformation in the fused code. accelerateIndex an array with a  generalised array index, supplied as the second argument. The result is a new array (possibly a singleton) containing the selected dimensions (s) in their entirety. is the opposite of , and can be used to cut out@ entire dimensions. For example, for the two dimensional array mat:1let mat = fromList (Z:.5:.10) [0..] :: Matrix IntmatMatrix (Z :. 5 :. 10)+ [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,+ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49]...will can select a specific row to yield a one dimensional result by fixing the row index (2) while allowing the column index to vary (via ):7run $ slice (use mat) (constant (Z :. (2::Int) :. All))0Vector (Z :. 10) [20,21,22,23,24,25,26,27,28,29]!A fully specified index (with no 6s) returns a single element (zero dimensional array).6run $ slice (use mat) (constant (Z :. 4 :. 2 :: DIM2)) Scalar Z [42] The marker a can be used in the slice specification to match against some arbitrary (lower) dimension. Here ' matches whatever shape type variable sh takes::{ letX sl0 :: (Shape sh, Elt e) => Acc (Array (sh:.Int) e) -> Exp Int -> Acc (Array sh e)) sl0 a n = slice a (lift (Any :. n)):}.let vec = fromList (Z:.10) [0..] :: Vector Intrun $ sl0 (use vec) 4 Scalar Z [4]run $ sl0 (use mat) 4Vector (Z :. 5) [4,14,24,34,44] Of course,  and  can be used together.:{d let sl1 :: (Shape sh, Elt e) => Acc (Array (sh:.Int:.Int) e) -> Exp Int -> Acc (Array (sh:.Int) e)0 sl1 a n = slice a (lift (Any :. n :. All)):}run $ sl1 (use mat) 40Vector (Z :. 10) [40,41,42,43,44,45,46,47,48,49]8let cube = fromList (Z:.3:.4:.5) [0..] :: Array DIM3 IntcubeArray (Z :. 3 :. 4 :. 5) [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59]run $ sl1 (use cube) 2Matrix (Z :. 3 :. 5) [ 10, 11, 12, 13, 14, 30, 31, 32, 33, 34, 50, 51, 52, 53, 54] accelerateJApply the given function element-wise to an array. Denotationally we have: /map f [x1, x2, ... xn] = [f x1, f x2, ... f xn]-let xs = fromList (Z:.10) [0..] :: Vector Intxs&Vector (Z :. 10) [0,1,2,3,4,5,6,7,8,9]run $ map (+1) (use xs)'Vector (Z :. 10) [1,2,3,4,5,6,7,8,9,10] accelerateApply the given binary function element-wise to the two arrays. The extent of the resulting array is the intersection of the extents of the two source arrays./let xs = fromList (Z:.3:.5) [0..] :: Matrix IntxsMatrix (Z :. 3 :. 5) [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]0let ys = fromList (Z:.5:.10) [1..] :: Matrix IntysMatrix (Z :. 5 :. 10)+ [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,+ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,+ 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,+ 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,+ 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]#run $ zipWith (+) (use xs) (use ys)Matrix (Z :. 3 :. 5) [ 1, 3, 5, 7, 9, 16, 18, 20, 22, 24, 31, 33, 35, 37, 39] accelerateCReduction of the innermost dimension of an array of arbitrary rank.+The shape of the result obeys the property: +shape (fold f z xs) == indexTail (shape xs)"The first argument needs to be an  associative function to enable an efficient parallel implementation. The initial element does not need to be an identity element of the combination function.1let mat = fromList (Z:.5:.10) [0..] :: Matrix IntmatMatrix (Z :. 5 :. 10)+ [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,+ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49]run $ fold (+) 42 (use mat)$Vector (Z :. 5) [87,187,287,387,487]Reductions with non-commutative operators are supported. For example, the following computes the maximum segment sum problem along each innermost dimension of the array. 6https://en.wikipedia.org/wiki/Maximum_subarray_problem:{ let maximumSegmentSum2 :: forall sh e. (Shape sh, Num e, Ord e)& => Acc (Array (sh :. Int) e) -> Acc (Array sh e) maximumSegmentSumS = map (\v -> let (x,_,_,_) = unlift v :: (Exp e, Exp e, Exp e, Exp e) in x) . fold1 f . map g whereP f :: (Num a, Ord a) => Exp (a,a,a,a) -> Exp (a,a,a,a) -> Exp (a,a,a,a) f x y =2 let (mssx, misx, mcsx, tsx) = unlift x2 (mssy, misy, mcsy, tsy) = unlift y in6 lift ( mssx `max` (mssy `max` (mcsx+misy))( , misx `max` (tsx+misy)( , mcsy `max` (mcsx+tsy) , tsx+tsy ) --7 g :: (Num a, Ord a) => Exp a -> Exp (a,a,a,a) g x = let y = max x 0" in lift (y,y,y,x):}Blet vec = fromList (Z:.10) [-2,1,-3,4,-1,2,1,-5,4,0] :: Vector Int!run $ maximumSegmentSum (use vec) Scalar Z [6] See also  JQ, which can be a useful way to compute multiple results from a single reduction. accelerate Variant of g that requires the innermost dimension of the array to be non-empty and doesn't need an default value.+The shape of the result obeys the property: +shape (fold f z xs) == indexTail (shape xs)"The first argument needs to be an  associative_ function to enable an efficient parallel implementation, but does not need to be commutative. accelerate%Segmented reduction along the innermost dimension of an array. The segment descriptor specifies the lengths of the logical sub-arrays, each of which is reduced independently. The innermost dimension must contain at least as many elements as required by the segment descriptor (sum thereof).3let seg = fromList (Z:.4) [1,4,0,3] :: Segments IntsegVector (Z :. 4) [1,4,0,3]1let mat = fromList (Z:.5:.10) [0..] :: Matrix IntmatMatrix (Z :. 5 :. 10)+ [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,+ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49]'run $ foldSeg (+) 0 (use mat) (use seg)Matrix (Z :. 5 :. 4) [ 0, 10, 0, 18, 10, 50, 0, 48, 20, 90, 0, 78, 30, 130, 0, 108, 40, 170, 0, 138] accelerate Variant of  that requires all segments of the reduced array to be non-empty and doesn't need a default value. The segment descriptor specifies the length of each of the logical sub-arrays. accelerateData.List style left-to-right scan along the innermost dimension of an arbitrary rank array. The first argument needs to be an  associativen function to enable efficient parallel implementation. The initial value (second argument) may be arbitrary.0let vec = fromList (Z :. 10) [0..] :: Vector Intrun $ scanl (+) 10 (use vec)3Vector (Z :. 11) [10,10,11,13,16,20,25,31,38,46,55]5let mat = fromList (Z :. 4 :. 10) [0..] :: Matrix Intrun $ scanl (+) 0 (use mat)Matrix (Z :. 4 :. 11)5 [ 0, 0, 1, 3, 6, 10, 15, 21, 28, 36, 45,5 0, 10, 21, 33, 46, 60, 75, 91, 108, 126, 145,5 0, 20, 41, 63, 86, 110, 135, 161, 188, 216, 245,5 0, 30, 61, 93, 126, 160, 195, 231, 268, 306, 345] accelerate Variant of w, where the last element (final reduction result) along each dimension is returned separately. Denotationally we have: _scanl' f e arr = (init res, unit (res!len)) where len = shape arr res = scanl f e arr4let vec = fromList (Z:.10) [0..] :: Vector Int,let (res,sum) = run $ scanl' (+) 0 (use vec)res+Vector (Z :. 10) [0,0,1,3,6,10,15,21,28,36]sum Scalar Z [45]8let mat = fromList (Z:.4:.10) [0..] :: Matrix Int-let (res,sums) = run $ scanl' (+) 0 (use mat)resMatrix (Z :. 4 :. 10)0 [ 0, 0, 1, 3, 6, 10, 15, 21, 28, 36,0 0, 10, 21, 33, 46, 60, 75, 91, 108, 126,0 0, 20, 41, 63, 86, 110, 135, 161, 188, 216,0 0, 30, 61, 93, 126, 160, 195, 231, 268, 306]sums Vector (Z :. 4) [45,145,245,345] accelerateData.List style left-to-right scan along the innermost dimension without an initial value (aka inclusive scan). The innermost dimension of the array must not be empty. The first argument must be an  associative function.1let mat = fromList (Z:.4:.10) [0..] :: Matrix Intrun $ scanl1 (+) (use mat)Matrix (Z :. 4 :. 10)2 [ 0, 1, 3, 6, 10, 15, 21, 28, 36, 45,2 10, 21, 33, 46, 60, 75, 91, 108, 126, 145,2 20, 41, 63, 86, 110, 135, 161, 188, 216, 245,2 30, 61, 93, 126, 160, 195, 231, 268, 306, 345] accelerateRight-to-left variant of . accelerateRight-to-left variant of . accelerateRight-to-left variant of . accelerate:Generalised forward permutation operation (array scatter).0Forward permutation specified by a function mapping indices from the source array to indices in the result array. The result array is initialised with the given defaults and any further values that are permuted into the result array are added to the current value using the given combination function.!The combination function must be  associative and  commutative/. Elements that are mapped to the magic index * by the permutation function are dropped.The combination function is given the new value being permuted as its first argument, and the current value of the array as its second.For example, we can use R to compute the occurrence count (histogram) for an array of values in the range [0,10)::{7 let histogram :: Acc (Vector Int) -> Acc (Vector Int) histogram xs =- let zeros = fill (constant (Z:.10)) 0- ones = fill (shape xs) 1 in6 permute (+) zeros (\ix -> index1 (xs!ix)) ones:}Slet xs = fromList (Z :. 20) [0,0,1,2,1,1,2,4,8,3,4,9,8,3,2,5,5,3,1,2] :: Vector Intrun $ histogram (use xs)&Vector (Z :. 10) [2,4,4,3,2,2,0,0,2,1]|As a second example, note that the dimensionality of the source and destination arrays can differ. In this way, we can use J to create an identity matrix by overwriting elements along the diagonal::{4 let identity :: Num a => Exp Int -> Acc (Matrix a) identity n =' let zeros = fill (index2 n n) 0' ones = fill (index1 n) 1 inA permute const zeros (\(unindex1 -> i) -> index2 i i) ones:}run $ identity 5 :: Matrix IntMatrix (Z :. 5 :. 5) [ 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1] Note:Regarding array fusion: The Q operation will always be evaluated; it can not be fused into a later step.Since the index permutation function might not cover all positions in the output array (the function is not surjective), the array of default values must be evaluated. However, other operations may fuse into this.CThe array of source values can fuse into the permutation operation.TIf the array of default values is only used once, it will be updated in-place.Regarding the defaults array:If you are sure that the default values are not necessary---they are not used by the combination function and every element will be overwritten---a default array created by 9:ing with the value K) will give you a new uninitialised array. accelerate:Generalised backward permutation operation (array gather).Backward permutation specified by a function mapping indices in the destination array to indices in the source array. Elements of the output array are thus generated by reading from the corresponding index in the source array.)For example, backpermute can be used to 9L a matrix; at every index Z:.y:.xa in the result array, we get the value at that index by reading from the source array at index Z:.x:.y::{" let swap :: Exp DIM2 -> Exp DIM2 swap = lift1 f whereA f :: Z :. Exp Int :. Exp Int -> Z :. Exp Int :. Exp Int# f (Z:.y:.x) = Z :. x :. y:}1let mat = fromList (Z:.5:.10) [0..] :: Matrix IntmatMatrix (Z :. 5 :. 10)+ [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,+ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49]let mat' = use mat/run $ backpermute (swap (shape mat')) swap mat' Matrix (Z :. 10 :. 5) [ 0, 10, 20, 30, 40, 1, 11, 21, 31, 41, 2, 12, 22, 32, 42, 3, 13, 23, 33, 43, 4, 14, 24, 34, 44, 5, 15, 25, 35, 45, 6, 16, 26, 36, 46, 7, 17, 27, 37, 47, 8, 18, 28, 38, 48, 9, 19, 29, 39, 49] accelerate,Map a stencil over an array. In contrast to 1, the domain of a stencil function is an entire  neighbourhoodR of each array element. Neighbourhoods are sub-arrays centred around a focal point. They are not necessarily rectangular, but they are symmetric and have an extent of at least three along each axis. Due to the symmetry requirement the extent is necessarily odd. The focal point is the array position that is determined by the stencil.For those array positions where the neighbourhood extends past the boundaries of the source array, a boundary condition determines the contents of the out-of-bounds neighbourhood positions.Stencil neighbourhoods are specified via nested tuples, where the nesting depth is equal to the dimensionality of the array. For example, a 3x1 stencil for a one-dimensional array: ,s31 :: Stencil3 a -> Exp a s31 (l,c,r) = ... ...where c( is the focal point of the stencil, and l and r represent the elements to the left and right of the focal point, respectively. Similarly, a 3x3 stencil for a two-dimensional array: Js33 :: Stencil3x3 a -> Exp a s33 ((_,t,_) ,(l,c,r) ,(_,b,_)) = ... ...where c is again the focal point and t, b, l and r are the elements to the top, bottom, left, and right of the focal point, respectively (the diagonal elements have been elided).+For example, the following computes a 5x5  +https://en.wikipedia.org/wiki/Gaussian_blur Gaussian blur" as a separable 2-pass operation. type Stencil5x1 a = (Stencil3 a, Stencil5 a, Stencil3 a) type Stencil1x5 a = (Stencil3 a, Stencil3 a, Stencil3 a, Stencil3 a, Stencil3 a) convolve5x1 :: Num a => [Exp a] -> Stencil5x1 a -> Exp a convolve5x1 kernel (_, (a,b,c,d,e), _) = Prelude.sum $ Prelude.zipWith (*) kernel [a,b,c,d,e] convolve1x5 :: Num a => [Exp a] -> Stencil1x5 a -> Exp a convolve1x5 kernel ((_,a,_), (_,b,_), (_,c,_), (_,d,_), (_,e,_)) = Prelude.sum $ Prelude.zipWith (*) kernel [a,b,c,d,e] gaussian = [0.06136,0.24477,0.38774,0.24477,0.06136] blur :: Num a => Acc (Matrix a) -> Acc (Matrix a) blur = stencil (convolve5x1 gaussian) clamp . stencil (convolve1x5 gaussian) clamp accelerateMap a binary stencil of an array. The extent of the resulting array is the intersection of the extents of the two source arrays. This is the stencil equivalent of . accelerate}Boundary condition where elements of the stencil which would be out-of-bounds are instead clamped to the edges of the array.8In the following 3x3 stencil, the out-of-bounds element b, will instead return the value at position c: T +------------+ |a | b|cd | |e | +------------+ accelerateZStencil boundary condition where coordinates beyond the array extent are instead mirrored8In the following 5x3 stencil, the out-of-bounds element c, will instead return the value at position d, and similarly the element at b will return the value at e: T +------------+ |a | bc|def | |g | +------------+ accelerateStencil boundary condition where coordinates beyond the array extent instead wrap around the array (circular boundary conditions).fIn the following 3x3 stencil, the out of bounds elements will be read as in the pattern on the right.  a bc +------------+ +------------+ d|ef | |ef d| g|hi | -> |hi g| | | |bc a| +------------+ +------------+ accelerate\Stencil boundary condition where the given function is applied to any outlying coordinates.The function is passed the out-of-bounds index, so you can use it to specify different boundary conditions at each side. For example, the following would clamp out-of-bounds elements in the y-direction to zero, while having circular boundary conditions in the x-direction. ring :: Acc (Matrix Float) -> Acc (Matrix Float) ring xs = stencil f boundary xs where boundary :: Boundary (Matrix Float) boundary = function $ \(unlift -> Z :. y :. x) -> if y < 0 || y >= height then 0 else if x < 0 then xs ! index2 y (width+x) else xs ! index2 y (x-width) f :: Stencil3x3 Float -> Exp Float f = ... Z :. height :. width = unlift (shape xs) accelerateCall a foreign array function.The form the first argument takes is dependent on the backend being targeted. Note that the foreign function only has access to the input array(s) passed in as its argument.In case the operation is being executed on a backend which does not support this foreign implementation, the fallback implementation is used instead, which itself could be a foreign implementation for a (presumably) different backend, or an implementation in pure Accelerate. In this way, multiple foreign implementations can be supplied, and will be tested for suitability against the target backend in sequence.For an example see the  2https://hackage.haskell.org/package/accelerate-fftaccelerate-fft package. accelerate!Call a foreign scalar expression.The form of the first argument is dependent on the backend being targeted. Note that the foreign function only has access to the input element(s) passed in as its first argument.As with , the fallback implementation itself may be a (sequence of) foreign implementation(s) for a different backend(s), or implemented purely in Accelerate. acceleratePipelining of two array computations. The first argument will be fully evaluated before being passed to the second computation. This can be used to prevent the argument being fused into the function, for example.Denotationally, we have X(acc1 >-> acc2) arrs = let tmp = acc1 arrs in tmp `seq` acc2 tmp-For an example use of this operation see the M function. accelerate&An array-level if-then-else construct. Enabling the RebindableSyntaxK extension will allow you to use the standard if-then-else syntax instead. accelerateAn array-level z construct. Continue to apply the given function, starting with the initial value, until the test function evaluates to . accelerate'Get the innermost dimension of a shape.The innermost dimension (right-most component of the shape) is the index of the array which varies most rapidly, and corresponds to elements of the array which are adjacent in memory.Another way to think of this is, for example when writing nested loops over an array in C, this index corresponds to the index iterated over by the innermost nested loop. accelerate,Get all but the innermost element of a shape accelerateSMap a multi-dimensional index into a linear, row-major representation of an array. accelerate Inverse of  accelerateIntersection of two shapes accelerateUnion of two shapes accelerate&A scalar-level if-then-else construct. Enabling the RebindableSyntaxK extension will allow you to use the standard if-then-else syntax instead. accelerate~While construct. Continue to apply the given function, starting with the initial value, until the test function evaluates to . acceleratedMultidimensional array indexing. Extract the value from an array at the specified zero-based index.1let mat = fromList (Z:.5:.10) [0..] :: Matrix IntmatMatrix (Z :. 5 :. 10)+ [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,+ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49]%runExp $ use mat ! constant (Z:.1:.2)12 accelerateExtract the value from an array at the specified linear index. Multidimensional arrays in Accelerate are stored in row-major order with zero-based indexing.1let mat = fromList (Z:.5:.10) [0..] :: Matrix IntmatMatrix (Z :. 5 :. 10)+ [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,+ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49]runExp $ use mat !! 1212 accelerate'Extract the shape (extent) of an array. accelerate#The number of elements in the array accelerateIThe number of elements that would be held by an array of the given shape.  accelerate  is the same as flip ().  accelerateDetermine if a number is even  accelerateDetermine if a number is odd  accelerate  x y$ is the non-negative factor of both x and y' of which every common factor of both x and y is also a factor; for example: 2gcd 4 2 = 2 gcd (-4) 6 = 2 gcd 0 4 = 4 gcd 0 0 = 0PThat is, the common divisor that is "greatest" in the divisibility preordering.  accelerate  x y, is the smallest positive integer that both x and y divide. accelerate/Raise a number to a non-negative integral power accelerate#Raise a number to an integral power accelerateConvert a character to an  . accelerate Convert an   into a character. accelerateConvert a Boolean value to an  , where  turns into '0' and  into '1'. accelerateZReinterpret a value as another type. The two representations must have the same bit size. accelerateKMagic index identifying elements that are ignored in a forward permutation.  acceleratecombination function acceleratearray of default values accelerateindex permutation function accelerate%array of source values to be permuted accelerateshape of the result array accelerateindex permutation function accelerate source array acceleratestencil function accelerateboundary condition accelerate source array acceleratedestination array acceleratebinary stencil function accelerateboundary condition #1 acceleratesource array #1 accelerateboundary condition #2 acceleratesource array #2 acceleratedestination array accelerate if-condition accelerate then-array accelerate else-array accelerate#keep evaluating while this returns  acceleratefunction to apply accelerate initial value accelerateextent of the array accelerateindex to remap accelerate condition acceleratethen-expression accelerateelse-expression accelerate#keep evaluating while this returns  acceleratefunction to apply accelerate initial valueM     19 9 88 H[2016..2017] Manuel M T Chakravarty, Gabriele Keller, Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None %&'+<V accelerate6Return the number of bits in the type of the argument. acceleratezCount the number of zero bits preceding the most significant set bit. This can be used to compute a base-2 logarithm via: 6logBase2 x = finiteBitSize x - 1 - countLeadingZeros x accelerateUCount the number of zero bits following the least significant set bit. The related  +http://en.wikipedia.org/wiki/Find_first_setfind-first-set operation' can be expressed in terms of this as: )findFirstSet x = 1 + countTrailingZeros x accelerateThe  class defines bitwise operations over integral scalar expression types. As usual, bits are numbered from zero, with zero being the least significant bit. accelerate Bitwise "and" accelerate Bitwise "or" accelerate Bitwise "xor" accelerate Reverse all bits in the argument accelerate x i shifts x left by i bits if i is positive, or right by -ix bits otherwise. Right shifts perform sign extension on signed number types; i.e. they fill the top bits with 1 if the x# is negative and with 0 otherwise. accelerate x i rotates x left by i bits if i is positive, or right by -i bits otherwise.  accelerateThe value with all bits unset! acceleratebit i is a value with the i$th bit set and all other bits clear." accelerate x `setBit` i is the same as  x .|. bit i# acceleratex `clearBit` i is the same as x .&. complement (bit i)$ acceleratex `complementBit` i is the same as  x `xor` bit i% accelerateReturn  if the nth bit of the argument is 1& accelerateReturn " if the argument is a signed type.' accelerateVShift the argument left by the specified number of bits (which must be non-negative).( accelerateShift the argument left by the specified number of bits. The result is undefined for negative shift amounts and shift amounts greater or equal to the .) accelerate]Shift the first argument right by the specified number of bits (which must be non-negative).cRight shifts perform sign extension on signed number types; i.e. they fill the top bits with 1 if x" is negative and with 0 otherwise.* accelerateShift the first argument right by the specified number of bits. The result is undefined for negative shift amounts and shift amounts greater or equal to the .+ accelerateWRotate the argument left by the specified number of bits (which must be non-negative)., accelerateWRotate the argument right by the specified number of bits (which must be non-negative).- acceleratesReturn the number of set bits in the argument. This number is known as the population count or the Hamming weight. !"#$%&'()*+,- !"#$%&'()*+,- 75688'8)8+8,8NH[2016..2017] Manuel M T Chakravarty, Gabriele Keller, Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None+<>?T accelerate)Accelerate lacks a most-general lossless  type, which the standard  function uses as an intermediate value when coercing from integral types. Instead, we use this class to capture a direct coercion between two types.U accelerate$General coercion from integral typesTUOH[2016..2017] Manuel M T Chakravarty, Gabriele Keller, Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None %+7;<=V-V accelerateSEfficient, machine-independent access to the components of a floating-point numberW accelerate4The radix of the representation (often 2) (constant)X accelerateThe number of digits of W in the significand (constant)Y accelerate@The lowest and highest values the exponent may assume (constant)Z accelerateAReturn the significand and an appropriately scaled exponent. If (m,n) = Z x then  x = m*b^^n, where b is the floating-point radix (W). Furthermore, either m and n are both zero, or  b^(d-1) <= ] m < b^d, where d = X x.[ accelerate Inverse of Z\ accelerate'Corresponds to the second component of Z] accelerate&Corresponds to the first component of Z^ accelerateAMultiply a floating point number by an integer power of the radix_ accelerate6 if the argument is an IEEE "not-a-number" (NaN) value` accelerate9 if the argument is an IEEE infinity or negative-infinitya accelerateE if the argument is too small to be represented in normalized formatb accelerate) if the argument is an IEEE negative zeroc accelerate1 if the argument is an IEEE floating point numberd accelerateUA version of arctangent taking two real floating-point arguments. For real floating x and y, d y x[ computes the angle (from the positive x-axis) of the vector from the origin to the point (x,y). d y x returns a value in the range [-pi, pi].VWXYZ[\]^_`abcdPH[2016..2017] Manuel M T Chakravarty, Gabriele Keller, Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None+;<=[e acceleratevName the upper and lower limits of a type. Types which are not totally ordered may still have upper and lower bounds.XYe[2018] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None%*+;<=>?FTV cb'&%*)( cb'&%*)([2016..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None +;<=>?FTVh accelerate accelerate -,+0/. -,+0/.QH[2016..2017] Manuel M T Chakravarty, Gabriele Keller, Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None![YX[ZONMLKJIHGFEDCBA@?>WVUTSRQP^_]\ !"TUVWXYZ[\]^_`abcdeRc[2008..2017] Manuel M T Chakravarty, Gabriele Keller [2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None &';=QSTV&     SE[2010..2011] Ben Lever [2010..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None&'STV. accelerateCalculate the offset coordinates for each stencil element relative to the focal point. The coordinates are returned as a flattened list from the bottom-left element to the top-right. This ordering matches the Var indexing order. accelerate/Position calculation on reified stencil values.TB[2017] Manuel M T Chakravarty, Gabriele Keller, Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None&'QV1 M UH[2012..2017] Manuel M T Chakravarty, Gabriele Keller, Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None&'QSTV4!"#$%&'()*+,-./VH[2012..2017] Manuel M T Chakravarty, Gabriele Keller, Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None"#&'+;=FQSTV8G1!"0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\WH[2015..2017] Manuel M T Chakravarty, Gabriele Keller, Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None"#%&';=NQV>O] accelerate5Generate a dependency graph for the given computation^ accelerate1Generate a dependency graph for an array function_`abc]^Xc[2008..2017] Manuel M T Chakravarty, Gabriele Keller [2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)NoneE?d accelerate?Display simplifier statistics. The counts are reset afterwards.e accelerateWrite a representation of the given input (a closed array expression or function) to file in Graphviz dot format in the temporary directory.OZ[\]^_`abcdefghijklmnopqrstXYuvwxyz{|}~|}~tuvwxyz{fghijdeYH[2012..2017] Manuel M T Chakravarty, Gabriele Keller, Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None%&'QVI{ klmnopqrsZ[2008..2017] Manuel M T Chakravarty, Gabriele Keller [2009..2017] Trevor L. McDonell [2013..2017] Robert Clifton-EverestBSD3-Manuel M T Chakravarty <chak@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None&'01;=FSTV]t accelerate'Recover sharing of array computations ?u accelerate'Recover sharing of scalar expressions ?v accelerate*Recover sharing of sequence computations ?w accelerate4Always float array computations out of expressions ?x acceleratebConvert a closed array expression to de Bruijn form while also incorporating sharing information.y accelerate\Convert a closed function over array computations, while incorporating sharing information.z accelerateaConvert an open array expression to de Bruijn form while also incorporating sharing information.{ accelerateConvert an array expression with given array environment layout and sharing information into de Bruijn form while recovering sharing at the same time (by introducing appropriate let bindings). The latter implements the third phase of sharing recovery.The sharing environment env keeps track of all currently bound sharing variables, keeping them in reverse chronological order (outermost variable is at the end of the list).| accelerateConvert a boundary condition} accelerate\Convert a closed scalar function to de Bruijn form while incorporating sharing information.The current design requires all free variables to be bound at the outermost level --- we have no general apply term, and so lambdas are always outermost. In higher-order abstract syntax, this represents an n-ary, polyvariadic function.~ accelerate^Convert a closed scalar expression to de Bruijn form while incorporating sharing information. accelerateConvert an open expression with given environment layouts and sharing information into de Bruijn form while recovering sharing at the same time (by introducing appropriate let bindings). The latter implements the third phase of sharing recovery.The sharing environments env and aenv keep track of all currently bound sharing variables, keeping them in reverse chronological order (outermost variable is at the end of the list). accelerateConvert a tuple expression accelerateConvert a unary functions accelerateConvert a binary functions accelerate Convert a unary stencil function accelerate!Convert a binary stencil function accelerateRecover sharing information and annotate the HOAS AST with variable and let binding annotations. The first argument determines whether array computations are floated out of expressions irrespective of whether they are shared or not   implies floating them out.Also returns the  s of all mM leaves in environment order  they represent the free variables of the AST.NB: Strictly speaking, this function is not deterministic, as it uses stable pointers to determine the sharing of subterms. The stable pointer API does not guarantee its completeness; i.e., it may miss some equalities, which implies that we may fail to discover some sharing. However, sharing does not affect the denotational meaning of an array computation; hence, we do not compromise denotational correctness..There is one caveat: We currently rely on the m and P leaves representing free variables to be shared if any of them is used more than once. If one is duplicated, the environment for de Bruijn conversion will have a duplicate entry, and hence, be of the wrong size, which is fatal. (The 'buildInitialEnv*'" functions will already bail out.)x accelerate'recover sharing of array computations ? accelerate'recover sharing of scalar expressions ? accelerate*recover sharing of sequence computations ? accelerate3always float array computations out of expressions?~ accelerate'recover sharing of scalar expressions ? accelerateexpression to be convertedxy}~[[2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)NoneQSTV^\[2008..2017] Manuel M T Chakravarty, Gabriele Keller [2009..2017] Trevor L. McDonell [2015..2017] Robert Clifton-EverestBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None]t accelerateCreate a fresh nursery.tWhen the nursery is garbage collected, the provided function will be run on each value to free the retained memory. accelerate*Look for an entry with the requested size. accelerateAdd an entry to the nursery accelerate#Delete all entries from the nursery accelerate1The total number of bytes retained by the nursery][2008..2017] Manuel M T Chakravarty, Gabriele Keller [2009..2017] Trevor L. McDonell [2015..2017] Robert Clifton-EverestBSD32Robert Clifton-Everest <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None%&'+DKQV  accelerate:An untyped reference to an array, similar to a StableName. accelerate5Create a new memory table from host to remote arrays.$The function supplied should be the  for the remote pointers being stored. This function will be called by the GC, which typically runs on a different thread. Unlike the  in A,, this function cannot depend on any state. accelerateELook for the remote pointer corresponding to a given host-side array. acceleratejAllocate a new device array to be associated with the given host-side array. This may not always use the  provided by the A instance. In order to reduce the number of raw allocations, previously allocated remote arrays will be re-used. In the event that the remote memory is exhausted,  is returned. accelerateDeallocate the device array associated with the given host-side array. Typically this should only be called in very specific circumstances. accelerateDeallocate the device array associated with the given StableArray. This is useful for other memory managers built on top of the memory table. accelerateRecord an association between a host-side array and a remote memory area that was not allocated by accelerate. The remote memory will NOT be re-used once the host-side array is garbage collected.=This typically only has use for backends that provide an FFI. accelerategInitiate garbage collection and mark any arrays that no longer have host-side equivalents as reusable. accelerateCall H on all arrays that are not currently associated with host-side arrays. accelerate Initiate garbage collection and G any remote arrays that no longer have matching host-side equivalents. accelerate Make a new . accelerateAMake a weak pointer using an array as a key. Unlike the standard /, this guarantees finalisers won't fire early. ^{[2015..2017] Manuel M T Chakravarty, Gabriele Keller, Robert Clifton-Everest [2016..2017] Trevor L. McDonellBSD31Robert Clifton-Everest <robertce@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None &'+QV] accelerateA Task represents a process executing asynchronously that can be polled for its status. This is necessary for backends that work asynchronously (i.e. the CUDA backend). If a backend is synchronous, the () instance can be used. accelerate(Returns true when the task has finished. accelerate5Create a new memory cache from host to remote arrays.$The function supplied should be the  for the remote pointers being stored. This function will be called by the GC, which typically runs on a different thread. Unlike the  in A,, this function cannot depend on any state. accelerate`Perform some action that requires the remote pointer corresponding to the given array. Returns  if the array have NEVER been in the cache. If the array was previously in the cache, but was evicted due to its age, then the array will be copied back from host memory.qThe continuation passed as the third argument needs to obey some precise properties. As with all bracketed functions, the supplied remote pointer must not leak out of the function, as it is only guaranteed to be valid within it. If it is required that it does leak (e.g. the backend uses concurrency to interleave execution of different parts of the program), then w on the returned task should not return true until it is guaranteed there are no more accesses of the remote pointer. accelerateAllocate a new device array to be associated with the given host-side array. This has similar behaviour to malloc in Data.Array.Accelerate.Array.Memory.Table but also will copy remote arrays back to main memory in order to make space.The third argument indicates that the array should be considered frozen. That is to say that the array contents will never change. In the event that the array has to be evicted from the remote memory, the copy already residing in host memory should be considered valid.dIf this function is called on an array that is already contained within the cache, this is a no-op. On return, 5 indicates that we allocated some remote memory, and $ indicates that we did not need to. accelerateDeallocate the device array associated with the given host-side array. Typically this should only be called in very specific circumstances. This operation is not thread-safe. accelerateRecord an association between a host-side array and a remote memory area that was not allocated by accelerate. The remote memory will NOT be re-used once the host-side array is garbage collected.=This typically only has use for backends that provide an FFI. accelerate Initiate garbage collection and G any remote arrays that no longer have matching host-side equivalents. accelerateTrue if host array is frozen. accelerate%Was the array allocated successfully? _{[2015..2017] Manuel M T Chakravarty, Gabriele Keller, Robert Clifton-Everest [2016..2017] Trevor L. McDonellBSD31Robert Clifton-Everest <robertce@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)NoneABCDEFGHIJ`c[2008..2017] Manuel M T Chakravarty, Gabriele Keller [2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None&';=Vc     _`abc]^ac[2008..2017] Manuel M T Chakravarty, Gabriele Keller [2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None &'FQTV accelerateKDetermine the type of an expressions ------------------------------------- accelerate1Determine an array type ------------------------#Reify the element type of an array. accelerate=Reify the element type of the result of an array computation. acceleratetReify the element type of the result of an array computation using the array computation AST before tying the knot. accelerate-Reify the result type of a scalar expression. accelerateaReify the result types of of a scalar expression using the expression AST before tying the knot. accelerateSize of a tuple type, in bytes bc[2008..2017] Manuel M T Chakravarty, Gabriele Keller [2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None&'QV accelerateCReify the dimensionality of the result type of an array computation accelerateLReify dimensionality of a computation parameterised over a recursive closure accelerate<Reify dimensionality of a scalar expression yielding a shapecH[2012..2017] Manuel M T Chakravarty, Gabriele Keller, Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None%&'NQSTV]OdH[2012..2017] Manuel M T Chakravarty, Gabriele Keller, Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None"#%&';<=QSTV6ew[2012..2017] Manuel M T Chakravarty, Gabriele Keller, Trevor L. McDonell [2014..2014] Frederik M. MadsenBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None%&'+.;<=QSTV accelerateApply the fusion transformation to the AST to combine and simplify terms. This converts terms into the internal delayed array representation and merges adjacent producer/producer terms. Using the reduced internal form limits the number of combinations that need to be considered. accelerate9Apply the fusion transformation to a closed de Bruijn AST accelerate@Apply the fusion transformation to a function of array arguments accelerateGApply the fusion transformation to an AST. This consists of two phases: A bottom-up traversal that converts nodes into the internal delayed representation, merging adjacent producer/producer pairs.iA top-down traversal that makes the representation of fused consumer/producer pairs explicit as a E& of manifest and delayed nodes.TLM: Note that there really is no ambiguity as to which state an array will be in following this process: an array will be either delayed or manifest, and the two helper functions are even named as such! We should encode this property in the type somehow...9:;<=>?@ABCDEfH[2012..2017] Manuel M T Chakravarty, Gabriele Keller, Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None"#;<=/[  accelerate&Recover sharing of array computations? accelerate&Recover sharing of scalar expressions? accelerate)Recover sharing of sequence computations? acceleratenAre array computations floated out of expressions irrespective of whether they are shared or not? Requires . acceleratemFuse array computations? This also implies simplifying scalar expressions. NOTE: currently always enabled. accelerate9Convert segment length arrays into segment offset arrays? acceleratesThe default method of converting from HOAS to de Bruijn; incorporating sharing recovery and fusion optimisation. accelerateuConvert a closed array expression to de Bruijn form while also incorporating sharing observation and array fusion. accelerategConvert a unary function over array computations, incorporating sharing observation and array fusion accelerateZConvert a closed scalar expression, incorporating sharing observation and optimisation. accelerateWConvert closed scalar functions, incorporating sharing observation and optimisation.<!" !"#$%&'()*9:;<=>?@ABCDEFGRST9n[2009..2017] Manuel M T Chakravarty, Gabriele Keller, Trevor L. McDonell [2010..2011] Ben LeverBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None*+;<=>?FQSTVm accelerate For use with -XRebindableSyntax, this class provides ( lifted to both scalar and array types. accelerate Pair each element with its index.let xs = fromList (Z:.5) [0..] :: Vector Floatrun $ indexed (use xs)RVector (Z :. 5) [(Z :. 0,0.0),(Z :. 1,1.0),(Z :. 2,2.0),(Z :. 3,3.0),(Z :. 4,4.0)]2let mat = fromList (Z:.3:.4) [0..] :: Matrix Floatrun $ indexed (use mat)Matrix (Z :. 3 :. 4)Q [ (Z :. 0 :. 0,0.0), (Z :. 0 :. 1,1.0), (Z :. 0 :. 2,2.0), (Z :. 0 :. 3,3.0),Q (Z :. 1 :. 0,4.0), (Z :. 1 :. 1,5.0), (Z :. 1 :. 2,6.0), (Z :. 1 :. 3,7.0),Q (Z :. 2 :. 0,8.0), (Z :. 2 :. 1,9.0), (Z :. 2 :. 2,10.0), (Z :. 2 :. 3,11.0)] accelerate;Apply a function to every element of an array and its index accelerate7Zip three arrays with the given function, analogous to . accelerate6Zip four arrays with the given function, analogous to . accelerate6Zip five arrays with the given function, analogous to . accelerate5Zip six arrays with the given function, analogous to . accelerate7Zip seven arrays with the given function, analogous to . accelerate7Zip eight arrays with the given function, analogous to . accelerate6Zip nine arrays with the given function, analogous to . accelerate@Zip two arrays with a function that also takes the element index accelerateRZip three arrays with a function that also takes the element index, analogous to . accelerateYZip four arrays with the given function that also takes the element index, analogous to . accelerateYZip five arrays with the given function that also takes the element index, analogous to . accelerateXZip six arrays with the given function that also takes the element index, analogous to . accelerateZZip seven arrays with the given function that also takes the element index, analogous to . accelerateZZip eight arrays with the given function that also takes the element index, analogous to . accelerateYZip nine arrays with the given function that also takes the element index, analogous to . accelerateuCombine the elements of two arrays pairwise. The shape of the result is the intersection of the two argument shapes.0let m1 = fromList (Z:.5:.10) [0..] :: Matrix Int2let m2 = fromList (Z:.10:.5) [0..] :: Matrix Floatrun $ zip (use m1) (use m2)Matrix (Z :. 5 :. 5): [ (0,0.0), (1,1.0), (2,2.0), (3,3.0), (4,4.0),: (10,5.0), (11,6.0), (12,7.0), (13,8.0), (14,9.0),: (20,10.0), (21,11.0), (22,12.0), (23,13.0), (24,14.0),: (30,15.0), (31,16.0), (32,17.0), (33,18.0), (34,19.0),: (40,20.0), (41,21.0), (42,22.0), (43,23.0), (44,24.0)] accelerateCTake three arrays and return an array of triples, analogous to zip. accelerateETake four arrays and return an array of quadruples, analogous to zip. accelerateFTake five arrays and return an array of five-tuples, analogous to zip. accelerateDTake six arrays and return an array of six-tuples, analogous to zip. accelerateHTake seven arrays and return an array of seven-tuples, analogous to zip. accelerateHTake seven arrays and return an array of seven-tuples, analogous to zip. accelerateHTake seven arrays and return an array of seven-tuples, analogous to zip. accelerateThe converse of N, but the shape of the two results is identical to the shape of the argument.-If the argument array is manifest in memory,  is a no-op. accelerate?Take an array of triples and return three arrays, analogous to . accelerateATake an array of quadruples and return four arrays, analogous to . accelerate?Take an array of 5-tuples and return five arrays, analogous to . accelerate>Take an array of 6-tuples and return six arrays, analogous to . accelerate@Take an array of 7-tuples and return seven arrays, analogous to . accelerate@Take an array of 8-tuples and return eight arrays, analogous to . accelerate@Take an array of 8-tuples and return eight arrays, analogous to . accelerateeReduction of an array of arbitrary rank to a single scalar value. The first argument needs to be an  associativet function to enable efficient parallel implementation. The initial element does not need to be an identity element.0let vec = fromList (Z:.10) [0..] :: Vector Floatrun $ foldAll (+) 42 (use vec)Scalar Z [87.0]3let mat = fromList (Z:.5:.10) [0..] :: Matrix Floatrun $ foldAll (+) 0 (use mat)Scalar Z [1225.0] accelerate Variant of s that requires the reduced array to be non-empty and does not need a default value. The first argument must be an  associative function. accelerateHCheck if all elements along the innermost dimension satisfy a predicate.let mat = fromList (Z :. 4 :. 10) [1,2,3,4,5,6,7,8,9,10,1,1,1,1,1,2,2,2,2,2,2,4,6,8,10,12,14,16,18,20,1,3,5,7,9,11,13,15,17,19] :: Matrix IntmatMatrix (Z :. 4 :. 10)' [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,' 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,' 2, 4, 6, 8, 10, 12, 14, 16, 18, 20,' 1, 3, 5, 7, 9, 11, 13, 15, 17, 19]run $ all even (use mat)(Vector (Z :. 4) [False,False,True,False] accelerateKCheck if any element along the innermost dimension satisfies the predicate.let mat = fromList (Z :. 4 :. 10) [1,2,3,4,5,6,7,8,9,10,1,1,1,1,1,2,2,2,2,2,2,4,6,8,10,12,14,16,18,20,1,3,5,7,9,11,13,15,17,19] :: Matrix IntmatMatrix (Z :. 4 :. 10)' [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,' 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,' 2, 4, 6, 8, 10, 12, 14, 16, 18, 20,' 1, 3, 5, 7, 9, 11, 13, 15, 17, 19]run $ any even (use mat)&Vector (Z :. 4) [True,True,True,False] accelerate8Check if all elements along the innermost dimension are . accelerate6Check if any element along the innermost dimension is . acceleratenCompute the sum of elements along the innermost dimension of the array. To find the sum of the entire array,  it first.0let mat = fromList (Z:.2:.5) [0..] :: Matrix Intrun $ sum (use mat)Vector (Z :. 2) [10,35] acceleratezCompute the product of the elements along the innermost dimension of the array. To find the product of the entire array,  it first.0let mat = fromList (Z:.2:.5) [0..] :: Matrix Intrun $ product (use mat)Vector (Z :. 2) [0,15120] accelerate}Yield the minimum element along the innermost dimension of the array. To find find the minimum element of the entire array,  it first.&The array must not be empty. See also .Jlet mat = fromList (Z :. 3 :. 4) [1,4,3,8, 0,2,8,4, 7,9,8,8] :: Matrix IntmatMatrix (Z :. 3 :. 4) [ 1, 4, 3, 8, 0, 2, 8, 4, 7, 9, 8, 8]run $ minimum (use mat)Vector (Z :. 3) [1,0,7] acceleratexYield the maximum element along the innermost dimension of the array. To find the maximum element of the entire array,  it first.&The array must not be empty. See also .Jlet mat = fromList (Z :. 3 :. 4) [1,4,3,8, 0,2,8,4, 7,9,8,8] :: Matrix IntmatMatrix (Z :. 3 :. 4) [ 1, 4, 3, 8, 0, 2, 8, 4, 7, 9, 8, 8]run $ maximum (use mat)Vector (Z :. 3) [8,8,9] accelerate4Left-to-right pre-scan (aka exclusive scan). As for scan!, the first argument must be an  associative# function. Denotationally, we have:  prescanl f e = afst . scanl' f e0let vec = fromList (Z:.10) [1..10] :: Vector Intrun $ prescanl (+) 0 (use vec),Vector (Z :. 10) [0,1,3,6,10,15,21,28,36,45] accelerate&Left-to-right post-scan, a variant of ! with an initial value. As with 7, the array must not be empty. Denotationally, we have: &postscanl f e = map (e `f`) . scanl1 f0let vec = fromList (Z:.10) [1..10] :: Vector Int run $ postscanl (+) 42 (use vec)0Vector (Z :. 10) [43,45,48,52,57,63,70,78,87,97] accelerate4Right-to-left pre-scan (aka exclusive scan). As for scan!, the first argument must be an  associative# function. Denotationally, we have:  prescanr f e = afst . scanr' f e accelerate%Right-to-left postscan, a variant of 1 with an initial value. Denotationally, we have: &postscanr f e = map (e `f`) . scanr1 f accelerateSegmented version of  along the innermost dimension of an array. The innermost dimension must have at least as many elements as the sum of the segment descriptor.3let seg = fromList (Z:.4) [1,4,0,3] :: Segments IntsegVector (Z :. 4) [1,4,0,3]1let mat = fromList (Z:.5:.10) [0..] :: Matrix IntmatMatrix (Z :. 5 :. 10)+ [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,+ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49](run $ scanlSeg (+) 0 (use mat) (use seg)Matrix (Z :. 5 :. 12)2 [ 0, 0, 0, 1, 3, 6, 10, 0, 0, 5, 11, 18,2 0, 10, 0, 11, 23, 36, 50, 0, 0, 15, 31, 48,2 0, 20, 0, 21, 43, 66, 90, 0, 0, 25, 51, 78,2 0, 30, 0, 31, 63, 96, 130, 0, 0, 35, 71, 108,2 0, 40, 0, 41, 83, 126, 170, 0, 0, 45, 91, 138] accelerateSegmented version of  along the innermost dimension of an array. The innermost dimension must have at least as many elements as the sum of the segment descriptor.The first element of the resulting tuple is a vector of scanned values. The second element is a vector of segment scan totals and has the same size as the segment vector.3let seg = fromList (Z:.4) [1,4,0,3] :: Segments IntsegVector (Z :. 4) [1,4,0,3]1let mat = fromList (Z:.5:.10) [0..] :: Matrix IntmatMatrix (Z :. 5 :. 10)+ [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,+ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49]:let (res,sums) = run $ scanl'Seg (+) 0 (use mat) (use seg)resMatrix (Z :. 5 :. 8)! [ 0, 0, 1, 3, 6, 0, 5, 11,! 0, 0, 11, 23, 36, 0, 15, 31,! 0, 0, 21, 43, 66, 0, 25, 51,! 0, 0, 31, 63, 96, 0, 35, 71,! 0, 0, 41, 83, 126, 0, 45, 91]sumsMatrix (Z :. 5 :. 4) [ 0, 10, 0, 18, 10, 50, 0, 48, 20, 90, 0, 78, 30, 130, 0, 108, 40, 170, 0, 138] accelerateSegmented version of  along the innermost dimension.As with F, the total number of elements considered, in this case given by the e of segment descriptor, must not be zero. The input vector must contain at least this many elements.Zero length segments are allowed, and the behaviour is as if those entries were not present in the segment descriptor; that is: ;scanl1Seg f xs [n,0,0] == scanl1Seg f xs [n] where n /= 03let seg = fromList (Z:.4) [1,4,0,3] :: Segments IntsegVector (Z :. 4) [1,4,0,3]1let mat = fromList (Z:.5:.10) [0..] :: Matrix IntmatMatrix (Z :. 5 :. 10)+ [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,+ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49]'run $ scanl1Seg (+) (use mat) (use seg)Matrix (Z :. 5 :. 8)& [ 0, 1, 3, 6, 10, 5, 11, 18,& 10, 11, 23, 36, 50, 15, 31, 48,& 20, 21, 43, 66, 90, 25, 51, 78,& 30, 31, 63, 96, 130, 35, 71, 108,& 40, 41, 83, 126, 170, 45, 91, 138] accelerateSegmented version of . accelerateSegmented version of . accelerateSegmented version of  along the innermost dimension of an array. The innermost dimension must have at least as many elements as the sum of the segment descriptor.3let seg = fromList (Z:.4) [1,4,0,3] :: Segments IntsegVector (Z :. 4) [1,4,0,3]1let mat = fromList (Z:.5:.10) [0..] :: Matrix IntmatMatrix (Z :. 5 :. 10)+ [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,+ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49](run $ scanrSeg (+) 0 (use mat) (use seg)Matrix (Z :. 5 :. 12)2 [ 2, 0, 18, 15, 11, 6, 0, 0, 24, 17, 9, 0,2 12, 0, 58, 45, 31, 16, 0, 0, 54, 37, 19, 0,2 22, 0, 98, 75, 51, 26, 0, 0, 84, 57, 29, 0,2 32, 0, 138, 105, 71, 36, 0, 0, 114, 77, 39, 0,2 42, 0, 178, 135, 91, 46, 0, 0, 144, 97, 49, 0] accelerateSegmented version of .3let seg = fromList (Z:.4) [1,4,0,3] :: Segments IntsegVector (Z :. 4) [1,4,0,3]1let mat = fromList (Z:.5:.10) [0..] :: Matrix IntmatMatrix (Z :. 5 :. 10)+ [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,+ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49]:let (res,sums) = run $ scanr'Seg (+) 0 (use mat) (use seg)resMatrix (Z :. 5 :. 8)! [ 0, 15, 11, 6, 0, 17, 9, 0,! 0, 45, 31, 16, 0, 37, 19, 0,! 0, 75, 51, 26, 0, 57, 29, 0,! 0, 105, 71, 36, 0, 77, 39, 0,! 0, 135, 91, 46, 0, 97, 49, 0]sumsMatrix (Z :. 5 :. 4) [ 2, 18, 0, 24, 12, 58, 0, 54, 22, 98, 0, 84, 32, 138, 0, 114, 42, 178, 0, 144] accelerateSegmented version of .3let seg = fromList (Z:.4) [1,4,0,3] :: Segments IntsegVector (Z :. 4) [1,4,0,3]1let mat = fromList (Z:.5:.10) [0..] :: Matrix IntmatMatrix (Z :. 5 :. 10)+ [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,+ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49]'run $ scanr1Seg (+) (use mat) (use seg)Matrix (Z :. 5 :. 8)& [ 0, 10, 9, 7, 4, 18, 13, 7,& 10, 50, 39, 27, 14, 48, 33, 17,& 20, 90, 69, 47, 24, 78, 53, 27,& 30, 130, 99, 67, 34, 108, 73, 37,& 40, 170, 129, 87, 44, 138, 93, 47] accelerateSegmented version of . accelerateSegmented version of . accelerate=Compute head flags vector from segment vector for left-scans. The vector will be full of zeros in the body of a segment, and non-zero otherwise. The "flag" value, if greater than one, indicates that several empty segments are represented by this single flag entry. This is additional data is used by exclusive segmented scan. accelerate~Compute tail flags vector from segment vector for right-scans. That is, the flag is placed at the last place in each segment. accelerateConstruct a segmented version of a function from a non-segmented version. The segmented apply operates on a head-flag value tuple, and follows the procedure of Sengupta et. al. accelerateAIndex construction and destruction generalised to integral types.%We generalise the segment descriptor to integral types because some architectures, such as GPUs, have poor performance for 64-bit types. So, there is a tension between performance and requiring 64-bit indices for some applications, and we would not like to restrict ourselves to either one.As we don't yet support non-Int dimensions in shapes, we will need to convert back to concrete Int. However, don't put these generalised forms into the base library, because it results in too many ambiguity errors. accelerateWFlatten the given array of arbitrary dimension into a one-dimensional vector. As with ", this operation performs no work. accelerate6Create an array where all elements are the same value./run $ fill (constant (Z:.10)) 0 :: Vector Float:Vector (Z :. 10) [0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0] accelerate9Create an array of the given shape containing the values x, x+1, etc. (in row-major order).5run $ enumFromN (constant (Z:.5:.10)) 0 :: Matrix IntMatrix (Z :. 5 :. 10)+ [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,+ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49] accelerate9Create an array of the given shape containing the values x, x+y, x+y+y etc. (in row-major order).?run $ enumFromStepN (constant (Z:.5:.10)) 0 0.5 :: Matrix FloatMatrix (Z :. 5 :. 10)? [ 0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5,? 5.0, 5.5, 6.0, 6.5, 7.0, 7.5, 8.0, 8.5, 9.0, 9.5,? 10.0, 10.5, 11.0, 11.5, 12.0, 12.5, 13.0, 13.5, 14.0, 14.5,? 15.0, 15.5, 16.0, 16.5, 17.0, 17.5, 18.0, 18.5, 19.0, 19.5,? 20.0, 20.5, 21.0, 21.5, 22.0, 22.5, 23.0, 23.5, 24.0, 24.5] accelerateConcatenate innermost component of two arrays. The extent of the lower dimensional component is the intersection of the two arrays.0let m1 = fromList (Z:.5:.10) [0..] :: Matrix Intm1Matrix (Z :. 5 :. 10)+ [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,+ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49]0let m2 = fromList (Z:.10:.3) [0..] :: Matrix Intm2 Matrix (Z :. 10 :. 3) [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]run $ use m1 ++ use m2Matrix (Z :. 5 :. 13)7 [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2,7 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 3, 4, 5,7 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 6, 7, 8,7 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 9, 10, 11,7 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 12, 13, 14] accelerate1Generalised version of '(++)' where the argument 1 specifies which dimension to concatenate along.&Appropriate lenses are available from  3https://hackage.haskell.org/package/lens-acceleratelens-accelerate.0let m1 = fromList (Z:.5:.10) [0..] :: Matrix Intm1Matrix (Z :. 5 :. 10)+ [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,+ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49]0let m2 = fromList (Z:.10:.5) [0..] :: Matrix Intm2 Matrix (Z :. 10 :. 5) [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49]#run $ concatOn _1 (use m1) (use m2)Matrix (Z :. 5 :. 15)? [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4,? 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 5, 6, 7, 8, 9,? 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 10, 11, 12, 13, 14,? 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 15, 16, 17, 18, 19,? 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 20, 21, 22, 23, 24]#run $ concatOn _2 (use m1) (use m2)Matrix (Z :. 15 :. 5) [ 0, 1, 2, 3, 4, 10, 11, 12, 13, 14, 20, 21, 22, 23, 24, 30, 31, 32, 33, 34, 40, 41, 42, 43, 44, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49] accelerateDrop elements that do not satisfy the predicate. Returns the elements which pass the predicate, together with a segment descriptor indicating how many elements along each outer dimension were valid.2let vec = fromList (Z :. 10) [1..10] :: Vector Intvec'Vector (Z :. 10) [1,2,3,4,5,6,7,8,9,10]run $ filter even (use vec)+(Vector (Z :. 5) [2,4,6,8,10],Scalar Z [5])let mat = fromList (Z :. 4 :. 10) [1,2,3,4,5,6,7,8,9,10,1,1,1,1,1,2,2,2,2,2,2,4,6,8,10,12,14,16,18,20,1,3,5,7,9,11,13,15,17,19] :: Matrix IntmatMatrix (Z :. 4 :. 10)' [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,' 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,' 2, 4, 6, 8, 10, 12, 14, 16, 18, 20,' 1, 3, 5, 7, 9, 11, 13, 15, 17, 19]run $ filter odd (use mat)\(Vector (Z :. 20) [1,3,5,7,9,1,1,1,1,1,1,3,5,7,9,11,13,15,17,19],Vector (Z :. 4) [5,5,0,10]) accelerateKGather elements from a source array by reading values at the given indices.=let input = fromList (Z:.9) [1,9,6,4,4,2,0,1,2] :: Vector Int7let from = fromList (Z:.6) [1,3,7,2,5,3] :: Vector Int#run $ gather (use from) (use input)Vector (Z :. 6) [9,4,1,6,2,4] acceleratebConditionally copy elements from source array to destination array according to an index mapping.In addition, the maskx vector and associated predication function specifies whether the element is copied or a default value is used instead.>let defaults = fromList (Z :. 6) [6,6,6,6,6,6] :: Vector Float<let from = fromList (Z :. 6) [1,3,7,2,5,3] :: Vector Int<let mask = fromList (Z :. 6) [3,4,9,2,7,5] :: Vector IntDlet input = fromList (Z :. 9) [1,9,6,4,4,2,0,1,2] :: Vector FloatErun $ gatherIf (use from) (use mask) (> 4) (use defaults) (use input))Vector (Z :. 6) [6.0,6.0,1.0,6.0,2.0,4.0] accelerateyOverwrite elements of the destination by scattering the values of the source array according to the given index mapping.bNote that if the destination index appears more than once in the mapping the result is undefined.9let to = fromList (Z :. 6) [1,3,7,2,5,8] :: Vector Int;let input = fromList (Z :. 7) [1,9,6,4,4,2,5] :: Vector Int>run $ scatter (use to) (fill (constant (Z:.10)) 0) (use input)&Vector (Z :. 10) [0,1,4,9,0,4,0,6,2,0] accelerateConditionally overwrite elements of the destination by scattering values of the source array according to a given index mapping, whenever the masking function resolves to .bNote that if the destination index appears more than once in the mapping the result is undefined.9let to = fromList (Z :. 6) [1,3,7,2,5,8] :: Vector Int9let mask = fromList (Z :. 6) [3,4,9,2,7,5] :: Vector Int;let input = fromList (Z :. 7) [1,9,6,4,4,2,5] :: Vector IntQrun $ scatterIf (use to) (use mask) (> 4) (fill (constant (Z:.10)) 0) (use input)&Vector (Z :. 10) [0,0,0,0,0,4,0,6,2,0] accelerate!Reverse the elements of a vector. accelerate+Transpose the rows and columns of a matrix. accelerateGeneralised version of  where the argument ' specifies which dimension to reverse.&Appropriate lenses are available from  3https://hackage.haskell.org/package/lens-acceleratelens-accelerate.1let mat = fromList (Z:.5:.10) [0..] :: Matrix IntmatMatrix (Z :. 5 :. 10)+ [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,+ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49]run $ reverseOn _1 (use mat)Matrix (Z :. 5 :. 10)+ [ 9, 8, 7, 6, 5, 4, 3, 2, 1, 0,+ 19, 18, 17, 16, 15, 14, 13, 12, 11, 10,+ 29, 28, 27, 26, 25, 24, 23, 22, 21, 20,+ 39, 38, 37, 36, 35, 34, 33, 32, 31, 30,+ 49, 48, 47, 46, 45, 44, 43, 42, 41, 40]run $ reverseOn _2 (use mat)Matrix (Z :. 5 :. 10)+ [ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9] accelerateGeneralised version of  where the argument -s specify which two dimensions to transpose.&Appropriate lenses are available from  3https://hackage.haskell.org/package/lens-acceleratelens-accelerate.1let mat = fromList (Z:.5:.10) [0..] :: Matrix IntmatMatrix (Z :. 5 :. 10)+ [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,+ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49]!run $ transposeOn _1 _2 (use mat) Matrix (Z :. 10 :. 5) [ 0, 10, 20, 30, 40, 1, 11, 21, 31, 41, 2, 12, 22, 32, 42, 3, 13, 23, 33, 43, 4, 14, 24, 34, 44, 5, 15, 25, 35, 45, 6, 16, 26, 36, 46, 7, 17, 27, 37, 47, 8, 18, 28, 38, 48, 9, 19, 29, 39, 49]7let box = fromList (Z:.2:.3:.5) [0..] :: Array DIM3 IntboxjArray (Z :. 2 :. 3 :. 5) [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29]!run $ transposeOn _1 _2 (use box)jArray (Z :. 2 :. 5 :. 3) [0,5,10,1,6,11,2,7,12,3,8,13,4,9,14,15,20,25,16,21,26,17,22,27,18,23,28,19,24,29]!run $ transposeOn _2 _3 (use box)jArray (Z :. 3 :. 2 :. 5) [0,1,2,3,4,15,16,17,18,19,5,6,7,8,9,20,21,22,23,24,10,11,12,13,14,25,26,27,28,29]!run $ transposeOn _1 _3 (use box)jArray (Z :. 5 :. 3 :. 2) [0,15,5,20,10,25,1,16,6,21,11,26,2,17,7,22,12,27,3,18,8,23,13,28,4,19,9,24,14,29] accelerateYield the first nY elements in the innermost dimension of the array (plus all lower dimensional elements).1let mat = fromList (Z:.5:.10) [0..] :: Matrix IntmatMatrix (Z :. 5 :. 10)+ [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,+ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49]run $ take 5 (use mat)Matrix (Z :. 5 :. 5) [ 0, 1, 2, 3, 4, 10, 11, 12, 13, 14, 20, 21, 22, 23, 24, 30, 31, 32, 33, 34, 40, 41, 42, 43, 44] accelerateYield all but the first n\ elements along the innermost dimension of the array (plus all lower dimensional elements).1let mat = fromList (Z:.5:.10) [0..] :: Matrix IntmatMatrix (Z :. 5 :. 10)+ [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,+ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49]run $ drop 7 (use mat)Matrix (Z :. 5 :. 3) [ 7, 8, 9, 17, 18, 19, 27, 28, 29, 37, 38, 39, 47, 48, 49] accelerateHYield all but the elements in the last index of the innermost dimension.1let mat = fromList (Z:.5:.10) [0..] :: Matrix IntmatMatrix (Z :. 5 :. 10)+ [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,+ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49]run $ init (use mat)Matrix (Z :. 5 :. 9)' [ 0, 1, 2, 3, 4, 5, 6, 7, 8,' 10, 11, 12, 13, 14, 15, 16, 17, 18,' 20, 21, 22, 23, 24, 25, 26, 27, 28,' 30, 31, 32, 33, 34, 35, 36, 37, 38,' 40, 41, 42, 43, 44, 45, 46, 47, 48] acceleratevYield all but the first element along the innermost dimension of an array. The innermost dimension must not be empty.1let mat = fromList (Z:.5:.10) [0..] :: Matrix IntmatMatrix (Z :. 5 :. 10)+ [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,+ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49]run $ tail (use mat)Matrix (Z :. 5 :. 9)' [ 1, 2, 3, 4, 5, 6, 7, 8, 9,' 11, 12, 13, 14, 15, 16, 17, 18, 19,' 21, 22, 23, 24, 25, 26, 27, 28, 29,' 31, 32, 33, 34, 35, 36, 37, 38, 39,' 41, 42, 43, 44, 45, 46, 47, 48, 49] accelerateTYield a slit (slice) of the innermost indices of an array. Denotationally, we have: slit i n = take n . drop i accelerateGeneralised version of  where the argument , specifies which dimension to operate over.&Appropriate lenses are available from  3https://hackage.haskell.org/package/lens-acceleratelens-accelerate. accelerateGeneralised version of  where the argument , specifies which dimension to operate over.&Appropriate lenses are available from  3https://hackage.haskell.org/package/lens-acceleratelens-accelerate. accelerateGeneralised version of  where the argument , specifies which dimension to operate over.&Appropriate lenses are available from  3https://hackage.haskell.org/package/lens-acceleratelens-accelerate. accelerateGeneralised version of  where the argument , specifies which dimension to operate over.&Appropriate lenses are available from  3https://hackage.haskell.org/package/lens-acceleratelens-accelerate. accelerateGeneralised version of  where the argument , specifies which dimension to operate over.&Appropriate lenses are available from  3https://hackage.haskell.org/package/lens-acceleratelens-accelerate. accelerateForce an array expression to be evaluated, preventing it from fusing with other operations. Forcing operations to be computed to memory, rather than being fused into their consuming function, can sometimes improve performance. For example, computing a matrix  could provide better memory locality for the subsequent operation. Preventing fusion to split large operations into several simpler steps could also help by reducing register pressure.Preventing fusion also means that the individual operations are available to be executed concurrently with other kernels. In particular, consider using this if you have a series of operations that are compute bound rather than memory bound.Here is the synthetic example: Eloop :: Exp Int -> Exp Int loop ticks = let clockRate = 900000 -- kHz in while (\i -> i < clockRate * ticks) (+1) 0 test :: Acc (Vector Int) test = zip3 (compute $ map loop (use $ fromList (Z:.1) [10])) (compute $ map loop (use $ fromList (Z:.1) [10])) (compute $ map loop (use $ fromList (Z:.1) [10])) Without the use of , the operations are fused together and the three long-running loops are executed sequentially in a single kernel. Instead, the individual operations can now be executed concurrently, potentially reducing overall runtime. accelerateInfix version of  . If the predicate evaluates to A, the first component of the tuple is returned, else the second. Enabling the RebindableSyntaxK extension will allow you to use the standard if-then-else syntax instead. accelerateAn infix version of  . If the predicate evaluates to A, the first component of the tuple is returned, else the second. Enabling the RebindableSyntaxK extension will allow you to use the standard if-then-else syntax instead. accelerateA case-like control structure accelerate3Repeatedly apply a function a fixed number of times accelerate,Reduce along an innermost slice of an array  sequentiallyV, by applying a binary operator to a starting value and the array from left to right. accelerate-Extract the first component of a scalar pair. accelerate-Extract the first component of an array pair. accelerate.Extract the second component of a scalar pair. accelerate-Extract the second component of an array pair accelerate5Converts an uncurried function to a curried function. accelerate3Converts a curried function to a function on pairs. accelerate!The one index for a rank-0 array. accelerateTurn an  . expression into a rank-1 indexing expression. accelerate*Turn a rank-1 indexing expression into an   expression. accelerate)Creates a rank-2 index from two Exp Int`s accelerate6Destructs a rank-2 index to an Exp tuple of two Int`s. accelerate*Create a rank-3 index from three Exp Int`s accelerate2Destruct a rank-3 index into an Exp tuple of Int`s accelerate)Extract the element of a singleton array. the xs == xs ! Z accelerateTest whether an array is empty. accelerateGet the length of a vector. acceleratex: start acceleratey: step accelerate'index of source at each index to gather accelerate source values acceleratesource indices to gather from accelerate mask vector acceleratepredicate function acceleratedefault values accelerate source values accelerate#destination indices to scatter into acceleratedefault values accelerate source values accelerate#destination indices to scatter into accelerate mask vector acceleratepredicate function acceleratedefault values accelerate source values acceleratestarting index acceleratelength acceleratestarting index acceleratelength accelerate case subject acceleratelist of cases to attempt accelerate default valuev500[2015..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None%*+;<=>?FTV'  accelerate.The non-negative magnitude of a complex number accelerate,The phase of a complex number, in the range (-O, O]2. If the magnitude is zero, then so is the phase. accelerate The function  takes a complex number and returns a (magnitude, phase) pair in canonical form: the magnitude is non-negative, and the phase in the range (-O, O]1; if the magnitude is zero, then so is the phase. accelerateCForm a complex number from polar components of magnitude and phase. accelerate t# is a complex value with magnitude 1 and phase t (modulo 2*O). accelerate(Return the real part of a complex number accelerate-Return the imaginary part of a complex number accelerate<Return the complex conjugate of a complex number, defined as conjugate(Z) = X - iY  accelerate $# $#g[2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None7;<=ST. acceleratezA class of things that support almost-equality, so that we can disregard small amounts of floating-point round-off error. acceleratemFails the test if the two arguments are not equal, allowing for a small amount of floating point inaccuracy.44[2008..2017] Manuel M T Chakravarty, Gabriele Keller [2009..2017] Trevor L. McDonell [2013..2017] Robert Clifton-Everest [2014..2014] Frederik M. MadsenBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None9i accelerate%Array indexing in plain Haskell code. accelerate,Linear array indexing in plain Haskell code. accelerateRank of an array. accelerate"Array shape in plain Haskell code. accelerate2Total number of elements in an array of the given t. accelerate@Change the shape of an array without altering its contents. The 4 of the source and result arrays must be identical.nXYZ[JKMLN>?@ABCDEFGHIOVWPQRSTU\]^_   !"123456789:;<=`adehgfijklmnopqrstuvwxyz{|}~     TUVWXYZ[\]^_`abcden~}|{zyxwvutopqrs !"[ZeYX_^]\UTSRQPWVOIHGFEDCBA@?>NLMKJVWXYZ[\]^_`abcdTU     `eda hgf  <=456789:;123ikjnmlh[2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None+<QSTVGDi[2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None +<QSTVIj[2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None %+<QSTVL$k[2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)NoneQVN\l[2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None"#+<STVQ accelerate6mapping function to produce key array from input arraym[2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None +<QSTVTSn[2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None &'+<QSTVVo[2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None+<QSTVYC p[2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None+<QSTV[ q[2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None +<QSTV^O r[2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None+<QSTV`  s[2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None +<QSTVc3 t[2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None+<QSTVeu[2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)NoneQVg     v[2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)NoneQVj[w[2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None+<QVlx[2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None +<QVoy[2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)NoneQVq;z[2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)NoneQVss{[2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None+<QVu|[2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None+<QSTVx+}[2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None%<QVz~[2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None+<QV|[2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)NoneQV[2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None +<QSTVQ acceleratesource indices to gather from accelerate mask vector acceleratepredicate function acceleratedefault values accelerate source values accelerate#destination indices to scatter into accelerate mask vector acceleratepredicate function acceleratedefault values accelerate source values[2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)NoneQV[2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)NoneQV[2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)NoneQSTV[2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)NoneQVI [2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)NoneQV![2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)NoneQV"[2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)NoneQSTV#[2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)NoneQV9 !"#$[2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None+<QV%[2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None+<QV1&[2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None+<QV'[2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)NoneQV%&'([2009..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)NoneQV 3       !"#$%&'() [2016..2017] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None &'+;<=ST accelerate' describes how to process data of some input type into some o;utput type, via a reduction using some intermediate Monoid w. For example, both sum and length below use the - monoid: Ssum = Fold (lift . Sum) (getSum . unlift) length = Fold (\_ -> 1) (getSum . unlift)The key is that s can be combined using *. in order to produce multiple outputs from a single% reduction of the array. For example:  average = (/) <$> sum <*> lengthThis computes both the sum of the array as well as its length in a single traversal, then combines both results to compute the average.Because J has some numeric instances, this can also be defined more succinctly as: average = sum / lengthA more complex example: sumOfSquares = Fold (lift . Sum . (^2)) (getSum . unlift) standardDeviation = sqrt ((sumOfSquares / length) - (sum / length) ^ 2)kThese will all execute with a single reduction kernel and a single map to summarise (combine) the results. accelerateApply a  to an array. [2008..2017] Manuel M T Chakravarty, Gabriele Keller [2009..2017] Trevor L. McDonell [2014..2014] Frederik M. MadsenBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None"#%&'<FQSTV% accelerateFRun a complete embedded array program using the reference interpreter.& accelerateThis is '1 specialised to an array program of one argument.' accelerate.Prepare and execute an embedded array program. %&'()*+, %&',+*()[2018] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None ;=>?FSTV{- accelerateLift a value into a  constructor. accelerateThe  constructor/ accelerateReturns  if the argument is 0 accelerateReturns  if the argument is of the form Just _1 accelerateThe 1& function takes a default value and a  value. If the  is S, the default value is returned; otherwise, it returns the value contained in the .2 accelerateThe 2* function extracts the element out of the , constructor. If the argument was actually +, you will get an undefined value instead.3 accelerateThe 33 function takes a default value, a function, and a  value. If the n value is nothing, the default value is returned; otherwise, it applies the function to the value inside the  and returns the result4 accelerate!Extract from an array all of the m values, together with a segment descriptor indicating how many elements along each dimension were returned. -./01234 -.30/124[2018] Trevor L. McDonellBSD3.Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None ;=>?FSTV" = accelerateLift a value into the  constructor> accelerateLift a value into the  constructor? accelerateReturn  if the argument is a -value@ accelerateReturn  if the argument is a -valueA accelerateThe A* function extracts the element out of the , constructor. If the argument was actually +, you will get an undefined value instead.B accelerateThe B* function extracts the element out of the , constructor. If the argument was actually +, you will get an undefined value instead.C accelerateThe C( function performs case analysis on the  type. If the value is  a, apply the first function to a ; if it is  b , apply the second function to b.D accelerateExtract from the array of  all of the p elements, together with a segment descriptor indicating how many elements along each dimension were returned.E accelerateExtract from the array of  all of the p elements, together with a segment descriptor indicating how many elements along each dimension were returned. =>?@ABCDE =>C?@ABDE+=       !!""##$%&'-(-)-*-+-,-K-;.;/;0;1;2;3;4;5;6;7;89:;<=>?@AB>C>D?E?F@GAHAIDJDKDLDMDNDOEPEQERESETEUEVEWGXGYGZG[G\G]G^G_G`HaIb%c%d%e%f%g%h%i%j%k%l%m%n%o%p%q%r%#%s%'%.%7%&%1%5%0%t%u%v%3%w%x%y%z%{%8%2%4%|%}%~%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                                                               NNOOOOOOOOOOOOOOOP     99999999 9!9"9#9$9%9&9'9(9)9*9+9,9-9.9/90919293949695969798999:9;9<9=9>9?9@9A9B9C9D9E9F9G9H9I9J9K9L9M9N9O9P9Q9R9S9T9:9U9V9W9X9Y9Z9[9\9L9]9^9_9`9a9b9c9d9e9f9g9h9M9i9j9k9l9m9n9o9p9q9r9s9t9u9v9w9x9y9z9/9{9|}~ J J                                  !"#$%&'()*+,&-.//00123344567899:;<=>?@ABCDEEFGHIJKLMNOPQRSTUUVVWWXXYYZZ[[\\]]^^__``aabcdefghijklmnnooppqqrrstuvwxyz{|}~   @    !!!!!!!!!!!!!!!!!!!"""""""*"""""""""""""""""""""""""""""""""""""""""""""""" " " " " """"""""""""""""""" "!"""#"$"%"&"'"(")"*"+","-"."/"0"1"23456789:;<=7>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\;<]^_`abcde(f(g(h(i(j(j(k(l(m(n(o(p(q(r(s)t)u)v)w)x)y)z){)|)}*~************(**)**+**************************************************************************V***8**********************************4*********J*** *(*7************ * * * * ******************** *!*"*#*$*%*&*'*(*)***+*,*-*.*/*0*1*2*3*4*5*6++7+8+9+:+;+<+=+>+?+@+@+A+B+C+D+E+F+G+H+I+J+K+L+M,N,O--PQR-S-T-------)-V---8--------------------U-*----J-- -(-7---------- - - - -------V-W-X-+-Y-Z-[-\-]-^-_-`-a-b-c-d-e-f-g-h-i-j-k-l-m-n-o-p-q-r-s-t-u-v-w-x-y-z-{-|-}-~-------------------------------------------------------------------------------------------------5-6BF%RRRRRRRRRRRRRRRRRRRRRR#SSSTTTTTTTTTTUUUUU U U U U UUUUVVVVVVVVVVVVVVV V!V"V#V$V%V&V'V(V)V*V+V,V-V.V/V0V1V2V3V4V5V6V7V8V9V:V;V<V=V>W?W@WAWBWCWDW=XEXFXGXHXIXJXKYLYMYNYOYPYQYRYSYTZUZVZWZXZYZZZ[Z\Z]Z^Z_Z`ZaZbZcZdZeZfZgZZhZiZj[k[l[m[n[o[p[q[r[s[t[u[v[w[x[y[z[{[|[}[~[[[[[[\\\\\\\\]]]]]]]]]]]]]^^^^^^^^^aaaaaaaaabbbbbcdddeeYeZe[fUfVfWfffffYfZf_f^ffff999999gggggghijkllmnoooooooooooopqrrstuvwxyz{|}~)accelerate-1.2.0.1-LAkReM2aPTwFXkz5GamOucData.Array.Accelerate$Data.Array.Accelerate.Data.Semigroup!Data.Array.Accelerate.Data.Monoid Data.Array.Accelerate.Data.Maybe!Data.Array.Accelerate.Data.Either"Data.Array.Accelerate.Data.ComplexData.Array.Accelerate.Unsafe"Data.Array.Accelerate.Data.FunctorData.Array.Accelerate.Data.BitsData.Array.Accelerate.Data.Fold!Data.Array.Accelerate.Interpreter&Data.Array.Accelerate.Analysis.Hash.THData.Array.Accelerate.Async!Data.Array.Accelerate.Debug.Flags!Data.Array.Accelerate.Debug.Stats!Data.Array.Accelerate.Debug.Trace!Data.Array.Accelerate.Debug.TimedData.Array.Accelerate.Error*Data.Array.Accelerate.Array.Representation!Data.Array.Accelerate.Array.Sugar enumSlicesData.Array.Accelerate.LifetimeSystem.Mem.WeakfinalizeWeak"Data.Array.Accelerate.Array.Unique*Data.Array.Accelerate.Pretty.Graphviz.Type+Data.Array.Accelerate.Pretty.Graphviz.Monad'Data.Array.Accelerate.Test.NoFib.ConfigData.Array.Accelerate.TypeData.Array.Accelerate.Product Data.Atomic&Data.Array.Accelerate.Debug.Monitoring Data.Array.Accelerate.Array.DatausetoSeqData.Array.Accelerate.Languageslice replicate"Data.Array.Accelerate.Array.Lifted(Data.Array.Accelerate.Array.Remote.ClassData.Array.Accelerate.AST(Data.Array.Accelerate.Trafo.Substitution#Data.Array.Accelerate.Trafo.RewriteData.Array.Accelerate.Smartgeneratethefoldmap backpermutescanlstencilzipWithunzipreshapepermuteData.Array.Accelerate.PreludefillData.Array.Accelerate.LiftPrelude$!Data.Array.Accelerate.Classes.Num(Data.Array.Accelerate.Classes.Fractional&Data.Array.Accelerate.Classes.Floating(Data.Array.Accelerate.Classes.ToFloatingRational realToFrac Data.Array.Accelerate.Classes.Eq!Data.Array.Accelerate.Classes.Ord"Data.Array.Accelerate.Classes.Real&Data.Array.Accelerate.Classes.RealFrac"Data.Array.Accelerate.Classes.Enum&Data.Array.Accelerate.Classes.IntegralFoldundef transposecompute*Data.Array.Accelerate.Classes.FromIntegral'Data.Array.Accelerate.Classes.RealFloat%Data.Array.Accelerate.Classes.BoundedData.Array.Accelerate.Classes"Data.Array.Accelerate.Pretty.Print&Data.Array.Accelerate.Analysis.Stencil#Data.Array.Accelerate.Analysis.Hash$Data.Array.Accelerate.Analysis.Match Data.Array.Accelerate.Trafo.Base%Data.Array.Accelerate.Pretty.GraphvizData.Array.Accelerate.Debug"Data.Array.Accelerate.Trafo.Shrink#Data.Array.Accelerate.Trafo.Sharing%Data.Array.Accelerate.Test.NoFib.Base*Data.Array.Accelerate.Array.Remote.Nursery(Data.Array.Accelerate.Array.Remote.Table&Data.Array.Accelerate.Array.Remote.LRU"Data.Array.Accelerate.Array.RemoteData.Array.Accelerate.Pretty#Data.Array.Accelerate.Analysis.Type$Data.Array.Accelerate.Analysis.Shape#Data.Array.Accelerate.Trafo.Algebra$Data.Array.Accelerate.Trafo.Simplify"Data.Array.Accelerate.Trafo.FusionData.Array.Accelerate.Trafo"Data.Array.Accelerate.Test.Similar.Data.Array.Accelerate.Test.NoFib.Spectral.SMVM3Data.Array.Accelerate.Test.NoFib.Spectral.RadixSort6Data.Array.Accelerate.Test.NoFib.Spectral.BlackScholes)Data.Array.Accelerate.Test.NoFib.Spectral(Data.Array.Accelerate.Test.NoFib.Sharing0Data.Array.Accelerate.Test.NoFib.Prelude.ZipWith0Data.Array.Accelerate.Test.NoFib.Prelude.Stencil-Data.Array.Accelerate.Test.NoFib.Prelude.Scan0Data.Array.Accelerate.Test.NoFib.Prelude.Permute,Data.Array.Accelerate.Test.NoFib.Prelude.Map-Data.Array.Accelerate.Test.NoFib.Prelude.Fold/Data.Array.Accelerate.Test.NoFib.Prelude.Filter4Data.Array.Accelerate.Test.NoFib.Prelude.Backpermute(Data.Array.Accelerate.Test.NoFib.Prelude/Data.Array.Accelerate.Test.NoFib.Issues.Issue930Data.Array.Accelerate.Test.NoFib.Issues.Issue4090Data.Array.Accelerate.Test.NoFib.Issues.Issue4070Data.Array.Accelerate.Test.NoFib.Issues.Issue3620Data.Array.Accelerate.Test.NoFib.Issues.Issue2880Data.Array.Accelerate.Test.NoFib.Issues.Issue2870Data.Array.Accelerate.Test.NoFib.Issues.Issue2640Data.Array.Accelerate.Test.NoFib.Issues.Issue2550Data.Array.Accelerate.Test.NoFib.Issues.Issue2280Data.Array.Accelerate.Test.NoFib.Issues.Issue1870Data.Array.Accelerate.Test.NoFib.Issues.Issue1850Data.Array.Accelerate.Test.NoFib.Issues.Issue1840Data.Array.Accelerate.Test.NoFib.Issues.Issue1680Data.Array.Accelerate.Test.NoFib.Issues.Issue1370Data.Array.Accelerate.Test.NoFib.Issues.Issue1230Data.Array.Accelerate.Test.NoFib.Issues.Issue1190Data.Array.Accelerate.Test.NoFib.Issues.Issue1140Data.Array.Accelerate.Test.NoFib.Issues.Issue102'Data.Array.Accelerate.Test.NoFib.Issues0Data.Array.Accelerate.Test.NoFib.Imaginary.SAXPY0Data.Array.Accelerate.Test.NoFib.Imaginary.SASUM/Data.Array.Accelerate.Test.NoFib.Imaginary.DotP*Data.Array.Accelerate.Test.NoFib.Imaginary Data.Array.Accelerate.Test.NoFibbaseGHC.BaseGHC.Num-negate<>memptymappendmconcat SemigroupMonoidghc-prim GHC.TypesBoolCharDoubleFloatIntGHC.IntInt8Int16Int32Int64MaybeOrderingWordGHC.WordWord8Word16Word32Word64 Data.EitherEitherFalseNothingJustTrueLeftRightLTEQGT Data.Complex:+ComplexData.SemigroupgetMinMingetMaxMaxData.Semigroup.InternalgetSumSum getProductProductForeign.C.TypesCCharCSCharCUCharCShortCUShortCIntCUIntCLongCULongCLLongCULLongCFloatCDouble GHC.FloatatanhacoshasinhtanhcoshsinhatanacosasintancossinlogBase**sqrtlogexppiGHC.RealdivModquotRemmoddivremquotrecip/GHC.EnummaxBoundminBoundpredsuccsignumabs*+.conststimessconcatGHC.Err undefinederrorhalf-0.3-EQ7sL9Ks8Aw3nSS1eqfMFq Numeric.HalfgetHalfHalfIsScalar IsBoundedIsNumIsNonNum IsFloating IsIntegralSlice SliceShape CoSliceShape FullShape sliceIndexShapeDIM9DIM8DIM7DIM6DIM5DIM4DIM3DIM2DIM1DIM0SegmentsMatrixVectorScalarArrayArraysEltAnyAll:.Z fromFunction fromFunctionMfromListtoListStencilBoundaryExpAccconstantcoerceUnliftunliftLiftPlainliftlift1lift2lift3ilift1ilift2ilift3Functorfmap<$<$>$>void $fFunctorMax $fFunctorMin$fFunctorProduct $fFunctorSumNum fromInteger Fractional fromRationalFloating ToFloating toFloatingEq==/=&&||notOrd<><=>=minmaxcompareRealFracproperFractiontruncateroundceilingfloordiv'mod'divMod'EnumIntegral Stencil5x5x5 Stencil3x5x5 Stencil5x3x5 Stencil5x5x3 Stencil3x3x5 Stencil3x5x3 Stencil5x3x3 Stencil3x3x3 Stencil5x5 Stencil3x5 Stencil5x3 Stencil3x3Stencil9Stencil7Stencil5Stencil3unitfold1foldSegfold1Segscanl'scanl1scanrscanr'scanr1stencil2clampmirrorwrapfunction foreignAcc foreignExp>->acondawhile indexHead indexTailtoIndex fromIndex intersectcondwhile!!!shapesize shapeSizesubtractevenoddgcdlcm^^^ordchr boolToIntbitcastignore FiniteBits finiteBitSizecountLeadingZeroscountTrailingZerosBits.&..|.xor complementshiftrotatezeroBitsbitsetBitclearBit complementBittestBitisSignedshiftL unsafeShiftLshiftR unsafeShiftRrotateLrotateRpopCount $fBitsCUShort $fBitsCShort $fBitsCULLong $fBitsCLLong $fBitsCULong $fBitsCLong $fBitsCUInt $fBitsCInt $fBitsWord64 $fBitsWord32 $fBitsWord16 $fBitsWord8 $fBitsWord $fBitsInt64 $fBitsInt32 $fBitsInt16 $fBitsInt8 $fBitsInt $fBitsBool$fFiniteBitsCUShort$fFiniteBitsCShort$fFiniteBitsCULLong$fFiniteBitsCLLong$fFiniteBitsCULong$fFiniteBitsCLong$fFiniteBitsCUInt$fFiniteBitsCInt$fFiniteBitsWord64$fFiniteBitsWord32$fFiniteBitsWord16$fFiniteBitsWord8$fFiniteBitsWord$fFiniteBitsInt64$fFiniteBitsInt32$fFiniteBitsInt16$fFiniteBitsInt8$fFiniteBitsInt$fFiniteBitsBool FromIntegral fromIntegral RealFloat floatRadix floatDigits floatRange decodeFloat encodeFloatexponent significand scaleFloatisNaN isInfiniteisDenormalizedisNegativeZeroisIEEEatan2Bounded$fSemigroupExp$fSemigroupExp0$fSemigroupExp1$fSemigroupExp2$fSemigroupExp3 $fMonoidExp$fSemigroupExp4$fOrdMax$fEqMax$fNumExp $fBoundedExp$fUnliftExpMax $fLiftExpMax$fIsProductEltMax$fEltMax $fMonoidExp0$fSemigroupExp5$fOrdMin$fEqMin $fNumExp0 $fBoundedExp0$fUnliftExpMin $fLiftExpMin$fIsProductEltMin$fEltMin $fMonoidExp1 $fMonoidExp2 $fMonoidExp3 $fMonoidExp4 $fOrdProduct $fEqProduct$fUnliftExpProduct$fLiftExpProduct$fIsProductEltProduct $fEltProduct $fMonoidExp5$fOrdSum$fEqSum$fUnliftExpSum $fLiftExpSum$fIsProductEltSum$fEltSum IfThenElseEltT ifThenElseindexedimapzipWith3zipWith4zipWith5zipWith6zipWith7zipWith8zipWith9izipWith izipWith3 izipWith4 izipWith5 izipWith6 izipWith7 izipWith8 izipWith9zipzip3zip4zip5zip6zip7zip8zip9unzip3unzip4unzip5unzip6unzip7unzip8unzip9foldAllfold1Allallanyandorsumproductminimummaximumprescanl postscanlprescanr postscanrscanlSeg scanl'Seg scanl1Seg prescanlSeg postscanlSegscanrSeg scanr'Seg scanr1Seg prescanrSeg postscanrSegflatten enumFromN enumFromStepN++concatOnfiltergatherscatterreverse reverseOn transposeOntakedropinittailslitinitOntailOntakeOndropOnslitOn?|?caseofiteratesfoldlfstafstsndasndcurryuncurryindex0index1unindex1index2unindex2index3unindex3nulllength magnitudephasepolarmkPolarcisrealimag conjugate$fFunctorComplex$fFromIntegralaComplex $fFloatingExp$fFractionalExp $fEqComplex$fUnliftExpComplex$fLiftExpComplex$fIsProductcstComplex $fEltComplex $fEltComplex0 $fEltComplex1 $fEltComplex2 $fEltComplex3 indexArraylinearIndexArray arrayRank arrayShape arraySize arrayReshaperunFold$fFloatingFold$fFractionalFold $fNumFold$fApplicativeFold $fFunctorFoldrunrun1runN evalUndef evalCoerce evalPrimConstevalPrimevalPrjjustnothing isNothingisJust fromMaybefromJustmaybejusts$fLiftExpMaybe$fIsProductEltMaybe $fEltMaybe $fOrdMaybe $fEqMaybe$fFunctorMaybeleftrightisLeftisRightfromLeft fromRighteitherleftsrights$fLiftExpEither$fIsProductEltEither $fEltEither $fOrdEither $fEqEither$fFunctorEitherhashQ hashWithSaltQasyncasyncOn GHC.Conc.SyncforkOn asyncBoundControl.ConcurrentforkOSwaitpollcancelAsyncwhenunlessValueFlag dump_sched dump_execdump_asmdump_lddump_cc dump_gc_statsdump_gcdump_simpl_dotdump_dotdump_vectorisationdump_simpl_iterationsdump_simpl_stats dump_fusion dump_sharing dump_phasesverbosedebug force_recomp flush_cache fast_mathsimplifyfusion exp_sharing acc_sharingunfolding_use_thresholdsetValuegetValuegetFlagsetFlag clearFlagsetFlags clearFlagsinline ruleFired knownBranch betaReduce substitutionsimplifierDone fusionDoneresetSimplCount simplCountshowFFloatSIBasetracetraceIO traceEvent putTraceMsg traceEventIOtimedelapsed internalError internalCheck indexCheckinternalWarning boundsError unsafeError boundsCheck unsafeCheck boundsWarning unsafeWarning SliceIndex sliceShaperankemptySliceNilSliceAll SliceFixedunioniter shapeToListiter1 rangeToShape shapeToRange listToShapeLTFLifetime newLifetime withLifetime touchLifetime addFinalizermkWeakunsafeGetValue mkWeakPtr UniqueArraynewUniqueArraywithUniqueArrayPtrunsafeUniqueArrayPtrGHC.ForeignPtrunsafeForeignPtrToPtrtouchUniqueArray uniqueArrayIduniqueArrayDataEdgeVertexPortLabelNodeIdNode StatementGNEGraphTreeLeafForestppGraph ppSubgraph ppStatementppEdgeppVertexppNode ppNodeTreeppNodeIdDotStatedotNodesdotEdgesdotGraphfreshDot emptyStaterunDotevalDotexecDotmkLabelmkNodeIdmkGraph mkSubgraph TestConfigat Interpreter TestWord64 TestWord32 TestWord16 TestWord8 TestInt64 TestInt32 TestInt16TestInt8 TestDouble TestFloatTestHalfTestAllnofibIngredient BitSizeEqIsSingle ScalarType BoundedTypeNumType NonNumType FloatingType IntegralType byteSwap64 byteSwap32 byteSwap16V16V8V4V3V2BitSize TupleType TypeRunit TypeRscalar TypeRpair scalarType singleType boundedTypenumType nonNumType floatingType integralType VectorType Vector2Type Vector3Type Vector4Type Vector8Type Vector16Type SingleType NumSingleTypeNonNumSingleTypeSingleScalarTypeVectorScalarTypeIntegralBoundedTypeNonNumBoundedTypeIntegralNumTypeFloatingNumTypeTypeBoolTypeChar TypeCChar TypeCSChar TypeCUCharTypeHalf TypeFloat TypeDouble TypeCFloat TypeCDoubleTypeIntTypeInt8 TypeInt16 TypeInt32 TypeInt64TypeWord TypeWord8 TypeWord16 TypeWord32 TypeWord64 TypeCShort TypeCUShortTypeCInt TypeCUInt TypeCLong TypeCULong TypeCLLong TypeCULLong NonNumDict FloatingDict IntegralDict integralDict floatingDict nonNumDict IsProductProdRTupleIdxProdReprfromProdtoProdprod ProdRunit ProdRsnoc ZeroTupIdx SuccTupIdxAtomicaddwritereadbeginMonitoringinitAccMetrics withProcessoraddProcessorTimedidAllocateBytesLocaldidCopyBytesFromRemote didRemoteGC didEvictBytes ProcessorNativePTXdidAllocateBytesRemoteincreaseCurrentBytesRemotedecreaseCurrentBytesRemotedidCopyBytesToRemoteincreaseCurrentBytesNurserydecreaseCurrentBytesNurserysetCurrentBytesNurserygetCurrentBytesNursery ArrayEltRArrayEltMutableArrayData ArrayData runArrayDataregisterForeignPtrAllocator!mallocPlainForeignPtrBytesAlignedmallocForeignPtr HTYPE_INT HTYPE_WORD HTYPE_LONGHTYPE_UNSIGNED_LONG HTYPE_CCHAR ArrayPtrstouchArrayDataarrayEltunsafeIndexArrayDataptrsOfArrayData newArrayDataunsafeReadArrayDataunsafeWriteArrayDataunsafeFreezeArrayDataptrsOfMutableArrayData ArrayEltRunit ArrayEltRint ArrayEltRint8ArrayEltRint16ArrayEltRint32ArrayEltRint64 ArrayEltRwordArrayEltRword8ArrayEltRword16ArrayEltRword32ArrayEltRword64ArrayEltRcshortArrayEltRcushort ArrayEltRcintArrayEltRcuintArrayEltRclongArrayEltRculongArrayEltRcllongArrayEltRcullong ArrayEltRhalfArrayEltRfloatArrayEltRdoubleArrayEltRcfloatArrayEltRcdouble ArrayEltRbool ArrayEltRcharArrayEltRccharArrayEltRcscharArrayEltRcuchar ArrayEltRvec2 ArrayEltRvec3 ArrayEltRvec4 ArrayEltRvec8ArrayEltRvec16 ArrayEltRpair GArrayDataAD_UnitAD_IntAD_Int8AD_Int16AD_Int32AD_Int64AD_WordAD_Word8 AD_Word16 AD_Word32 AD_Word64 AD_CShort AD_CUShortAD_CIntAD_CUIntAD_CLong AD_CULong AD_CLLong AD_CULLongAD_HalfAD_Float AD_Double AD_CFloat AD_CDoubleAD_BoolAD_CharAD_CChar AD_CSChar AD_CUCharAD_V2AD_V3AD_V4AD_V8AD_V16AD_Pair fstArrayData sndArrayData pairArrayDataDivision sliceAnyIndexsliceNoneIndexTupleRAtupleTuple TupleReprEltReprDivideSplitsingletonScalarType concatVectors allocateArray showShape$fShow(,,,,,,,,,,,,,,,) DivisionSlice slicesIndexNilAtupSnocAtupNilTupSnocTuparraysflavourtoArrfromArr ArraysFlavour ArraysFunit ArraysFarray ArraysFtupleArraysR ArraysRunit ArraysRarray ArraysRpairIsAtupleArrReprForeign strForeign liftForeigntoElteltTypefromEltIsTuple fromTupletoTuple liftToElt liftToElt2 sinkFromElt sinkFromElt2 fromAtupletoAtupletuple IsConstrainedIsC LiftedArrayLiftedTupleReprVector' isArraysFlat elements'shapes'empty'length'drop'vec2Vec'toList' fromList' RemoteMemory RemotePtr mallocRemote pokeRemote peekRemote castRemotePtrtotalRemoteMemavailableRemoteMemremoteAllocationSizePrimEltPrimFun PrimConst PreOpenExpPreExpOpenExpFunPreFunOpenFun PreOpenFunStencilR PreBoundary PreOpenAccAfunPreAfun PreOpenAfunLiftAcc NFDataAccPrimAddPrimSubPrimMulPrimNegPrimAbsPrimSigPrimQuotPrimRem PrimQuotRemPrimIDivPrimMod PrimDivModPrimBAndPrimBOrPrimBXorPrimBNot PrimBShiftL PrimBShiftR PrimBRotateL PrimBRotateR PrimPopCountPrimCountLeadingZerosPrimCountTrailingZerosPrimFDiv PrimRecipPrimSinPrimCosPrimTanPrimAsinPrimAcosPrimAtanPrimSinhPrimCoshPrimTanh PrimAsinh PrimAcosh PrimAtanhPrimExpFloatingPrimSqrtPrimLogPrimFPow PrimLogBase PrimTruncate PrimRound PrimFloor PrimCeiling PrimAtan2 PrimIsNaNPrimIsInfinitePrimLtPrimGtPrimLtEqPrimGtEqPrimEqPrimNEqPrimMaxPrimMinPrimLAndPrimLOrPrimLNotPrimOrdPrimChr PrimBoolToIntPrimFromIntegralPrimToFloating PrimMinBound PrimMaxBoundPrimPiUnionConstVarIndexLetPrjIndexNil IndexCons IndexHead IndexTailIndexAny IndexSlice IndexFullToIndex FromIndexCondWhilePrimApp LinearIndex ShapeSize IntersectUndefCoerceBodyLam StencilRunit3 StencilRunit5 StencilRunit7 StencilRunit9 StencilRtup3 StencilRtup5 StencilRtup7 StencilRtup9ConstantFunctionClampMirrorWrapPermuteUnitMapFold1ApplyZipWith BackpermuteAletAvarAprjAforeignAcondAwhileUseReshapeGenerate Transform ReplicateFoldSegFold1SegScanlScanl'Scanl1ScanrScanr'Scanr1Stencil2OpenAccOpenAfunAbodyAlamValEltEmptyEltPushEltValEmptyPushIdxZeroIdxSuccIdxidxToInt tupleIdxToIntprjprjEltrnfPreOpenAfun rnfPreOpenAcc rnfArrays rnfPreOpenFun rnfPreOpenExpliftIdx liftTupleIdxliftPreOpenAfunliftPreOpenAccliftPreOpenFunliftPreOpenExp liftArraysliftSliceIndex liftPrimConst liftPrimFun liftConst showPreAccOp showPreExpOp substitutecompose RebuildAcc:?>SinkExpweakenESinkweaken:> RebuildTupunRTupRebuildableAccRebuildableExprebuildErebuildPartialE RebuildableAccClorebuildPartialrebuildAsubTopsubAtop strengthen strengthenEconvertSegmentsconvertSegmentsAfunPreAccGHC.ShowShow StencilRepr stencilPrjTagAtagPipeLevelatup2atup3atup4atup5atup6atup7atup8atup9atup10atup11atup12atup13atup14atup15atup16unatup2unatup3unatup4unatup5unatup6unatup7unatup8unatup9unatup10unatup11unatup12unatup13unatup14unatup15unatup16tup2tup3tup4tup5tup6tup7tup8tup9tup10tup11tup12tup13tup14tup15tup16untup2untup3untup4untup5untup6untup7untup8untup9untup10untup11untup12untup13untup14untup15untup16 mkMinBound mkMaxBoundmkPimkSinmkCosmkTanmkAsinmkAcosmkAtanmkSinhmkCoshmkTanhmkAsinhmkAcoshmkAtanh mkExpFloatingmkSqrtmkLogmkFPow mkLogBasemkAddmkSubmkMulmkNegmkAbsmkSigmkQuotmkRem mkQuotRemmkIDivmkModmkDivModmkBAndmkBOrmkBXormkBNot mkBShiftL mkBShiftR mkBRotateL mkBRotateR mkPopCountmkCountLeadingZerosmkCountTrailingZerosmkFDivmkRecip mkTruncatemkRoundmkFloor mkCeilingmkAtan2mkIsNaN mkIsInfinitemkLtmkGtmkLtEqmkGtEqmkEqmkNEqmkMaxmkMinmkLAndmkLOrmkLNotmkOrdmkChrmkFromIntegral mkToFloating mkBoolToInt mkBitcastmkUnsafeCoerce$$$$$$$$$$$$$$ integer-gmpGHC.Integer.TypeIntegerReal PrettyEnv prettyEnv PrettyAcc prettyOpenAccprettyOpenAfun prettyOpenFun prettyOpenExpprettyPreOpenAccprettyPreOpenAfun prettyPreFunprettyPreOpenFun prettyPreExpprettyPreOpenExpprettyTupleIdx prettyPrim prettyArraysnoParenssizeEnvoffsets positionsRoffsets2 EncodeAccHashhashPreOpenAcchashPreOpenFunhashPreOpenExp encodeOpenAccencodePreOpenAcc encodeOpenExpencodePreOpenExpencodePreOpenFunData.Type.Equality:~:ReflMatchAccmatchPreOpenAccmatchPreOpenAfunmatchPreOpenExpmatchPreOpenFunmatchIdx matchPrimFun matchPrimFun'matchTupleTypematchScalarType matchNumTypematchIntegralTypematchFloatingType SupplementBaseSupPushSupExtendBaseEnvPushEnvGammaEmptyExpPushExpDelayedOpenAccDelayedManifestextentDindexD linearIndexDDelayedOpenFunDelayedOpenExpDelayedOpenAfun DelayedFun DelayedExp DelayedAfun DelayedAccMatchmatchKitextract prettyAcc encodeAccmatchAccinject fromOpenAccavarInkmap fromOpenAfunhashDelayedOpenAccencodeDelayedOpenAccmatchDelayedOpenAccincExpprjExppushExpappendbindsinksink1bindExpsgraphDelayedAccgraphDelayedAfunDetailSimpleFull PrettyGraphdumpSimplStats dumpGraphdebuggingIsEnabledmonitoringIsEnabledboundsChecksAreEnabledunsafeChecksAreEnabledinternalChecksAreEnabled UsesOfAcc ShrinkAccShrinkshrinkshrink' shrinkPreAccbasicReduceAcc usesOfExp usesOfPreAccrecoverAccSharingrecoverExpSharingrecoverSeqSharing floatOutAcc convertAcc convertAfunconvertOpenAccconvertSharingAccconvertSharingBoundary convertFun convertExpconvertSharingExpconvertSharingTupleconvertSharingFun1convertSharingFun2convertSharingStencilFun1convertSharingStencilFun2recoverSharingAccStableSharingAcc FunctionR Afunction AfunctionRRunNRundim0dim1dim2dim3arrayinti8i16i32i64wordw8w16w32w64f16f32f64 log_flt_maxflt_maxflt_minexcept splitEvery splitPlacesnewlookupinsertcleanupNurseryNRS StableArrayfreemalloc freeStableinsertUnmanagedcleanpurgereclaimmakeStableArraymakeWeakArrayData MemoryTableTask completed withRemoteAccType arrayTypeaccType preAccTypeexpType preExpTypesizeOfdelayedAccTypedelayedExpTypeaccDim preAccDimexpDimAccDim delayedDim evalPrimAppSimplify+++EmbedAccfloatOutAccFromExpenableAccFusionconvertOffsetOfSegmentphasesPhaseconvertAccWithconvertAfunWith mkHeadFlags mkTailFlags segmentedindex1'lens-4.17-GoOAYF7pUHIA3pankMS2ZControl.Lens.TypeLens'gatherIf scatterIfSimilar~~~~=Sim absRelTol test_smvmtest_radixsorttest_blackscholes test_spectralsortKey test_sharing test_zipWith test_stencil test_scanl test_scanl1 test_scanl' test_scanr test_scanr1 test_scanr' test_scanlSegtest_scanl1Segtest_scanl'Seg test_scanrSegtest_scanr1Segtest_scanr'Seg test_permutetest_map test_fold test_foldSeg test_filtertest_backpermute test_prelude test_issue93 test_issue409 test_issue407 test_issue362 test_issue288 test_issue287 test_issue264 test_issue255 test_issue228 test_issue187 test_issue185 test_issue184 test_issue168 test_issue137 test_issue123 test_issue119 test_issue114 test_issue102 test_issues test_saxpy test_sasum test_dotptest_imaginarynofib Applicative