h$r/      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                                                                                            [2008..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None'(  [2017..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions) Safe-Inferred  [2009..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None8 accelerate2Spawn an asynchronous action in a separate thread. accelerateLike  , but using  internally. accelerateLike  , but using  internally. accelerateBlock the calling thread until the computation completes, then return the result. accelerateTest whether the asynchronous computation has already completed. If so, return the result, else !. accelerate*Cancel a running asynchronous computation. [2016..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None [2008..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None accelerate8Conditional execution of a monadic debugging expression.?This does nothing unless the program is compiled in debug mode. accelerateThe opposite of .?This does nothing unless the program is compiled in debug mode.* [2008..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None 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  with the difference that the message is emitted to the eventlog, if eventlog profiling is enabled at runtime. acceleratePrint a message prefixed with the current elapsed wall-clock time. accelerateThe  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. [2016..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None accelerateExecute an action and time the results. If GC stats have been enabled (with +RTS -t for example) then timing and memory usage information is displayed, otherwise only timing information is shown. [2008..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None M  [2009..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None#$ accelerateIssue an internal error message accelerateThrow an error if the condition evaluates to False, otherwise evaluate the result.4$internalCheck :: String -> String -> Bool -> a -> a accelerateThrow an error if the index is not in range, otherwise evaluate the result. accelerate String -> Bool -> a -> a m [2015..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None%N 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  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. accelerateEnsure 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. accelerateCauses 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.Because 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  deRefWeak returns Nothing, there is no guarantee that the finalizers have already run. accelerateRetrieve the value from a lifetime. This is unsafe because, unless the  is still reachable, the finalizers may fire, potentially invalidating the value.  [2016..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None-C 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]The 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. accelerateReturns the element of an immutable array at the specified index. This does no bounds checking. accelerateRead an element from a mutable array at the given index. This does no bounds checking. accelerateWrite an element into a mutable array at the given index. This does no bounds checking. 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]  [2008..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None./28. [2008..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None. [2009..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None3/Q [2016..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None1 accelerateA mutable atomic integer accelerateDecrement the atomic value by the given amount. Return the old value. accelerateBitwise AND the atomic with the given value. Return the old value. accelerate?Increase the atomic by the given amount. Returns the old value. accelerate"Set the atomic to the given value. accelerateGet the current value. [2016..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None #$= 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. accelerateInitialise 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 ...Note 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_remoteTotal number of bytes currently considered live in the remote address space.acc.gc.current_bytes_nurseryTotal number of bytes allocated in the remote address space but not currently live (available for reallocation).Registered counters: acc.gc.bytes_allocated_local experimentalnon-portable (GHC extensions)NoneC accelerateA space-efficient implementation of a set data structure for enumerated data types. accelerateIs the bit set empty? accelerate&The number of elements in the bit set. accelerate'Ask whether the item is in the bit set. accelerateThe empty bit set. accelerateCreate a singleton set. accelerate Insert an item into the bit set. accelerate Delete an item from the bit set. accelerateThe union of two bit sets. accelerateDifference of two bit sets. accelerateSee . accelerate!The intersection of two bit sets. accelerateTransform this bit set by applying a function to every value. Resulting bit set may be smaller then the original. accelerateReduce this bit set by applying a binary function to all elements, using the given starting value. Each application of the operator is evaluated before before using the result in the next application. This function is strict in the starting value. accelerateReduce this bit set by applying a binary function to all elements, using the given starting value. accelerate/Convert this bit set set to a list of elements. accelerate'Make a bit set from a list of elements.5! [2008..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)NoneDM" [2008..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None &'(/Eqrstuv# [2008..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions) Primitive scalar types supported by Accelerate Integral types: * Int * Int8 * Int16 * Int32 * Int64 * Word * Word8 * Word16 * Word32 * Word64 Floating types: * Half * Float * Double SIMD vector types of the above: * Vec2 * Vec3 * Vec4 * Vec8 * Vec16None &'(-/>I  accelerateConstraint that values of these two types have the same bit width accelerateQuerying all scalar types accelerateQuerying single value types accelerateQuerying Bounded types accelerateQuerying Numeric types accelerateQuerying Floating types accelerateQuerying Integral types accelerate+All scalar element types implement Eq & Ord accelerate'Bounded element types implement Bounded accelerate*Numeric element types implement Num & Real accelerate5Floating-point types supported in array computations. accelerate/Integral types supported in array computations.789:;<=>?@ABCpon$ [2008..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None'(N accelerateThis structure both witnesses the layout of our representation types (as TupR does) and represents a complete path of pattern matching through this type. It indicates which fields of the structure represent the union tags (TagRtag) or store undefined values (TagRundef). The function eltTags produces all valid paths through the type. For example the type '(Bool,Bool)' produces the following:ghci> putStrLn . unlines . map show $ eltTags @(Bool,Bool) (((),(0,())),(0&,())) -- (False, False) (((),(0,())),(1%,())) -- (False, True) (((),(1,())),(0%,())) -- (True, False) (((),(1,())),(1,())) -- (True, True) accelerateThe type of the runtime value used to distinguish constructor alternatives in a sum type. % [2008..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None '(>Q@ accelerateBoth arrays (Acc) and expressions (Exp) are represented as nested pairs consisting of: unit (void)pairs: representing compound values (i.e. tuples) where each component will be stored in a separate array.single array / scalar types in case of expressions: values which go in registers. These may be single value types such as int and float, or SIMD vectors of single value types such as  4* float%. We do not allow vectors-of-vectors.& [2008..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None '(/S< accelerateDeclares the size of a SIMD vector and the type of its elements. This data type is used to denote the relation between a vector type (Vec n single) with its tuple representation (tuple). Conversions between those types are exposed through  and . ' [2008..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None'(X accelerate/Shape and index representations as nested pairs accelerate!Nicely format a shape as a string accelerateNumber of dimensions of a shape or index (>= 0) accelerate7Total number of elements in an array of the given shape accelerateThe empty shape accelerate$Yield the intersection of two shapes accelerateYield the union of two shapes accelerateMap 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 in the second argument; third argument combines results and fourth is an initial value that is combined with the results; 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 Converse of  accelerate4Convert a shape or index into its list of dimensions accelerate)Convert a list of dimensions into a shape accelerate4Attempt to convert a list of dimensions into a shape ( [2008..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None '(>[3 accelerateGeneralised array index, which may index only in a subset of the dimensions of a shape. accelerate7Class of slice representations (which are nested pairs) accelerate1Project the shape of a slice from the full shape. accelerateEnumerate all slices within a given bound. The innermost dimension changes most rapidly.See )* for an example.+ [2008..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None'([, [2008..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None '(\ - [2008..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None '(]u9 . [2008..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None'(^C/ [2008..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None'(a accelerateMapping from scalar type to the type as represented in memory in an array. accelerate Underlying array representation.NOTE: We use a standard (non-strict) pair to enable lazy device-host data transfers 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.0 [2008..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None '(>fS accelerate0Type witnesses shape and data layout of an array accelerate/Segment descriptor (vector of segment lengths).To 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. accelerateArray data type, where the type arguments regard the representation types of the shape and elements. accelerate.Creates a new, uninitialized Accelerate array. accelerateCreate 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. accelerate"Convert a list into an Accelerate  in dense row-major order. accelerateConvert an accelerated  to a list in row-major order.  accelerateA two-dimensional array  accelerateA one-dimensional array  accelerate"A singleton array with one element$    1 [2008..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None'(gv  accelerateGADT reifying the Stencil class 2 [2015..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None-k=  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.  accelerate,Pointers into this particular remote memory.  accelerateAttempt to allocate the given number of bytes in the remote memory space. Returns Nothing on failure.  accelerateCopy the given number of elements from the host array into remote memory.  accelerateCopy the given number of elements from remote memory to the host array.  accelerateCast a remote pointer.  accelerate3Returns the total remote memory available in bytes.  accelerate/Returns, in bytes, the available remote memory.  accelerate"The chunk allocation size (bytes). 3 [2008..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None'(>?s!  acceleratePrimitive scalar operations  acceleratePrimitive constant values  accelerateVanilla 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.The data type is parametrised over the representation type (not the surface types).  accelerate0Vanilla expression without free scalar variables  accelerate.Vanilla function without free scalar variables  accelerate!Vanilla open function abstraction  accelerate?Vanilla boundary condition specification for stencil operations  accelerateCollective 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.)The 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.  accelerate,Closed array expression aka an array program  accelerate?Vanilla array-computation function without free array variables  accelerateParametrised array-computation function without free array variables  accelerate9Function abstraction over parametrised array computations 4 [2012..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None '(u> 5 [2008..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None #$&'(>v.  06 [2015..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None &2w 7 [2015..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None #$w 8 [2017..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None '(|+  accelerateShould the hash function include _all_ substructure, recursively?Set to true (the default) if you want a truly unique fingerprint for the entire expression:Example:xs, ys :: Acc (Vector Float) xs = fill (constant (Z:.10)) 1.0 ys = fill (constant (Z:.20)) 1.0with perfect=True:hash xs = 2e1f91aca4c476d13b36f22462e73c15bbdd9fcacb0d4996280f6004058e9732 hash ys = 2fce5c849b6c652192b09aaeafdc8029e57b9f006c1ecd79ccf9114f349aaf9eHowever, for a code generating backend the object code used to evaluate both of these expressions is likely to be identical.!Setting perfect=False results in:hash xs = hash ys = f97944b0ec64ab8aa989fd60c8b50e7ec3eff759d22d2b340039d837d74dfc3c$Note that to be useful the provided   function must also understand this option, and the consumer of the hash value must be agnostic to the elided details. 9 [2019..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None| : [2008..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None/9>?x accelerateThe x class characterises the allowable array element types, and hence the types which can appear in scalar Accelerate expressions of type ;.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 Z and (:.)?Nested tuples of all of these, currently up to 16-elements wideAdding new instances for x 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*For simple types it is possible to derive x automatically, for example: 6data Point = Point Int Float deriving (Generic, Elt) 7data Option a = None | Just a deriving (Generic, Elt)See the function <7 for details on how to use sum types in embedded code.  accelerateType representation mapping, which explains how to convert a type from the surface type into the internal representation type consisting only of simple primitive types, unit () , and pair (,).x = [2008..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None-My> [2008..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None8:>?{  accelerateGeneralised array division, like above but use for splitting an array into many subarrays, as opposed to extracting a single subarray.z accelerate$Slices, aka generalised indices, as n-tuples and mappings of slice indices to slices, co-slices, and slice dimensions accelerate.Shapes and indices of multi-dimensional arrays  accelerateReified type witness for shapes  accelerate,The slice index for slice specifier 'Any sh'  accelerateThe slice index for specifying a slice with only the Z component projected  accelerateMarker for arbitrary shapes in slices descriptors, where it is desired to split along an unknown number of dimensions.*For example, in the following definition,   matches against any shape and flattens everything but the innermost dimension. vectors :: (Shape sh, Elt e) => Acc (Array (sh:.Int) e) -> Seq [Vector e] vectors = toSeq (Divide :. All)  accelerateMarker for splitting along an entire dimension in division descriptors.;For example, when used in a division descriptor passed to ?, a   indicates that the array should be divided along this dimension forming the elements of the output sequence. accelerate#Marker for arbitrary dimensions in @A and @B descriptors.< can be used in the leftmost position of a slice instead of , indicating that any dimensionality is admissible in that position.See @A and @B for examples. accelerate Marker for entire dimensions in @A and @B descriptors.Occurrences of  indicate the dimensions into which the array's existing extent will be placed unchanged.See @A and @B for examples. accelerate-Increase an index rank by one dimension. The 6 operator is used to construct both values and types. accelerate Rank-0 index  accelerateNumber of dimensions of a shape or index (>= 0)  accelerate2Total number of elements in an array of the given shape  accelerate The empty shape  accelerate$Yield the intersection of two shapes  accelerateYield the union of two shapes  accelerateMap 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 all of the indices of a shape, applying the given function at each index. The index space is traversed in row-major order.  accelerate Variant of   without an initial value  accelerate;Convert a minpoint-maxpoint index into a zero-indexed shape  accelerate.Convert a shape into a minpoint-maxpoint index  accelerate'Convert a shape to a list of dimensions  accelerateConvert a list of dimensions into a shape. If the list does not contain exactly the number of elements as specified by the type of the shape: error.  accelerate4Attempt to convert a list of dimensions into a shape  accelerate!Nicely format a shape as a string  accelerate1Project the shape of a slice from the full shape.  accelerateEnumerate all slices within a given bound. The innermost dimension changes most rapidly.Example: let slix = sliceIndex @(Z :. Int :. Int :. All) sh = Z :. 2 :. 3 :. 1 :: DIM3 in enumSlices slix sh :: [ Z :. Int :. Int :. All ]  accelerate!Total shape (extent) of the array accelerateThe argument index accelerateCorresponding linear index  accelerate!Total shape (extent) of the array accelerateThe argument index accelerate%Corresponding multi-dimensional index  accelerate+The total shape (extent) of the index space accelerateFunction to apply at each index accelerateFunction to combine results accelerate3Value to return in case of an empty iteration space3 z~}|{  33C [2012..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None '( D [2012..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None &'(->  accelerateReplace 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.Composition of unary functions.#  E [2012..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None'( F [2012..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None  '(: G [2012..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None &'( H [2012..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None #$'(> I [2012..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None &'( J [2012..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None #$&'(>?X  6K [2012..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None &'(-0>?  accelerate9Apply the fusion transformation to a closed de Bruijn AST  accelerateApply the fusion transformation to a function of array arguments L [2015..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None #$&'(>  accelerate5Generate a dependency graph for the given computation  accelerate1Generate a dependency graph for an array function M [2008..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)NoneK  accelerateWrite a representation of the given input (a closed array expression or function) to file in Graphviz dot format in the temporary directory. N [2008..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None  accelerateCreate a fresh nursery.When 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 O [2008..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None&'(-  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  ,, this function cannot depend on any state.  accelerateLook for the remote pointer corresponding to a given host-side array.  accelerateAllocate a new device array to be associated with the given host-side array. This may not always use the   provided by the   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.  accelerate Initiate garbage collection and   any remote arrays that no longer have matching host-side equivalents.  accelerate Make a new  .  accelerateMake a weak pointer using an array as a key. Unlike the standard /, this guarantees finalisers won't fire early. P [2015..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None '(-  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  ,, this function cannot depend on any state.  acceleratePerform 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.The 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   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.If 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   any remote arrays that no longer have matching host-side equivalents.  accelerateTrue if host array is frozen. accelerateNumber of elements accelerate%Was the array allocated successfully? Q [2015..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None R [2008..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None9>? accelerateThe  class characterises the types which can appear in collective Accelerate computations of type S.) consists of nested tuples of individual s, currently up to 16-elements wide. Accelerate computations can thereby return multiple results.  accelerateType representation mapping, which explains how to convert from the surface type into the internal representation type, which consists only of , and () and (,) as type-level nil and snoc. 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:sh: 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.e: 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  is the fastest varying). The allowable array element types are members of the x" 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 16-elements wide. Note that  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 T.Section "Getting data in" lists functions for getting data into and out of the  type. accelerate.Segment descriptor (vector of segment lengths)To 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 sub-arrays.  accelerateYield an array's shape  accelerateChange the shape of an array without altering its contents. The  4 of the source and result arrays must be identical.  accelerateReturn the value of an array at the given multidimensional index  accelerateReturn the value of an array at given the linear (row-major) index accelerateCreate 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  accelerateCreate 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  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]Note 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#Matrices are two-dimensional arrays accelerate"Vectors are one-dimensional arrays accelerate#Scalar arrays hold a single element       9 9 U [2008..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None'(/>?  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  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 parallelism, 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 language 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 compiler which generates and executes parallel SIMD code of the target language at application runtime.The type constructor  represents embedded collective array operations. A term of type Acc a 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 cannot initiate new collective operations: this stratification between scalar operations in  and array operations in  helps statically exclude nested data parallelism, which is difficult to execute efficiently on constrained hardware such as GPUs. A simple exampleAs 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 , we see that it is an embedded Accelerate computation - it will be evaluated in the object language of dynamically generated parallel code, rather than the meta language of vanilla Haskell.As the arguments to dotp are plain Haskell arrays, to make these available to Accelerate computations they must be embedded with the @T 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 dotp function to matrix-vector multiplication. First, let's rewrite our dotp function to take 4 arrays as input (which is typically what we want): dotp :: 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 V to create a one-dimensional vector by applying at each index a function to A out the corresponding row of the matrix to pass to the dotp function. However, since both V and A2 are data-parallel operations, and moreover that A  depends on the argument row given to it by the V 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 W to retrieve the result of the dotp) operation, effectively concealing that dotp is a collective array computation in order to match the type expected by V, 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 X operation reduces along the innermost dimension of an array of arbitrary rank, reducing the rank (dimensionality) of the array by one. Thus, we can B the input vector to as many rows 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.The main idea is to first partition array operations into two categories: !Element-wise operations, such as Y, V , and Z. Each element of these operations can be computed independently of all others.Collective operations such as X, [, and \. 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.pngIf the consumer operation uses more than one element of the input array (typically, via V 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 (T + V + ]) will fuse into a single operation, which then fuses into the collective X. operation. At this point in the program the X/ must now be evaluated. In the final step the Y! reads in the array produced by X%. As there is no fusion between the X and Y; steps, this program consists of two "loops"; one for the T + V + ] + X step, and one for the final Y step.You 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 ^ and _, 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.There are (at least) two cases where you may want to use this: The @` 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 abing 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. 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       0000  [2009..2020] The Accelerate TeamBSD3.Trevor L. McDonell  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: coerce (x :: Exp Double) :: Exp Word64 coerce (x :: Exp (Int64,Float)) :: Exp (Complex Float, Word32)Furthermore, as we typically declare newtype wrappers similarly to: )type instance EltR (Sum a) = ((), EltR 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.The type class 9 assures that there is a coercion between the two types.c [2008..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None!'(2>?] accelerateConvert a closed array expression to de Bruijn form while also incorporating sharing information. accelerateConvert a closed function over array computations, while incorporating sharing information. accelerateConvert 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. accelerateConvert a closed scalar expression to de Bruijn form while incorporating sharing information.d [2012..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None accelerateConvert a closed array expression to de Bruijn form while also incorporating sharing observation and array fusion. accelerateConvert a unary function over array computations, incorporating sharing observation and array fusion accelerateConvert a closed scalar expression, incorporating sharing observation and optimisation. accelerateConvert closed scalar functions, incorporating sharing observation and optimisation. e [2009..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)Nonef [2009..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)Noneg [2016..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None->?  accelerateConversion from an Integer.>An integer literal represents the application of the function  fromInteger# to the appropriate value of type Integer. We export this specialised version where the return type is fixed to an  term in order to improve type checking in Accelerate modules when RebindableSyntax is enabled.fromInteger :: Num a => Integer -> Exp a fromInteger = P.fromIntegerBasic numeric classcdefh [2016..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None->?  accelerateConversion from a Rational.A floating point literal representations the application of the function  fromRational to a value of type Rational. We export this specialised version where the return type is fixed to an  term in order to improve type checking in Accelerate modules when RebindableSyntax is enabled.fromRational :: Fractional a => Rational -> Exp a fromRational = P.fromRational,Fractional numbers, supporting real division]\i [2016..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None ->?  accelerate experimentalnon-portable (GHC extensions)None->?  accelerate(Accelerate lacks an arbitrary-precision  type, which the standard  uses as an intermediate value when coercing to floating-point types. Instead, we use this class to capture a direct coercion between two types. accelerate"General coercion to floating typesk [2016..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None->? accelerate*Operations over sequentially ordered typesa`l [2008..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None  '(>?H Reference backend (interpreted) [2008..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None#$&'(?' accelerateRun 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.  m [2018..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None&-/>? acceleratePattern synonyms for indices, which may be more convenient to use than no and np. accelerateA pattern synonym for working with (product) data types. You can declare your own pattern synonyms based off of this. accelerateSpecialised pattern synonyms for tuples, which may be more convenient to use than no and np#. For example, to construct a pair: let a = 4 :: Exp Int let b = 2 :: Exp Float let c = T2 a b -- :: Exp (Int, Float); equivalent to 'lift (a,b)'.Similarly they can be used to destruct values: let T2 x y = c -- x :: Exp Int, y :: Exp Float; equivalent to 'let (x,y) = unlift c',These pattern synonyms can be used for both  and  terms.Similarly, we have patterns for constructing and destructing indices of a given dimensionality: let ix = Ix 2 3 -- :: Exp DIM2 let I2 y x = ix -- y :: Exp Int, x :: Exp Int"33q [2018..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)NoneE accelerateAs , but for a list of types accelerateGenerate pattern synonyms for the given simple (Haskell'98) sum or product data type.Constructor and record selectors are renamed to add a trailing underscore if it does not exist, or to remove it if it does. For infix constructors, the name is prepended with a colon :. For example: data Point = Point { xcoord_ :: Float, ycoord_ :: Float } deriving (Generic, Elt) Will create the pattern synonym: -Point_ :: Exp Float -> Exp Float -> Exp Point$together with the selector functions xcoord :: Exp Point -> Exp Float ycoord :: Exp Point -> Exp Floatr [2018..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None &'(s [2018..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None &'(t [2018..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None &'(Vu [2018..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None &'(n [2016..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None->?"  accelerateA 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. accelerateAn 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) 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  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 experimentalnon-portable (GHC extensions)None,&2 accelerateThe  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 accelerateReplace 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 vw-. 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 vw is function application, ( is function application lifted over a . accelerateA flipped version of . accelerate value. discards or ignores the result of evaluation.444x [2016..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None&'(->?* accelerateThe  class defines equality  and inequality $ for scalar Accelerate expressions.For convenience, we include x 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. accelerateConjunction: True if both arguments are true. This is a strict version of : it will always evaluate both arguments, even when the first is false. 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. accelerateDisjunction: True if either argument is true. This is a strict version of : it will always evaluate both arguments, even when the first is true. accelerateLogical negation  #443322y [2016..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None&'(,->?+ accelerateThe $ class for totally ordered datatypes&'(4444z [2016..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None->?,{ [2016..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None->?- accelerate.Integral numbers, supporting integral divisionVWXY[Z@ [2008..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None&'(-?5 accelerateMake an array from vanilla Haskell available for processing within embedded Accelerate computations.Depending 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) accelerateConstruct a singleton (one element) array from a scalar value (or tuple of scalar values). accelerateReplicate 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]...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:run $ 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 Any can be used in the slice specification to match against some arbitrary dimension. For example, here Any/ 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, Any and All can be used together.:{ 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.For example, the following will generate a one-dimensional array (Vector") of three floating point numbers:1run $ generate (I1 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]:7run $ generate (I1 10) (\(I1 i) -> i + 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.If 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 aW*, the program will fail with the error: ./Data/Array/Accelerate/Trafo/Sharing.hs:447 (convertSharingExp): inconsistent valuation @ shared 'Exp' tree .... accelerateChange 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,  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 (Alls) 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 All):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 All6s) returns a single element (zero dimensional array).6run $ slice (use mat) (constant (Z :. 4 :. 2 :: DIM2)) Scalar Z [42] The marker Any can be used in the slice specification to match against some arbitrary (lower) dimension. Here Any' matches whatever shape type variable sh takes::{ let 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, Any and All can be used together.:{ 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] accelerateApply 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] accelerateReduction 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) maximumSegmentSum" = map (\(T4 x _ _ _) -> x) . fold1 f . map g where f :: (Num a, Ord a) => Exp (a,a,a,a) -> Exp (a,a,a,a) -> Exp (a,a,a,a) f x y =) let T4 mssx misx mcsx tsx = x) T4 mssy misy mcsy tsy = y in4 T4 (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 T4 y y y x:}let 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  |, which can be a useful way to compute multiple results from a single reduction. accelerate Variant of  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. accelerateSegmented reduction along the innermost dimension of an array. The segment descriptor specifies the starting index (offset) along the innermost dimension to the beginning of each logical sub-array.The value in the output array at index i is the reduction of values between the indices of the segment descriptor at index i and (i+1). We have that: 9foldSeg f z xs seg == foldSeg' f z xs (scanl (+) 0 seg) 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 offset to the beginning 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  associative 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 , 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).Forward 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  commutative7. Elements for which the permutation function returns ! 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  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 in: permute (+) zeros (\ix -> Just_ (I1 (xs!ix))) ones:}let 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  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 (I2 n n) 0# ones = fill (I1 n) 1 in< permute const zeros (\(I1 i) -> Just_ (I2 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  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.The array of source values can fuse into the permutation operation.If the array of default values is only used once, it will be updated in-place. This behaviour can be disabled this with  -fno-inplace.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 abing with the value  }) will give you a new uninitialised array.#Regarding the combination function: The function const can be used to replace elements of the defaults array with the new values. If the permutation function maps multiple values to the same location in the results array (the function is not injective) then this operation is non-deterministic.Since Accelerate uses an unzipped struct-of-array representation, where the individual components of product types (for example, pairs) are stored in separate arrays, storing values of product type requires multiple store instructions.Accelerate prior to version 1.3.0.0 performs this operation atomically, to ensure that the stored values are always consistent (each component of the product type is written by the same thread). Later versions relax this restriction, but this behaviour can be disabled with -fno-fast-permute-const. 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 a~ a matrix; at every index Z:.y:.x 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 where 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  neighbourhood 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: s33 :: 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 Note:Since accelerate-1.3.0.0, we allow the source array to fuse into the stencil operation. However, since a stencil computation (typically) requires multiple values from the source array, this means that the work of the fused operation will be duplicated for each element in the stencil pattern.For example, suppose we write:  blur . map fThe operation f will be fused into each element of the first Gaussian blur kernel, resulting in a stencil equivalent to: f_and_convolve1x5 :: Num a => (Exp a -> Exp b) -> [Exp b] -> Stencil1x5 a -> Exp b f_and_convolve1x5 f kernel ((_,a,_), (_,b,_), (_,c,_), (_,d,_), (_,e,_)) = Prelude.sum $ Prelude.zipWith (*) kernel [f a, f b, f c, f d, f e]This duplication is often beneficial, however you may choose to instead force the array to be evaluated first, preventing fusion, using the a operation. Benchmarking should reveal which approach is best for your application. 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 . accelerateBoundary 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:  +------------+ |a | b|cd | |e | +------------+ accelerateStencil 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:  +------------+ |a | bc|def | |g | +------------+ accelerateStencil boundary condition where coordinates beyond the array extent instead wrap around the array (circular boundary conditions).In 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| +------------+ +------------+ accelerateStencil 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 (acc1 >-> acc2) arrs = let tmp = acc1 arrs in tmp `seq` acc2 tmp-For an example use of this operation see the  function. accelerate&An array-level if-then-else construct. Enabling the RebindableSyntax extension will allow you to use the standard if-then-else syntax instead. accelerateAn array-level  construct. Continue to apply the given function, starting with the initial value, until the test function evaluates to  . accelerateMap 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 RebindableSyntax extension will allow you to use the standard if-then-else syntax instead. accelerateWhile construct. Continue to apply the given function, starting with the initial value, until the test function evaluates to  . accelerateMultidimensional 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 accelerateThe 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 = 0That 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'. accelerateReinterpret a value as another type. The two representations must have the same bit size.  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 value19 9 88  [2016..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None &'(-? accelerate6Return the number of bits in the type of the argument. accelerateCount 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 accelerateCount 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 -i 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. accelerateShift 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 . accelerateShift the first argument right by the specified number of bits (which must be non-negative).Right 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 . accelerateRotate the argument left by the specified number of bits (which must be non-negative). accelerateRotate the argument right by the specified number of bits (which must be non-negative). accelerateReturn the number of set bits in the argument. This number is known as the population count or the Hamming weight. 756888888 [2016..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None-?  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. accelerate$General coercion from integral typesa [2009..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None'(,->?@M 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)Vector (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) [ (Z :. 0 :. 0,0.0), (Z :. 0 :. 1,1.0), (Z :. 0 :. 2,2.0), (Z :. 0 :. 3,3.0), (Z :. 1 :. 0,4.0), (Z :. 1 :. 1,5.0), (Z :. 1 :. 2,6.0), (Z :. 1 :. 3,7.0), (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 . accelerateZip two arrays with a function that also takes the element index accelerateZip three arrays with a function that also takes the element index, analogous to . accelerateZip four arrays with the given function that also takes the element index, analogous to . accelerateZip five arrays with the given function that also takes the element index, analogous to . accelerateZip six arrays with the given function that also takes the element index, analogous to . accelerateZip seven arrays with the given function that also takes the element index, analogous to . accelerateZip eight arrays with the given function that also takes the element index, analogous to . accelerateZip nine arrays with the given function that also takes the element index, analogous to . accelerateCombine 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)] accelerateTake three arrays and return an array of triples, analogous to zip. accelerateTake four arrays and return an array of quadruples, analogous to zip. accelerateTake five arrays and return an array of five-tuples, analogous to zip. accelerateTake six arrays and return an array of six-tuples, analogous to zip. accelerateTake seven arrays and return an array of seven-tuples, analogous to zip. accelerateTake seven arrays and return an array of seven-tuples, analogous to zip. accelerateTake seven arrays and return an array of seven-tuples, analogous to zip. accelerateThe converse of , 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 . accelerateTake 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 . accelerateTake an array of 7-tuples and return seven arrays, analogous to . accelerateTake an array of 8-tuples and return eight arrays, analogous to . accelerate?Take an array of 9-tuples and return nine arrays, analogous to . accelerateReduction of an array of arbitrary rank to a single scalar value. The first argument needs to be an  associative 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  that requires the reduced array to be non-empty and does not need a default value. The first argument must be an  associative function. accelerateSegmented 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 does not need a default value. The segment descriptor species the length of each of the logical sub-arrays. accelerateCheck 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] accelerateCheck 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 #. accelerateCompute 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] accelerateCompute 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] accelerateYield 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 .let 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] accelerateYield 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 .let 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 , the total number of elements considered, in this case given by the  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 . accelerateFlatten 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] accelerateGeneralised 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]) accelerateAs , but with separate arrays for the data elements and the flags indicating which elements of that array should be kept. accelerateGather 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] accelerateConditionally copy elements from source array to destination array according to an index mapping.In addition, the mask 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 4) (use defaults) (use input))Vector (Z :. 6) [6.0,6.0,1.0,6.0,2.0,4.0] accelerateOverwrite elements of the destination by scattering the values of the source array according to the given index mapping.Note 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 #.Note 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 Intrun $ 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 IntboxArray (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)Array (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)Array (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)Array (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 n 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] accelerateYield 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] accelerateYield 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] accelerateYield 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: loop :: 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 #, the first component of the tuple is returned, else the second. Enabling the RebindableSyntax extension will allow you to use the standard if-then-else syntax instead. accelerateAn infix version of  . If the predicate evaluates to #, the first component of the tuple is returned, else the second. Enabling the RebindableSyntax extension will allow you to use the standard if-then-else syntax instead. accelerateThe  operation is the core operation which enables embedded pattern matching. It is applied to an n-ary scalar function, and generates the necessary case-statements in the embedded code for each argument. For example, given the function: example1 :: Exp (Maybe Bool) -> Exp Int example1 Nothing_ = 0 example1 (Just_ False_) = 1 example1 (Just_ True_) = 28In order to use this function it must be applied to the  operator: match example1Using the infix-flip operator (), we can also write case statements inline. For example, instead of this: example2 x = case f x of Nothing_ -> ... -- error: embedded pattern synonym... Just_ y -> ... -- ...used outside of 'match' contextThis can be written instead as: example3 x = f x & match \case Nothing_ -> ... Just_ y -> ...And utilising the  LambdaCase and BlockArguments syntactic extensions.The Template Haskell splice  (or ) can be used to generate the pattern synonyms for a given Haskell'98 sum or product data type. For example: data Option a = None | Some a deriving (Generic, Elt) mkPattern ''OptionWhich can then be used such as: isNone :: Elt a => Exp (Option a) -> Exp Bool isNone = match \case None_ -> True_ Some_{} -> False_ accelerate3Repeatedly apply a function a fixed number of times accelerate,Reduce along an innermost slice of an array  sequentially, 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. accelerateA recipe for generating flattened implementations of some kinds of irregular nested parallelism. Given two functions that: for each source element, determine how many target elements it expands into; andcomputes a particular target element based on a source element and the target element index associated with the sourceThe following example implements the Sieve of Eratosthenes, a contraction style algorithm which first computes all primes less than sqrt n, then uses this intermediate result to sieve away all numbers in the range  [sqrt n .. n]. The  function is used to calculate and flatten the sieves. For each prime p and upper limit c2 , function sz computes the number of contributions in the sieve. Then, for each prime p and sieve index i, the function get computes the sieve contribution. The final step produces all the new primes in the interval  [c1 .. c2].:{' primes :: Exp Int -> Acc (Vector Int) primes n = afst loop where c0 = unit 2& a0 = use $ fromList (Z:.0) []? limit = truncate (sqrt (fromIntegral (n+1) :: Exp Float)) loop = awhile. (\(T2 _ c) -> map (< n+1) c) (\(T2 old c) -> let c1 = the c6 c2 = c1 < limit ? ( c1*c1, n+1 ) -- sieves =7 let sz p = (c2 - p) `quot` p- get p i = (2+i)*p in= map (subtract c1) (expand sz get old) -- new =) let m = c2-c16 put i = let s = sieves ! i in s >= 0 && s < m ? (Just_ (I1 s), Nothing_) in afst( $ filter (> 0) $ permute const (enumFromN (I1 m) c1) put1 $ fill (shape sieves) 0 in- T2 (old ++ new) (unit c2)) (T2 a0 c0):}run $ primes 100Vector (Z :. 25) [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97]Inspired by the paper %Data-Parallel Flattening by Expansion by Martin Elsman, Troels Henriksen, and Niels Gustav Westphal Serup, ARRAY'19. 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 acceleratelength500 [2016..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None '(>?F8 w accelerate#Extracting components of fractions. accelerate The function  takes a real fractional number x and returns a pair (n,f) such that x = n+f, and:n- is an integral number with the same sign as x; andf. is a fraction with the same type and sign as x', and with absolute value less than 1.The default definitions of the , ,  and  functions are in terms of . 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 Y to any instance of w accelerateGeneralisation of X to any instance of w accelerateGeneralisation of V to any instance of w w [2019..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None ,2>?G/ accelerate&Form the ratio of two integral numbers7 [2016..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None &-9>?N/ accelerateEfficient, machine-independent access to the components of a floating-point number accelerate4The radix of the representation (often 2) (constant) accelerateThe number of digits of  in the significand (constant) accelerateThe lowest and highest values the exponent may assume (constant) accelerateReturn the significand and an appropriately scaled exponent. If (m,n) =  x then  x = m*b^^n, where b is the floating-point radix (). Furthermore, either m and n are both zero, or  b^(d-1) <= d m < b^d, where d =  x. accelerate Inverse of  accelerate'Corresponds to the second component of  accelerate&Corresponds to the first component of  accelerateMultiply a floating point number by an integer power of the radix accelerate#6 if the argument is an IEEE "not-a-number" (NaN) value accelerate#9 if the argument is an IEEE infinity or negative-infinity accelerate# if the argument is too small to be represented in normalized format accelerate#) if the argument is an IEEE negative zero accelerate#1 if the argument is an IEEE floating point number accelerateA version of arctangent taking two real floating-point arguments. For real floating x and y,  y x computes the angle (from the positive x-axis) of the vector from the origin to the point (x,y).  y x returns a value in the range [-pi, pi]. [2016..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None?P accelerate?Numbers which can be expressed as the quotient of two integers.Accelerate does not have an arbitrary precision Integer type, however fixed-length large integers are provide by the accelerate-bignum package. accelerate0Convert a number to the quotient of two integers [2016..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None->?QR accelerateName the upper and lower limits of a type. Types which are not totally ordered may still have upper and lower bounds._^ [2018..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None&,->?R ji-,+0/. ji-,+0/. [2016..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None&->?S  accelerate accelerate   321654  321654 [2018..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None&'(+>W accelerateReturns # if the argument is ! accelerateReturns # if the argument is of the form Just _ accelerateThe & function takes a default value and a  value. If the  is !, the default value is returned; otherwise, it returns the value contained in the . accelerateThe * function extracts the element out of the ", constructor. If the argument was actually !+, you will get an undefined value instead. accelerateThe 3 function takes a default value, a function, and a  value. If the  value is nothing, the default value is returned; otherwise, it applies the function to the value inside the " and returns the result accelerate!Extract from an array all of the " values, together with a segment descriptor indicating how many elements along each dimension were returned. !" !"  [2016..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None '(->?\ 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 3 monoid: sum = 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  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)These will all execute with a single reduction kernel and a single map to summarise (combine) the results. accelerateApply a  to an array. [2018..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None&'(+>a accelerateReturn # if the argument is a $-value accelerateReturn # if the argument is a %-value accelerateThe * function extracts the element out of the $, constructor. If the argument was actually %+, you will get an undefined value instead. accelerateThe * function extracts the element out of the %, constructor. If the argument was actually $+, you will get an undefined value instead. accelerateThe ( 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. accelerateExtract from the array of  all of the $ elements, together with a segment descriptor indicating how many elements along each dimension were returned. accelerateExtract from the array of  all of the % elements, together with a segment descriptor indicating how many elements along each dimension were returned. $% $% [2016..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)Noneb\_^a`DEFGHIJKLMNOPQRSUT\]VWXY[Zcdfe #(&'w [2015..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)None&'(,->?g  accelerate.The non-negative magnitude of a complex number accelerateAs , but ignore floating point rounding and use the traditional (simpler to evaluate) definition. accelerate,The phase of a complex number, in the range (-U, U]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 (-U, U]1; if the magnitude is zero, then so is the phase. accelerateForm a complex number from polar components of magnitude and phase. accelerate t# is a complex value with magnitude 1 and phase t (modulo 2*U). accelerate(Return the real part of a complex number accelerate-Return the imaginary part of a complex number accelerate experimentalnon-portable (GHC extensions)None9>?i accelerateA class of things that support almost-equality, so that we can disregard small amounts of floating-point round-off error. accelerateFails the test if the two arguments are not equal, allowing for a small amount of floating point inaccuracy.44The Accelerate standard prelude [2008..2020] The Accelerate TeamBSD3.Trevor L. McDonell  experimentalnon-portable (GHC extensions)NonelY accelerate%Array indexing in plain Haskell code. accelerate,Linear array indexing in plain Haskell code. accelerate+Rank of an array (as a plain Haskell value) accelerate,Shape of an array (as a plain Haskell value) accelerate?Total number of elements in an array (as a plain Haskell value) accelerateChange the shape of an array without altering its contents. The 4 of the source and result arrays must be identical._^a`PQSRTDEFGHIJKLMNUO]\VWXY[Zcdef  #!"&'(789:;<=>?@ABCbghklmponqrstuvwxyz{|}~xz{|}~qy&'(a`_^fedc[ZYXWV]\UONMLKJIHGFEDTRSQPwvutsrgblkh mpon #!"BC:;<=>?@A789w"""""":=>>>>>>>>>>>>>>>>>>>>>>>>RRRRRRRRRRUUUU;USUU}UU ccghijjkmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmqqrrrssttuunnpnnnonnnnnn          xxxxxxyyyyyyyy{@@@@@@@@@@@@@@@@@T@@B@V@_@A@Y@]@X@@@@[@@@@@@`@Z@\@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@                                                                     aaaaaaaaaaaaaaaaaaaaaaaaaaaaa^aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaa~aaaaaaaaaaaaaaaa<aaaaaaaaaaaaaaaaWaaa | |                            Y      !!!!!!""""""""###########################################################################$$$$$$$$$%%%%%%%%%%%%%%%%%%%%%%%%%&&&&&&&&&''''''''''''''''''''''''''''''''((((*(((((((((((++++++++,,,,,,,,,,----------------.....//////// / / / / / / / / / / / / / / / / / / 0 000 00000000 0 0 0 00 0 0 0 00_00000 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 3 3 3 3;3 3 33 3S3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 33 3 3 3 333 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3|3 3 333 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 5 5 5555 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 55 5 56 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 9 9 9 9 : : : : : > > > > > > >>>>>>>>>>>>>>>>>*> > > >     C C C C C C C C C C C C C C C C C C C C C C C C DD D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D E E F F F F F F F F F F F F F F F F F F F F G G G G G G H H H H H H H H H H H H H H I J J J K K K K L L L L L L L M M M M M M N N NN NN N N O O O O O O O O O O O P P P P P P P P P R RR_RRR R R R R R R R R R RR U U U U U U U U U U U U U U U U U U U UUU U U U U UU UU U U U U U U U U U U U U U U U;U U U U|U UUU U U U U U U U U U U U U U U U U U U U USU U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U c c c c c c c c c c c c c c c c c c c c d d d d d d e e eeeee e e e e e e e e e e e e e e e e e e e e e e e e f  x x z @    a a   )accelerate-1.3.0.0-JUAol0vo0mBEBEK4xLffPuData.Array.Accelerate$Data.Array.Accelerate.Data.Semigroup!Data.Array.Accelerate.Data.Monoid Data.Array.Accelerate.Data.Maybe Data.Array.Accelerate.Data.Ratio!Data.Array.Accelerate.Data.Either"Data.Array.Accelerate.Data.Complex!Data.Array.Accelerate.InterpreterData.Array.Accelerate.Unsafe"Data.Array.Accelerate.Data.FunctorData.Array.Accelerate.Data.BitsData.Array.Accelerate.Data.FoldData.Array.Accelerate.AST.Idx&Data.Array.Accelerate.Analysis.Hash.THData.Array.Accelerate.Async!Data.Array.Accelerate.Debug.Clock!Data.Array.Accelerate.Debug.Flags!Data.Array.Accelerate.Debug.Trace!Data.Array.Accelerate.Debug.Timed!Data.Array.Accelerate.Debug.StatsData.Array.Accelerate.ErrorData.Array.Accelerate.LifetimeSystem.Mem.WeakfinalizeWeak"Data.Array.Accelerate.Array.UniqueData.Array.Accelerate.Orphans#Data.Array.Accelerate.Sugar.Foreign'Data.Array.Accelerate.Test.NoFib.Config Data.Atomic&Data.Array.Accelerate.Debug.Monitoring Data.BitSet"Data.Array.Accelerate.Trafo.ConfigData.Primitive.VecData.Array.Accelerate.Type(Data.Array.Accelerate.Representation.Tag)Data.Array.Accelerate.Representation.Type(Data.Array.Accelerate.Representation.Vec*Data.Array.Accelerate.Representation.Shape*Data.Array.Accelerate.Representation.Slice!Data.Array.Accelerate.Sugar.Slice enumSlicesData.Array.Accelerate.AST.Var&Data.Array.Accelerate.AST.LeftHandSide%Data.Array.Accelerate.AST.Environment(Data.Array.Accelerate.Representation.Elt Data.Array.Accelerate.Array.Data*Data.Array.Accelerate.Representation.Array,Data.Array.Accelerate.Representation.Stencil(Data.Array.Accelerate.Array.Remote.ClassData.Array.Accelerate.ASTData.Array.Accelerate.Trafo.Var"Data.Array.Accelerate.Pretty.Print*Data.Array.Accelerate.Pretty.Graphviz.Type+Data.Array.Accelerate.Pretty.Graphviz.Monad#Data.Array.Accelerate.Analysis.HashLanguage.Haskell.TH.ExtraData.Array.Accelerate.Sugar.EltExpmatchData.Array.Accelerate.Sugar.Vec!Data.Array.Accelerate.Sugar.ShapetoSeqData.Array.Accelerate.Languageslice replicate$Data.Array.Accelerate.Analysis.Match(Data.Array.Accelerate.Trafo.Substitution$Data.Array.Accelerate.Trafo.LetSplit'Data.Array.Accelerate.Trafo.Environment"Data.Array.Accelerate.Trafo.Shrink#Data.Array.Accelerate.Trafo.Delayed#Data.Array.Accelerate.Trafo.Algebra$Data.Array.Accelerate.Trafo.Simplify"Data.Array.Accelerate.Trafo.Fusion%Data.Array.Accelerate.Pretty.GraphvizData.Array.Accelerate.Debug*Data.Array.Accelerate.Array.Remote.Nursery(Data.Array.Accelerate.Array.Remote.Table&Data.Array.Accelerate.Array.Remote.LRU"Data.Array.Accelerate.Array.Remote!Data.Array.Accelerate.Sugar.ArrayAccuseData.Array.Accelerate.Smartgeneratethefoldmap backpermutescanlstencilzipWithunzipreshapepermuteData.Array.Accelerate.Preludefill#Data.Array.Accelerate.Trafo.SharingData.Array.Accelerate.Trafo%Data.Array.Accelerate.Test.NoFib.Base Data.Array.Accelerate.Test.NoFib!Data.Array.Accelerate.Classes.Num(Data.Array.Accelerate.Classes.Fractional&Data.Array.Accelerate.Classes.Floating(Data.Array.Accelerate.Classes.ToFloating"Data.Array.Accelerate.Classes.EnumData.Array.Accelerate.PrettyData.Array.Accelerate.PatternData.Array.Accelerate.Liftliftunlift Data.Array.Accelerate.Pattern.TH&Data.Array.Accelerate.Pattern.Ordering#Data.Array.Accelerate.Pattern.Maybe$Data.Array.Accelerate.Pattern.Either"Data.Array.Accelerate.Pattern.BoolPrelude$ Data.Array.Accelerate.Classes.Eq!Data.Array.Accelerate.Classes.Ord"Data.Array.Accelerate.Classes.Real&Data.Array.Accelerate.Classes.IntegralFoldundef transposecompute*Data.Array.Accelerate.Classes.FromIntegral Data.Function& mkPattern mkPatterns&Data.Array.Accelerate.Classes.RealFrac'Data.Array.Accelerate.Classes.RealFloat&Data.Array.Accelerate.Classes.Rational%Data.Array.Accelerate.Classes.BoundedData.Array.Accelerate.Classes"Data.Array.Accelerate.Test.SimilarbaseGHC.Base otherwiseGHC.Num fromInteger-GHC.Real fromRationalnegate<>memptymappendmconcatGHC.ShowShow GHC.GenericsGeneric SemigroupMonoidghc-prim GHC.TypesBoolCharDoubleFloatIntGHC.IntInt8Int16Int32Int64 GHC.MaybeMaybeOrderingRatioWordGHC.WordWord8Word16Word32Word64 Data.EitherEitherFalseNothingJustTrueLeftRightLTEQGT Data.Complex:+ComplexData.SemigroupgetMinMingetMaxMaxData.Semigroup.InternalgetSumSum getProductProductForeign.C.TypesCCharCSCharCUCharCShortCUShortCIntCUIntCLongCULongCLLongCULLongCFloatCDouble GHC.FloatatanhacoshasinhtanhcoshsinhatanacosasintancossinlogBase**sqrtlogexppidivModquotRemmoddivremquotrecip/GHC.EnummaxBoundminBoundpredsuccsignumabs*+.conststimessconcatGHC.Err undefinederrorGHC.Stack.Types HasCallStackhalf-0.3-5I6Y1Z6OYBD6TOLu4NSPvX Numeric.HalfgetHalfHalfVecVec16Vec8Vec4Vec3Vec2RealFracEltVecEltSlice SliceShape CoSliceShape FullShape sliceIndexShapeAnyAll:.ZDIM9DIM8DIM7DIM6DIM5DIM4DIM3DIM2DIM1DIM0ArraysArraySegmentsMatrixVectorScalar fromFunction fromFunctionMfromListtoListCoerceStencilBoundaryconstant indexHead indexTailcoerce Afunction AfunctionRNum FractionalFloating ToFloating toFloatingEnumrunrun1runNevalCoerceScalar evalPrimConstevalPrimIx::.Z_PatternV16V8V4V3V2I9I8I7I6I5I4I3I2I1I0T16T15T14T13T12T11T10T9T8T7T6T5T4T3T2GT_EQ_LT_Just_Nothing_Right_Left_True_False_UnliftLiftPlainlift1lift2lift3ilift1ilift2ilift3Functorfmap<$<$>$>void $fFunctorMax $fFunctorMin$fFunctorProduct $fFunctorSumEq==/=&&||notOrd<><=>=minmaxcompareIntegral Stencil5x5x5 Stencil3x5x5 Stencil5x3x5 Stencil5x5x3 Stencil3x3x5 Stencil3x5x3 Stencil5x3x3 Stencil3x3x3 Stencil5x5 Stencil3x5 Stencil5x3 Stencil3x3Stencil9Stencil7Stencil5Stencil3unitfold1foldSeg' fold1Seg'scanl'scanl1scanrscanr'scanr1stencil2clampmirrorwrapfunction foreignAcc foreignExp>->acondawhiletoIndex fromIndex intersectcondwhile!!!shapesize shapeSizesubtractevenoddgcdlcm^^^ordchr boolToIntbitcast FiniteBits finiteBitSizecountLeadingZeroscountTrailingZerosBits.&..|.xor complementshiftrotatezeroBitsbitsetBitclearBit complementBittestBitisSignedshiftL unsafeShiftLshiftR unsafeShiftRrotateLrotateRpopCount $fBitsCUChar $fBitsCSChar $fBitsCChar $fBitsCUShort $fBitsCShort $fBitsCULLong $fBitsCLLong $fBitsCULong $fBitsCLong $fBitsCUInt $fBitsCInt $fBitsWord64 $fBitsWord32 $fBitsWord16 $fBitsWord8 $fBitsWord $fBitsInt64 $fBitsInt32 $fBitsInt16 $fBitsInt8 $fBitsInt $fBitsBool$fFiniteBitsCUChar$fFiniteBitsCSChar$fFiniteBitsCChar$fFiniteBitsCUShort$fFiniteBitsCShort$fFiniteBitsCULLong$fFiniteBitsCLLong$fFiniteBitsCULong$fFiniteBitsCLong$fFiniteBitsCUInt$fFiniteBitsCInt$fFiniteBitsWord64$fFiniteBitsWord32$fFiniteBitsWord16$fFiniteBitsWord8$fFiniteBitsWord$fFiniteBitsInt64$fFiniteBitsInt32$fFiniteBitsInt16$fFiniteBitsInt8$fFiniteBitsInt$fFiniteBitsBool FromIntegral fromIntegral IfThenElseEltT ifThenElseindexedimapzipWith3zipWith4zipWith5zipWith6zipWith7zipWith8zipWith9izipWith izipWith3 izipWith4 izipWith5 izipWith6 izipWith7 izipWith8 izipWith9zipzip3zip4zip5zip6zip7zip8zip9unzip3unzip4unzip5unzip6unzip7unzip8unzip9foldAllfold1AllfoldSegfold1Segallanyandorsumproductminimummaximumprescanl postscanlprescanr postscanrscanlSeg scanl'Seg scanl1Seg prescanlSeg postscanlSegscanrSeg scanr'Seg scanr1Seg prescanrSeg postscanrSegflatten enumFromN enumFromStepN++concatOnfiltercompactgatherscatterreverse reverseOn transposeOntakedropinittailslitinitOntailOntakeOndropOnslitOn?|?iteratesfoldlfstafstsndasndcurryuncurryindex0index1unindex1index2unindex2index3unindex3nulllengthexpand RealFloat floatRadix floatDigits floatRange decodeFloat encodeFloatexponent significand scaleFloatisNaN isInfiniteisDenormalizedisNegativeZeroisIEEEatan2properFractiontruncateroundceilingfloordiv'mod'divMod':% numerator denominator% $fEnumExp$fFromIntegralaRatio$fToFloatingRatiob$fRealFracRatio$fFractionalExp$fNumExp $fOrdRatio $fEqRatio $fEltRatioRational toRationalBoundedMax_Min_$fSemigroupExp$fSemigroupExp0$fSemigroupExp1$fSemigroupExp2$fSemigroupExp3 $fMonoidExp$fSemigroupExp4$fOrdMax$fEqMax $fBoundedExp$fUnliftExpMax $fLiftExpMax$fEltMax $fMonoidExp0$fSemigroupExp5$fOrdMin$fEqMin $fNumExp0 $fBoundedExp0$fUnliftExpMin $fLiftExpMin$fEltMinProduct_Sum_ $fMonoidExp1 $fMonoidExp2 $fMonoidExp3 $fMonoidExp4 $fOrdProduct $fEqProduct$fUnliftExpProduct$fLiftExpProduct $fEltProduct $fMonoidExp5$fOrdSum$fEqSum$fUnliftExpSum $fLiftExpSum$fEltSum isNothingisJust fromMaybefromJustmaybejusts$fLiftExpMaybe $fOrdMaybe $fEqMaybe$fFunctorMayberunFold$fFloatingFold$fFractionalFold $fNumFold$fApplicativeFold $fFunctorFoldisLeftisRightfromLeft fromRighteitherleftsrights$fLiftExpEither $fOrdEither $fEqEither$fFunctorEither::+ magnitude magnitude'phasepolarmkPolarcisrealimag conjugate$fFunctorComplex$fFromIntegralaComplex $fFloatingExp $fEqComplex$fUnliftExpComplex$fLiftExpComplex $fEltComplex indexArraylinearIndexArray arrayRank arrayShape arraySize arrayReshapePairIdx PairIdxRight PairIdxLeftIdxSuccIdxZeroIdxidxToIntrnfIdxliftIdxhashQ hashWithSaltQasyncasyncOn GHC.Conc.SyncforkOn asyncBoundControl.ConcurrentforkOSwaitpollcancelAsyncgetProgramTimegetMonotonicTimewhenunlessValueFlagmax_simplifier_iterationsunfolding_use_threshold__cmd_line_flagssetValuegetValuegetFlagsetFlag clearFlagsetFlags clearFlags seq_sharing acc_sharing exp_sharing array_fusionsimplifyinplace fast_mathfast_permute_const flush_cache force_recompdebugverbose dump_phases dump_sharing dump_fusiondump_simpl_statsdump_simpl_iterationsdump_vectorisationdump_dotdump_simpl_dotdump_gc dump_gc_statsdump_ccdump_lddump_asm dump_exec dump_schedshowFFloatSIBasetracetraceIO traceEvent putTraceMsg traceEventIOtimedelapsedinline ruleFired knownBranchcaseElim caseDefault betaReduce substitutionsimplifierDone fusionDoneresetSimplCountdumpSimplStats simplCount internalError internalCheck indexCheckinternalWarning boundsError unsafeError boundsCheck unsafeCheck boundsWarning unsafeWarning newLifetimeLifetime withLifetime touchLifetime addFinalizermkWeakunsafeGetValue mkWeakPtr UniqueArraynewUniqueArraywithUniqueArrayPtrunsafeIndexArrayunsafeReadArrayunsafeWriteArrayunsafeUniqueArrayPtrGHC.ForeignPtrunsafeForeignPtrToPtrtouchUniqueArrayuniqueArrayData uniqueArrayIdrnfUniqueArrayliftUniqueArrayForeign liftForeign strForeign TestConfigat Interpreter TestWord64 TestWord32 TestWord16 TestWord8 TestInt64 TestInt32 TestInt16TestInt8 TestDouble TestFloatTestHalfTestAllnofibIngredientAtomicaddwritereadbeginMonitoringinitAccMetrics withProcessoraddProcessorTimedidAllocateBytesLocaldidCopyBytesFromRemote didRemoteGC didEvictBytes ProcessorNativePTXdidAllocateBytesRemoteincreaseCurrentBytesRemotedecreaseCurrentBytesRemotedidCopyBytesToRemoteincreaseCurrentBytesNurserydecreaseCurrentBytesNurserysetCurrentBytesNurserygetCurrentBytesNurseryBitSetmemberempty singletoninsertdeleteunion difference\\ intersectionfoldl'foldrgetBitsConfigoptionsdefaultOptions listOfVecliftVec BitSizeEqIsScalarIsSingle IsBoundedIsNum IsFloating IsIntegral ScalarType BoundedTypeNumType FloatingType IntegralTypeCBoolCPtrdiffCSizeCWchar CSigAtomicCClockCTime CUSeconds CSUSecondsCFileCFposCJmpBufCIntPtrCUIntPtrCIntMaxCUIntMax bitReverse64 bitReverse32 bitReverse16 bitReverse8 byteSwap64 byteSwap32 byteSwap16BitSize scalarType singleType boundedTypenumType floatingType integralType VectorType SingleType NumSingleTypeSingleScalarTypeVectorScalarTypeIntegralBoundedTypeIntegralNumTypeFloatingNumType TypeDoubleTypeHalf TypeFloat TypeWord64 TypeWord32 TypeWord16 TypeWord8TypeWord TypeInt64 TypeInt32 TypeInt16TypeIntTypeInt8 FloatingDict IntegralDict SingleDict integralDict floatingDict singleDict scalarTypeIntscalarTypeWordscalarTypeInt32scalarTypeWord8scalarTypeWord32 rnfScalarType rnfSingleType rnfVectorTypernfBoundedType rnfNumTypernfIntegralTypernfFloatingType liftScalar liftSingle liftVectorliftNum liftIntegral liftFloatingliftScalarTypeliftSingleTypeliftVectorType liftNumTypeliftBoundedTypeliftIntegralTypeliftFloatingTypeTagRTAGTagRpairTagRtag TagRundef TagRsingleTagRunitrnfTagliftTagTupRTypeRTupRpair TupRsingleTupRunitrnfTupRrnfTypeRliftTupR liftTypeR liftTypeQTup16Tup15Tup14Tup13Tup12Tup11Tup10Tup9Tup8Tup7Tup6Tup5Tup4Tup3Tup2VecRpackunpackVecRsuccVecRnil vecRvector vecRtuplernfVecRliftVecRShapeR showShaperankiteriter1 rangeToShape shapeToRange shapeToList listToShape listToShape' ShapeRsnocShapeRzdim0dim1dim2dim3eq shapeTypernfShape rnfShapeR liftShapeR SliceIndex sliceShape SliceFixedSliceAllSliceNil sliceShapeR sliceDomainR rnfSliceIndexliftSliceIndexVarsVarvarsTypernfVarrnfVarsliftVarliftVars LeftHandSideLeftHandSidePairLeftHandSideWildcardLeftHandSideSingleExistsLeftHandSideUnit lhsToTupRrnfLeftHandSideliftLeftHandSide:>Weaken>:>ValPushEmptypushprjweakenId weakenSucc' weakenSucc weakenEmptysink.> sinkWithLHS weakenWithLHSundefEltbytesEltshowEltshowsEltliftEltScalarArrayDataR GArrayDataRMutableArrayData ArrayData runArrayDataregisterForeignPtrAllocator HTYPE_INT HTYPE_WORD HTYPE_CLONG HTYPE_CULONG HTYPE_CCHARSingleArrayDictScalarArrayDictScalarArrayDatascalarArrayDictsingleArrayDict newArrayDataindexArrayData readArrayDatawriteArrayDataunsafeArrayDataPtrtouchArrayData rnfArrayData liftArrayDataArrayR allocateArrayArraysR arrayRtype arrayRshape showArraysR arraysRarray arraysRpair concatVectors showArrayshowArrayShort showMatrix reduceRankrnfArray rnfArrayR rnfArraysR liftArrayR liftArraysR liftArrayStencilR StencilRunit3 StencilRunit5 StencilRunit7 StencilRunit9 StencilRtup3 StencilRtup5 StencilRtup7 StencilRtup9 stencilEltR stencilShapeRstencilR stencilArrayR stencilHalo rnfStencilR liftStencilR RemoteMemory RemotePtr mallocRemote pokeRemote peekRemote castRemotePtrtotalRemoteMemavailableRemoteMemremoteAllocationSizePrimFun PrimConstOpenExpFunOpenFun PreOpenAccAfunPreAfun PreOpenAfunLiftAcc NFDataAcc HasArraysRarraysRPrimAddPrimSubPrimMulPrimNegPrimAbsPrimSigPrimQuotPrimRem PrimQuotRemPrimIDivPrimMod PrimDivModPrimBAndPrimBOrPrimBXorPrimBNot PrimBShiftL PrimBShiftR PrimBRotateL PrimBRotateR PrimPopCountPrimCountLeadingZerosPrimCountTrailingZerosPrimFDiv PrimRecipPrimSinPrimCosPrimTanPrimAsinPrimAcosPrimAtanPrimSinhPrimCoshPrimTanh PrimAsinh PrimAcosh PrimAtanhPrimExpFloatingPrimSqrtPrimLogPrimFPow PrimLogBase PrimTruncate PrimRound PrimFloor PrimCeiling PrimAtan2 PrimIsNaNPrimIsInfinitePrimLtPrimGtPrimLtEqPrimGtEqPrimEqPrimNEqPrimMaxPrimMinPrimLAndPrimLOrPrimLNotPrimFromIntegralPrimToFloating PrimMinBound PrimMaxBoundPrimPiPairNilConstIndexEvarLetVecPack VecUnpack IndexSlice IndexFullToIndex FromIndexCaseCondWhilePrimApp LinearIndex ShapeSizeUndefExpVarsExpVar ELeftHandSideBodyLamConstantFunctionClampMirrorWrap Direction LeftToRight RightToLeftUnitPermuteMapApplyScanAletAvarApairAnilAforeignAcondAwhileUseReshapeGenerate Transform ReplicateZipWithFoldSegScan' BackpermuteStencil2 PrimMaybePrimBool ArrayVarsArrayVar ALeftHandSideOpenAccOpenAfunAbodyAlamexpVarsarrayRexpType primConstType primFunType rnfOpenAfunrnfPreOpenAfun rnfOpenAcc rnfPreOpenAcc rnfArrayVarrnfALeftHandSide rnfBoundary rnfOpenFun rnfOpenExp rnfExpVarrnfELeftHandSidernfConst rnfPrimConst rnfPrimFunliftPreOpenAfunliftPreOpenAccliftALeftHandSide liftArrayVar liftOpenFun liftOpenExpliftELeftHandSide liftExpVar liftBoundary liftPrimConst liftPrimFun showPreAccOp showExpOp ExtractAcc InjectAcc DeclareVars declareVarsavarInavarsInavarsOut PrettyEnv prettyEnvOperatoropNameopFixityopAssociativity opPrecedenceContext ctxPrecedencectxAssociativity ctxPositionKeywordDelayed Statement ConditionalManifestAdoc PrettyAccmanifestdelayed ansiKeywordprettyPreOpenAfunprettyPreOpenAcc prettyALhs prettyELhs prettyArray prettyFun prettyExp prettyOpenFun prettyOpenExp prettyConst needsParenscontext0appisInfix primOperatorsizeEnv shiftwidthparensIfEdgeVertexPortLabelNodeIdNodeGNEGraphTreeLeafForestppGraph ppSubgraph ppStatementppEdgeppVertexppNode ppNodeTreeppNodeIdDotStatedotNodesdotEdgesdotGraphfreshDot emptyStaterunDotevalDotexecDotmkLabelmkNodeIdmkGraph mkSubgraphperfect EncodeAcc HashOptionsHashdefaultHashOptionshashPreOpenAcchashPreOpenAccWith hashOpenFun hashOpenExpencodePreOpenAccencodeArraysType encodeOpenExp encodeOpenFuntupTtupPtupE tyVarBndrNameEltReltRtagsRfromElttoEltDivisionshapeR sliceAnyIndexsliceNoneIndexDivideSplit slicesIndex DivisionSliceData.Type.Equality:~:ReflMatchAccmatchPreOpenAccmatchPreOpenAfunmatchALeftHandSidematchELeftHandSidematchLeftHandSide matchTupR matchArraysR matchArrayR matchOpenExp matchOpenFunmatchIdxmatchVar matchVars matchPrimFun matchPrimFun' matchTypeRmatchShapeType matchShapeRmatchScalarTypematchSingleType matchNumTypematchIntegralTypematchFloatingTypecompose RebuildAcc:?>SinkExpweakenESinkweaken OpenAccFun unOpenAccFun OpenAccExp unOpenAccExpRebuildableAccRebuildableExprebuildErebuildPartialE RebuildableAccClorebuildPartialrebuildAbindingIsTrivial isIdentityisIdentityIndexing inlineVarssubTopsubAtop weakenVarsrebuildWeakenVar strengthen strengthenE rebuildLHSextractExpVars convertAfun convertAccOpenExp'ExtendPushEnvBaseEnv WeakOpenExpSubstGammaPushExpEmptyExpincExpprjExppushExp pushArrayEnvappendbindsinkAsink1 sinkWeakenbindExps UsesOfAcc ShrinkAcc shrinkExp shrinkFun usesOfExp usesOfPreAccDelayedOpenAcc linearIndexDindexDextentDreprDDelayedOpenAfun DelayedAfun DelayedAccencodeDelayedOpenAccmatchDelayedOpenAccrnfDelayedOpenAccliftDelayedOpenAcc evalPrimApp simplifyExp simplifyFun+++convertAccWithconvertAfunWithgraphDelayedAccgraphDelayedAfunDetailSimpleFull PrettyGraph dumpGraphdebuggingIsEnabledmonitoringIsEnabledboundsChecksAreEnabledunsafeChecksAreEnabledinternalChecksAreEnablednewlookupcleanupNurseryNRS StableArrayfreemalloc freeStableinsertUnmanagedreclaimmakeStableArraymakeWeakArrayData MemoryTableTask completed withRemoteGArraysgfromArrgtoArrgarraysGArraysRfromArrtoArr PreSmartExp PreSmartAccApplyAcc FromApplyAccapplyAcc mkCoerce'HasTypeRtypeR stencilPrj PreBoundaryMatchTagPrjSmartExpAtagPipeAprjLevelSmartAcc mkMinBound mkMaxBoundmkPimkSinmkCosmkTanmkAsinmkAcosmkAtanmkSinhmkCoshmkTanhmkAsinhmkAcoshmkAtanh mkExpFloatingmkSqrtmkLogmkFPow mkLogBasemkAddmkSubmkMulmkNegmkAbsmkSigmkQuotmkRem mkQuotRemmkIDivmkModmkDivModmkBAndmkBOrmkBXormkBNot mkBShiftL mkBShiftR mkBRotateL mkBRotateR mkPopCountmkCountLeadingZerosmkCountTrailingZerosmkFDivmkRecip mkTruncatemkRoundmkFloor mkCeilingmkAtan2mkIsNaN mkIsInfinitemkLtmkGtmkLtEqmkGtEqmkEqmkNEqmkMaxmkMinmkLAndmkLOrmkLNotmkFromIntegral mkToFloating mkBitcastmkCoerce$$$$$$$$$$$$$$unAcc unAccFunctionmkExpunExp unExpFunctionunExpBinaryFunctionunPair mkPairToTuple showPreExpOp convertFun convertExp functionRepr FunctionR EltFunctionR FunctionReprFunctionReprBodyFunctionReprLam afunctionReprArraysFunctionR AfunctionReprAfunctionReprBodyAfunctionReprLamconvertFunWithconvertExpWithRunNRunarrayinti8i16i32i64wordw8w16w32w64f16f32f64v2v3v4v8v16 log_flt_maxflt_maxflt_minexcept splitEvery splitPlacesnofib realToFrac&&!||!Realinteger-wired-inGHC.Integer.TypeInteger"lens-4.19.2-Jl3hAslYj5k5EjJvxOpFAbControl.Lens.TypeLens'gatherIf scatterIf ApplicativeSimilar~~~~=Sim absRelTol