w      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~         ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a bcdefghijklmnopqrstuvwxyz{|}~ (c) Christopher ChalmersBSD3Christopher Chalmers provisional non-portableNone069:;<=?DORT[9(Exception thown from missmatching sizes.:Extract information about an ;. : ::  ;  : ::    ;/Thrown when two sizes that should match, don't.=Class of things that have a H^. This means we can use the same functions for the various different arrays in the library.>Lens onto the H of something.?AClass for types that can be converted to and from linear indexes.@.Convert a shape to its linear index using the H.A&Convert a linear index to a shape the H.B)Calculate the intersection of two shapes.CFIncrement a shape by one. It is assumed that the provided index is inRange.DFIncrement a shape by one. It is assumed that the provided index is inRange.E/Increment a shape by one between the two boundsF inRange ex i checks i < ex for every coordinate of f.G"The number of elements in a shape.HA H is the full size of an array. This alias is used to help distinguish between the layout of an array and an index (usually just l Int) in a type signature.ItoIndex l and  fromIndex l" form two halfs of an isomorphism.JGet the extent of an array. J ::   v f a -> f  J ::   v f s a -> f  J ::   f a -> f  J ::  f a -> f  K-Get the total number of elements in an array. K ::   v f a ->  K ::   v f s a ->  K ::   f a ->  K ::  f a ->  L/Indexed fold for all the indexes in the layout.ML for a ?.NoIndexed fold starting starting from some point, where the index is the linear index for the original layout.ON for a ?.PdIndexed fold between the two indexes where the index is the linear index for the original layout.QP for a ?.RboundsCheck l i# performs a bounds check for index i and layout l . Throws an , exception when out of range in the form (i, l). This can be caught with the  prism.(boundsCheck (V2 3 5) (V2 1 4) "in range" "in range",boundsCheck (V2 10 20) (V2 10 5) "in bounds"="*** Exception: array index out of range: (V2 10 5, V2 10 20)Rcatching _IndexOutOfBounds (boundsCheck (V1 2) (V1 2) (putStrLn "in range")) print"(V1 2, V1 2)"3The output format is suitable to be read using the  prism:xtrying (_IndexOutOfBounds . _Show) (boundsCheck (V1 2) (V1 20) (putStrLn "in range")) :: IO (Either (V1 Int, V1 Int) ())Left (V1 20,V1 2)S)Check the sizes are equal. If not, throw ;.TShow a shape in the form VN i1 i2 .. iN where N is the  of the shape.+9:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`ab9:;<=>?@ABCDGEFHIJKLMNOPQRST H?@ABCDEFGIMOQ=>>JKLPNR;<9:ST 9:;<=>>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`ab(c) Christopher ChalmersBSD3Christopher Chalmers provisional non-portableNone 09;<=DR"cPrimitive mutable array.dStorable mutable array.eUnboxed mutable array.fBoxed mutable array.gA mutable array with a shape.ipLens onto the shape of the vector. The total size of the layout _must_ remain the same or an error is thrown.jIIndexed lens over the underlying vector of an array. The index is the J of the array. You must notG change the length of the vector, otherwise an error will be thrown.kNew mutable array with shape l.lNew mutable array with shape l filled with element a.mNew mutable array with shape l) filled with result of monadic action a.n<Clone a mutable array, making a new, separate mutable array.oUClear the elements of a mutable array. This is usually a no-op for unboxed arrays.p Read a mutable array at element l.q!Write a mutable array at element l.r"Modify a mutable array at element l by applying a function.s%Swap two elements in a mutable array.tGReplace the element at the give position and return the old element.u Read a mutable array at element i$ by indexing the internal vector.v!Write a mutable array at element i$ by indexing the internal vector.wHSwap two elements in a mutable array by indexing the internal vector.x"Modify a mutable array at element i by applying a function.yGReplace the element at the give position and return the old element.zp without bounds checking.{q without bounds checking.|s without bounds checking.}r without bounds checking.~GReplace the element at the give position and return the old element.u without bounds checking.v without bounds checking.w without bounds checking.x without bounds checking.GReplace the element at the give position and return the old element.8Set all elements in a mutable array to a constant value..Copy all elements from one array into another.%cdefghijklmnopqrstuvwxyz{|}~#cdefghijklmnopqrstuvwxyz{|}~#ghedfcijklmnpuzqv{rx}sw|ty~o$cdefghijklmnopqrstuvwxyz{|}~(c) Christopher ChalmersBSD3Christopher Chalmers provisional non-portableNone*/0259:;<=DORT\hA delayed representation of an array with a focus on a single element. This element is the target of  .[A delayed representation of an array. This useful for mapping over an array in parallel.The vector is the boxed vector.An  is a vector with a shape.cIndexed traversal over the elements of an array. The index is the current position in the array.IIndexed lens over the underlying vector of an array. The index is the Jn of the array. You must _not_ change the length of the vector, otherwise an error will be thrown (even for % layouts, use flat for %).O(1) Unsafe convert a mutable array to an immutable one without copying. The mutable array may not be used after this operation.O(1) Unsafely convert an immutable array to a mutable one without copying. The immutable array may not be used after this operation.=Turn a material array into a delayed one with the same shape.#Index a delayed array, returning a + exception if the index is out of range.>Parallel manifestation of a delayed array into a material one. Generate a  array using the given H and construction function.Index relative to focus.Index relative to focus.Index relative to focus.Index relative to focus.The K of the > must' remain the same or an error is thrown. in parallel. in parallel.The K of the > must' remain the same or an error is thrown.#1D Arrays can be used as a generic .The K of the > must' remain the same or an error is thrown.@=(c) Christopher ChalmersBSD3Christopher Chalmers provisional non-portableNone09:;<=DORT[\LCThe boundary condition used for indexing relative elements in a .,clamp coordinates to the extent of the array*mirror coordinates beyond the array extent)wrap coordinates around on each dimension array. array. ed array. array.Same as $ but restrictive in the vector type.Traverse over the  between two indexes.Z1D arrays are just vectors. You are free to change the length of the vector when going  this  (unlike linear). Note that % arrays are an instance of + so you can use any of the functions in Data.Vector.Generic' on them without needing to convert.1Contruct a flat array from a list. (This is just  from .)O(n) Convert the first nA elements of a list to an Array with the given shape. Returns 1 if there are not enough elements in the list.O(n) Convert the first ng elements of a list to an Array with the given shape. Throw an error if the list is not long enough.Create an array from a  and a > . Return ) if the vector is not the right shape.Create an array from a  and a >:. Throws an error if the vector is not the right shape. The empty  with a 7 shape.Test is if the array is .%Index an element of an array. Throws " if the index is out of bounds.Safe index of an element.5Index an element of an array without bounds checking.6Index an element of an array while ignoring its shape.RIndex an element of an array while ignoring its shape, without bounds checking.O(1) Indexing in a monad.zThe monad allows operations to be strict in the vector when necessary. Suppose vector copying is implemented like this: &copy mv v = ... write mv i (v ! i) ...For lazy vectors, v ! i, would not be evaluated which means that mv+ would unnecessarily retain a reference to v in each element written.With /, copying can be implemented like this instead: 3copy mv v = ... do x <- indexM v i write mv i xHere, no references to v$ are retained because indexing (but not' the elements) is evaluated eagerly.-Throws an error if the index is out of range.O(1)0 Indexing in a monad without bounds checks. See - for an explanation of why this is useful.O(1)F Indexing in a monad. Throws an error if the index is out of range.O(1)0 Indexing in a monad without bounds checks. See - for an explanation of why this is useful.:Execute the monadic action and freeze the resulting array.CO(n) Array of the given shape with the same value in each position.UO(n) Construct an array of the given shape by applying the function to each index.UO(n) Construct an array of the given shape by applying the function to each index.^O(n) Construct an array of the given shape by filling each position with the monadic value.]O(n) Construct an array of the given shape by applying the monadic function to each index.]O(n) Construct an array of the given shape by applying the monadic function to each index.O(n) Map a function over an arrayO(n)< Apply a function to every element of a vector and its indexSFor each pair (i,a) from the list, replace the array element at position i by a.O(m+n) For each pair (i,b)- from the list, replace the array element a at position i by f a b.Generate a stream from a Layout' s indices.Generate a stream from a Layout' s indices.Stream a sub-layout of an R. The layout should be shapeInRange of the array's layout, this is not checked.Stream a sub-layout of an ."Make a stream of the indexes of a H.Generate a bundle from H indices.Generate a bundle from H indices.+Generate a bundle of indexes for the given H.Zip two arrays element wise. If the array's don't have the same shape, the new array with be the intersection of the two shapes.Zip three arrays element wise. If the array's don't have the same shape, the new array with be the intersection of the two shapes.Zip two arrays using the given function. If the array's don't have the same shape, the new array with be the intersection of the two shapes.Zip three arrays using the given function. If the array's don't have the same shape, the new array with be the intersection of the two shapes.Zip two arrays using the given function with access to the index. If the array's don't have the same shape, the new array with be the intersection of the two shapes.Zip two arrays using the given function with access to the index. If the array's don't have the same shape, the new array with be the intersection of the two shapes.IIndexed traversal over the rows of a matrix. Each row is an efficient  of the original vector.traverseOf_ rows print m [a,b,c,d] [e,f,g,h] [i,j,k,l]/Affine traversal over a single row in a matrix.0traverseOf_ rows print $ m & ixRow 1 . each *~ 2 [a,b,c,d][e * 2,f * 2,g * 2,h * 2] [i,j,k,l]zThe row vector should remain the same size to satisfy traversal laws but give reasonable behaviour if the size differs:8traverseOf_ rows print $ m & ixRow 1 .~ B.fromList [0,1] [a,b,c,d] [0,1,g,h] [i,j,k,l];traverseOf_ rows print $ m & ixRow 1 .~ B.fromList [0..100] [a,b,c,d] [0,1,2,3] [i,j,k,l]7Indexed traversal over the columns of a matrix. Unlike *, each column is a new separate vector.traverseOf_ columns print m[a,e,i][b,f,j][c,g,k][d,h,l]>traverseOf_ rows print $ m & columns . indices odd . each .~ 0 [a,0,c,0] [e,0,g,0] [i,0,k,0]The vectors should be the same size to be a valid traversal. If the vectors are different sizes, the number of rows in the new array will be the length of the smallest vector.2Affine traversal over a single column in a matrix.3traverseOf_ rows print $ m & ixColumn 2 . each +~ 1 [a,b,c + 1,d] [e,f,g + 1,h] [i,j,k + 1,l]RTraversal over a single plane of a 3D array given a lens onto that plane (like !, , ).LTraversal over all planes of 3D array given a lens onto that plane (like !, , ).QFlatten a plane by reducing a vector in the third dimension to a single value.This : should not have any duplicates in the list of indices.2O(n) Yield a mutable copy of the immutable vector.2O(n) Yield an immutable copy of the mutable array.lIsomorphism between an array and its delayed representation. Conversion to the array is done in parallel.lIsomorphism between an array and its delayed representation. Conversion to the array is done in parallel.,Sequential manifestation of a delayed array. an array to a  and delay again. See Data.Dense.Boxed or Data.Dense.Storable to  for other types of arrays. an array to a  and delay again. See Data.Dense.Boxed or Data.Dense.Storable to  for other types of arrays. 1Focus on a particular element of a delayed array. 0Discard the focus to retrieve the delayed array. :Indexed lens onto the delayed array, indexed at the focus.  Modify a $ array by extracting a value from a  each point. Lens onto the position of a .   ::  ( l a) (l ) ?Focus on a neighbouring element, relative to the current focus.Index a focused using a  condition.7Index an element relative to the current focus using a  condition.\Index an element by applying a function the current position, using a boundary condition.[accumulating function f initial array%list of index/value pairs (of length n)     k=>?@ABCDGEFHJKLNPcdefg     l?@ABCDEFG=>>HJKLNPgfedc     X     (c) Christopher ChalmersBSD3Christopher Chalmers provisional non-portableNone 29;<=OTWStencils are used to fold over neighbouring array sites. To construct a stencil use , >. For static sized stencils you can use the quasiquoter  .To use a stencil you can use  or use the  and  instances.#Make a stencil folding over a list.cIf the list is staticlly known this should expand at compile time via rewrite rules, similar to  x but less reliable. If that does not happen the resulting could be slow. If the list is not know at compile time, O can be signifcantly faster (but isn't subject expending via rewrite rules).<Make a stencil folding over an unboxed vector from the list.Sum the elements around a  using a  condition and a .'This is often used in conjunction with .   (c) Christopher ChalmersBSD3Christopher Chalmers experimental non-portableNone 29;<=OT[Class of shapes that can be ed.#This is to prevent orphans for the  class. for ?s. Polymorphic  for a ?s. QuasiQuoter for producing a dense arrays using a custom parser. Values are space separated, while also allowing infix expressions (like 5/7d). If you want to apply a function, it should be done in brackets. Supports 1D, 2D and 3D arrays.GThe number of rows/columns must be consistent thought out the array.ExamplesI1D arrays are of the following form form. Note these can be used as %,   or  arrays. [ | 5 -3 1 -3 5 |] :: (' f,  v a,  a) =>   v f a D2D arrays are of the following form. Note these can be used as   or  arrays.  chars ::     chars :: [ /| 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' |] B3D arrays are of the following form. Note the order in which   formats the array. The array a is such that a !  x y z = "xyz" a ::    a = [ | "000" "100" "200" "010" "110" "210" "020" "120" "220" "001" "101" "201" "011" "111" "211" "021" "121" "221" "002" "102" "202" "012" "112" "212" "022" "122" "222" |] mList of expressions forming a stencil. To be either turned into either a real list or an unfolded stencil.oSplit a string up into paragraphs separated by a new line. Extra newlines inbetween paragraphs are stripped.! Type safe  for fixed length vectors H. Values are space separated. Can be used as expressions or patterns. [v| x y z w q r |] ::  6 a Note this requires  DataKinds. Also requires  ViewPatterns if ! is used as a pattern.Examples >>> let a = [v| 1 2 3 4 5 |] >>> :t a a :: Num a => V 5 a >>> a V {toVector = [1,2,3,4,5]} >>> let f [v| a b c d e |] = (a,b,c,d,e) >>> :t f f :: V 5 t -> (t, t, t, t, t) >>> f a (1,2,3,4,5) aVariables and infix expressions are also allowed. Negative values can be expressed by a leading -) with a space before but no space after. >>> let b x = [v| 1/x 2 / x (succ x)**2 x-2 x - 3 -x |] >>> b Debug.SimpleReflect.a V {toVector = [1 / a,2 / a,succ a**2,a - 2,a - 3,negate a]} mList of expressions forming a stencil. To be either turned into either a real list or an unfolded stencil."QuasiQuoter for producing a static stencil definition. This is a versatile parser for 1D, 2D and 3D stencils. The parsing is similar to   but " also supports _, which means ignore this element. Also, stencils should have an odd length in all dimensions so there is always a center element (which is used as 7).Examples1D stencils are of the form ["| 5 -3 1 -3 5 |] ::  a =>  % a 2D stencils are of the form myStencil2 ::  a =>    a myStencil2 = ["| 0 1 0 1 0 1 0 1 0 |] %3D stencils have gaps between planes. myStencil3 ::  a =>   a myStencil3 :: ["| 1/20 3/10 1/20 3/10 1 3/10 1/20 3/10 1/20 3/10 1 3/10 1 _ 1 3/10 1 3/10 1/20 3/10 1/20 3/10 1 3/10 1/20 3/10 1/20 |] Variables can also be used myStencil2' :: a -> a -> a ->    a myStencil2' a b c = ["| c b c b a b c b c |] # Construct a 6 by unrolling the list at compile time. For example  f b $(# [(% (-1), 5), (% 0, 3), (% 1, 5)]) will be get turned into f (% (-1)) 5 (f (% 0) 3 (f (% 1) 5 b)) at compile time. Since there are no loops and all target indexes are known at compile time, this can lead to more optimisations and faster execution times. This can lead to around a 2x speed up compared to folding over unboxed vectors. myStencil = $(# (as :: [(f  , a)])) ::  f a $# with a custom  function for a.+Fail the parser if the next non-space is a -% directly followed by a non-space. +If there is a space before but not after a -,, it is treated as a separate expression. i"1 2 -3 4" -> [1, 2, -3, 4] "1 2 - 3 4" -> [1, -1, 4] "1 2-3 4" -> [1, -1, 4] "11 -32 -372 4" -> [1, -1, 4] "1 -3/2 4" -> [1.0,-1.5,4.0]  [Parse an express without any top level application. Infix functions are still permitted.]This is only a small subset of the full haskell syntax. The following syntax is supported:Variables/constructors: a,   etc. Numbers: 3, -6, 7.8, 1e-6, 0x583faParenthesis/tuples: () (f a), (a,b)ListsStringsFunction applicationInfix operators: symbols (+, / etc.) and blackticked (like  )3More advanced haskell syntax are not yet supported: let bindingslambdas'partial infix application (+) (1+) (+2)type signaturescommentsSThis could be replaced by haskell-src-meta but since I want a custom parser for  1 it doesn't seem worth the extra dependencies. @Parse an infix expression. Either a symbol or a name wrapped in `.Parse a single expression. Convert a name to an expression."Convert a symbol to an expression.Parse from some punctuation.Turn a Number into a literal * if possible, otherwise make a literal . Convert a name to an expression.Parse from some punctuation.<Create an expression for converting a (V n a) to an n-tuple.SParse a 1D list. If the system is not valid, return a string with error message.IParse a 2D list of lists. If the system is not valid, returns an errorcParse a 3D list of list of lists. If the system is not valid, return a string with error message.?The element are reordered in the appropriate way for the array: v>>> parse3D [["abc","def","ghi"],["jkl","mno","pqr"],["stu","vwx","yz!"]] ((V3 3 3 3), "ajsdmvgpybktenwhqzclufoxir!") VVersion of ifindOf which is consistent with ifind (in that it also returns the index)./ !"#$    Allow a leading - to mean !"#$%&'()*+,%&'( !"#$ !"#$- !"#$    "#$%&'()*+,%&'( (c) Christopher ChalmersBSD3Christopher Chalmers provisional non-portableNone:OT9)Same as )$ but restrictive in the vector type.*Same as )$ but restrictive in the vector type.+Same as )$ but restrictive in the vector type.,Z1D arrays are just vectors. You are free to change the length of the vector when going  this  (unlike linear). Note that % arrays are an instance of + so you can use any of the functions in ' on them without needing to convert.-IIndexed lens over the underlying vector of an array. The index is the Jn of the array. You must _not_ change the length of the vector, otherwise an error will be thrown (even for % layouts, use , for %)..1Contruct a flat array from a list. (This is just  from .)/O(n) Convert the first n@ elements of a list to an BArrayith the given shape. Returns 1 if there are not enough elements in the list.0O(n) Convert the first nf elements of a list to an BArrayith the given shape. Throw an error if the list is not long enough.1Create an array from a - and a > . Return ) if the vector is not the right shape.2Create an array from a - and a >:. Throws an error if the vector is not the right shape.3 The empty  with a 7 shape.4Test is if the array is 3.5%Index an element of an array. Throws " if the index is out of bounds.6Safe index of an element.75Index an element of an array without bounds checking.86Index an element of an array while ignoring its shape.9RIndex an element of an array while ignoring its shape, without bounds checking.:O(1) Indexing in a monad.zThe monad allows operations to be strict in the vector when necessary. Suppose vector copying is implemented like this: &copy mv v = ... write mv i (v ! i) ...For lazy vectors, v ! i, would not be evaluated which means that mv+ would unnecessarily retain a reference to v in each element written.With :/, copying can be implemented like this instead: 3copy mv v = ... do x <- indexM v i write mv i xHere, no references to v$ are retained because indexing (but not' the elements) is evaluated eagerly.-Throws an error if the index is out of range.;O(1)0 Indexing in a monad without bounds checks. See :- for an explanation of why this is useful.<O(1)F Indexing in a monad. Throws an error if the index is out of range.=O(1)0 Indexing in a monad without bounds checks. See :- for an explanation of why this is useful.>:Execute the monadic action and freeze the resulting array.?DO(n) BArray of the given shape with the same value in each position.@UO(n) Construct an array of the given shape by applying the function to each index.AUO(n) Construct an array of the given shape by applying the function to each index.B^O(n) Construct an array of the given shape by filling each position with the monadic value.C]O(n) Construct an array of the given shape by applying the monadic function to each index.D]O(n) Construct an array of the given shape by applying the monadic function to each index.EO(n) Map a function over an arrayFO(n)< Apply a function to every element of a vector and its indexGSFor each pair (i,a) from the list, replace the array element at position i by a.HO(m+n) For each pair (i,b)- from the list, replace the array element a at position i by f a b.IZip two arrays element wise. If the array's don't have the same shape, the new array with be the intersection of the two shapes.JZip three arrays element wise. If the array's don't have the same shape, the new array with be the intersection of the two shapes.KZip two arrays using the given function. If the array's don't have the same shape, the new array with be the intersection of the two shapes.LZip three arrays using the given function. If the array's don't have the same shape, the new array with be the intersection of the two shapes.MZip two arrays using the given function with access to the index. If the array's don't have the same shape, the new array with be the intersection of the two shapes.NZip two arrays using the given function with access to the index. If the array's don't have the same shape, the new array with be the intersection of the two shapes.OIIndexed traversal over the rows of a matrix. Each row is an efficient  of the original vector.traverseOf_ rows print m [a,b,c,d] [e,f,g,h] [i,j,k,l]P/Affine traversal over a single row in a matrix.0traverseOf_ rows print $ m & ixRow 1 . each *~ 2 [a,b,c,d][e * 2,f * 2,g * 2,h * 2] [i,j,k,l]zThe row vector should remain the same size to satisfy traversal laws but give reasonable behaviour if the size differs:8traverseOf_ rows print $ m & ixRow 1 .~ V.fromList [0,1] [a,b,c,d] [0,1,g,h] [i,j,k,l];traverseOf_ rows print $ m & ixRow 1 .~ V.fromList [0..100] [a,b,c,d] [0,1,2,3] [i,j,k,l]Q7Indexed traversal over the columns of a matrix. Unlike O*, each column is a new separate vector.traverseOf_ columns print m[a,e,i][b,f,j][c,g,k][d,h,l]>traverseOf_ rows print $ m & columns . indices odd . each .~ 0 [a,0,c,0] [e,0,g,0] [i,0,k,0]The vectors should be the same size to be a valid traversal. If the vectors are different sizes, the number of rows in the new array will be the length of the smallest vector.R2Affine traversal over a single column in a matrix.3traverseOf_ rows print $ m & ixColumn 2 . each +~ 1 [a,b,c + 1,d] [e,f,g + 1,h] [i,j,k + 1,l]SRTraversal over a single plane of a 3D array given a lens onto that plane (like !, , ).TLTraversal over all planes of 3D array given a lens onto that plane (like !, , ).UQFlatten a plane by reducing a vector in the third dimension to a single value.VThis : should not have any duplicates in the list of indices.W2O(n) Yield a mutable copy of the immutable vector.X2O(n) Yield an immutable copy of the mutable array.YO(1) Unsafe convert a mutable array to an immutable one without copying. The mutable array may not be used after this operation.ZO(1) Unsafely convert an immutable array to a mutable one without copying. The immutable array may not be used after this operation.[lIsomorphism between an array and its delayed representation. Conversion to the array is done in parallel.\lIsomorphism between an array and its delayed representation. Conversion to the array is done in sequence.]=Turn a material array into a delayed one with the same shape.^>Parallel manifestation of a delayed array into a material one._,Sequential manifestation of a delayed array.`^ an array to a  and delay again.a_ an array to a  and delay again.9)*+,-./0123456789:;<=>?@ABCDEFGHaccumulating function f initial array%list of index/value pairs (of length n)IJKLMNOPQRSTUVWXYZ[\]^_`aN=>?HJKLNPf     )*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`aO?=>>HJKLNP-)*+,./012?A@>BCD3456789:;<=GHEFIJKLMNPORQSTUVfXWZY[\]^_`a     9)*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`a(c) Christopher ChalmersBSD3Christopher Chalmers provisional non-portableNone:OT:bSame as b$ but restrictive in the vector type.cSame as b$ but restrictive in the vector type.dSame as b$ but restrictive in the vector type.eZ1D arrays are just vectors. You are free to change the length of the vector when going  this  (unlike linear). Note that % arrays are an instance of -+ so you can use any of the functions in ' on them without needing to convert.fIIndexed lens over the underlying vector of an array. The index is the Jn of the array. You must _not_ change the length of the vector, otherwise an error will be thrown (even for % layouts, use e for %).g1Contruct a flat array from a list. (This is just  from .)hO(n) Convert the first n@ elements of a list to an SArrayith the given shape. Returns 1 if there are not enough elements in the list.iO(n) Convert the first nf elements of a list to an SArrayith the given shape. Throw an error if the list is not long enough.jCreate an array from a f and a > . Return ) if the vector is not the right shape.kCreate an array from a f and a >:. Throws an error if the vector is not the right shape.l The empty  with a 7 shape.mTest is if the array is l.n%Index an element of an array. Throws " if the index is out of bounds.oSafe index of an element.p5Index an element of an array without bounds checking.q6Index an element of an array while ignoring its shape.rRIndex an element of an array while ignoring its shape, without bounds checking.sO(1) Indexing in a monad.zThe monad allows operations to be strict in the vector when necessary. Suppose vector copying is implemented like this: &copy mv v = ... write mv i (v ! i) ...For lazy vectors, v ! i, would not be evaluated which means that mv+ would unnecessarily retain a reference to v in each element written.With s/, copying can be implemented like this instead: 3copy mv v = ... do x <- indexM v i write mv i xHere, no references to v$ are retained because indexing (but not' the elements) is evaluated eagerly.-Throws an error if the index is out of range.tO(1)0 Indexing in a monad without bounds checks. See s- for an explanation of why this is useful.uO(1)F Indexing in a monad. Throws an error if the index is out of range.vO(1)0 Indexing in a monad without bounds checks. See s- for an explanation of why this is useful.w:Execute the monadic action and freeze the resulting array.xDO(n) SArray of the given shape with the same value in each position.yUO(n) Construct an array of the given shape by applying the function to each index.zUO(n) Construct an array of the given shape by applying the function to each index.{^O(n) Construct an array of the given shape by filling each position with the monadic value.|]O(n) Construct an array of the given shape by applying the monadic function to each index.}]O(n) Construct an array of the given shape by applying the monadic function to each index.~O(n) Map a function over an arrayO(n)< Apply a function to every element of a vector and its indexSFor each pair (i,a) from the list, replace the array element at position i by a.O(m+n) For each pair (i,b)- from the list, replace the array element a at position i by f a b.Zip two arrays using the given function. If the array's don't have the same shape, the new array with be the intersection of the two shapes.Zip three arrays using the given function. If the array's don't have the same shape, the new array with be the intersection of the two shapes.Zip two arrays using the given function with access to the index. If the array's don't have the same shape, the new array with be the intersection of the two shapes.Zip two arrays using the given function with access to the index. If the array's don't have the same shape, the new array with be the intersection of the two shapes.IIndexed traversal over the rows of a matrix. Each row is an efficient  of the original vector.traverseOf_ rows print m[1,2,3][4,5,6]/Affine traversal over a single row in a matrix.0traverseOf_ rows print $ m & ixRow 1 . each +~ 2[1,2,3][6,7,8]zThe row vector should remain the same size to satisfy traversal laws but give reasonable behaviour if the size differs:8traverseOf_ rows print $ m & ixRow 1 .~ V.fromList [0,1][1,2,3][0,1,6];traverseOf_ rows print $ m & ixRow 1 .~ V.fromList [0..100][1,2,3][0,1,2]7Indexed traversal over the columns of a matrix. Unlike *, each column is a new separate vector.traverseOf_ columns print m[1,4][2,5][3,6]>traverseOf_ rows print $ m & columns . indices odd . each .~ 0[1,0,3][4,0,6]The vectors should be the same size to be a valid traversal. If the vectors are different sizes, the number of rows in the new array will be the length of the smallest vector.2Affine traversal over a single column in a matrix.4traverseOf_ rows print $ m & ixColumn 2 . each *~ 10[1,2,30][4,5,60]RTraversal over a single plane of a 3D array given a lens onto that plane (like !, , ).LTraversal over all planes of 3D array given a lens onto that plane (like !, , ).QFlatten a plane by reducing a vector in the third dimension to a single value.This : should not have any duplicates in the list of indices.2O(n) Yield a mutable copy of the immutable vector.2O(n) Yield an immutable copy of the mutable array.O(1) Unsafe convert a mutable array to an immutable one without copying. The mutable array may not be used after this operation.O(1) Unsafely convert an immutable array to a mutable one without copying. The immutable array may not be used after this operation.lIsomorphism between an array and its delayed representation. Conversion to the array is done in parallel.lIsomorphism between an array and its delayed representation. Conversion to the array is done in sequence.=Turn a material array into a delayed one with the same shape.>Parallel manifestation of a delayed array into a material one.,Sequential manifestation of a delayed array. an array to a  and delay again. an array to a  and delay again.SPass a pointer to the array's data to the IO action. Modifying data through the . is unsafe.CYield the underlying ForeignPtr. Modifying the data through the / is unsafe.'O(1) Create an array from a layout and /f. It is assumed the pointer points directly to the data (no offset). Modifying data through the / afterwards is unsafe.:bcdefghijklmnopqrstuvwxyz{|}~accumulating function f initial array%list of index/value pairs (of length n)P =>?HJKLNPd     bcdefghijklmnopqrstuvwxyz{|}~Q ?=>>HJKLNPfbcdeghijkxzyw{|}lmnopqrstuv~d     :bcdefghijklmnopqrstuvwxyz{|}~(c) Christopher ChalmersBSD3Christopher Chalmers provisional non-portableNone:OT9Same as $ but restrictive in the vector type.Same as $ but restrictive in the vector type.Same as $ but restrictive in the vector type.Z1D arrays are just vectors. You are free to change the length of the vector when going  this  (unlike linear). Note that % arrays are an instance of 0+ so you can use any of the functions in ' on them without needing to convert.IIndexed lens over the underlying vector of an array. The index is the Jn of the array. You must _not_ change the length of the vector, otherwise an error will be thrown (even for % layouts, use  for %).1Contruct a flat array from a list. (This is just  from .)O(n) Convert the first n@ elements of a list to an UArrayith the given shape. Returns 1 if there are not enough elements in the list.O(n) Convert the first nf elements of a list to an UArrayith the given shape. Throw an error if the list is not long enough.Create an array from a  and a > . Return ) if the vector is not the right shape.Create an array from a  and a >:. Throws an error if the vector is not the right shape. The empty  with a 7 shape.Test is if the array is .%Index an element of an array. Throws " if the index is out of bounds.Safe index of an element.5Index an element of an array without bounds checking.6Index an element of an array while ignoring its shape.RIndex an element of an array while ignoring its shape, without bounds checking.O(1) Indexing in a monad.zThe monad allows operations to be strict in the vector when necessary. Suppose vector copying is implemented like this: &copy mv v = ... write mv i (v ! i) ...For lazy vectors, v ! i, would not be evaluated which means that mv+ would unnecessarily retain a reference to v in each element written.With /, copying can be implemented like this instead: 3copy mv v = ... do x <- indexM v i write mv i xHere, no references to v$ are retained because indexing (but not' the elements) is evaluated eagerly.-Throws an error if the index is out of range.O(1)0 Indexing in a monad without bounds checks. See - for an explanation of why this is useful.O(1)F Indexing in a monad. Throws an error if the index is out of range.O(1)0 Indexing in a monad without bounds checks. See - for an explanation of why this is useful.:Execute the monadic action and freeze the resulting array.DO(n) UArray of the given shape with the same value in each position.UO(n) Construct an array of the given shape by applying the function to each index.UO(n) Construct an array of the given shape by applying the function to each index.^O(n) Construct an array of the given shape by filling each position with the monadic value.]O(n) Construct an array of the given shape by applying the monadic function to each index.]O(n) Construct an array of the given shape by applying the monadic function to each index.O(n) Map a function over an arrayO(n)< Apply a function to every element of a vector and its indexSFor each pair (i,a) from the list, replace the array element at position i by a.O(m+n) For each pair (i,b)- from the list, replace the array element a at position i by f a b.Zip two arrays element wise. If the array's don't have the same shape, the new array with be the intersection of the two shapes.Zip three arrays element wise. If the array's don't have the same shape, the new array with be the intersection of the two shapes.Zip two arrays using the given function. If the array's don't have the same shape, the new array with be the intersection of the two shapes.Zip three arrays using the given function. If the array's don't have the same shape, the new array with be the intersection of the two shapes.Zip two arrays using the given function with access to the index. If the array's don't have the same shape, the new array with be the intersection of the two shapes.Zip two arrays using the given function with access to the index. If the array's don't have the same shape, the new array with be the intersection of the two shapes.IIndexed traversal over the rows of a matrix. Each row is an efficient  of the original vector.traverseOf_ rows print m[1,2,3][4,5,6]/Affine traversal over a single row in a matrix.0traverseOf_ rows print $ m & ixRow 1 . each +~ 2[1,2,3][6,7,8]zThe row vector should remain the same size to satisfy traversal laws but give reasonable behaviour if the size differs:8traverseOf_ rows print $ m & ixRow 1 .~ V.fromList [0,1][1,2,3][0,1,6];traverseOf_ rows print $ m & ixRow 1 .~ V.fromList [0..100][1,2,3][0,1,2]7Indexed traversal over the columns of a matrix. Unlike *, each column is a new separate vector.traverseOf_ columns print m[1,4][2,5][3,6]>traverseOf_ rows print $ m & columns . indices odd . each .~ 0[1,0,3][4,0,6]The vectors should be the same size to be a valid traversal. If the vectors are different sizes, the number of rows in the new array will be the length of the smallest vector.2Affine traversal over a single column in a matrix.4traverseOf_ rows print $ m & ixColumn 2 . each *~ 10[1,2,30][4,5,60]RTraversal over a single plane of a 3D array given a lens onto that plane (like !, , ).LTraversal over all planes of 3D array given a lens onto that plane (like !, , ).QFlatten a plane by reducing a vector in the third dimension to a single value.This : should not have any duplicates in the list of indices.2O(n) Yield a mutable copy of the immutable vector.2O(n) Yield an immutable copy of the mutable array.O(1) Unsafe convert a mutable array to an immutable one without copying. The mutable array may not be used after this operation.O(1) Unsafely convert an immutable array to a mutable one without copying. The immutable array may not be used after this operation.lIsomorphism between an array and its delayed representation. Conversion to the array is done in parallel.lIsomorphism between an array and its delayed representation. Conversion to the array is done in sequence.=Turn a material array into a delayed one with the same shape.>Parallel manifestation of a delayed array into a material one.,Sequential manifestation of a delayed array. an array to a  and delay again. an array to a  and delay again.9accumulating function f initial array%list of index/value pairs (of length n)O=>?HJKLNPe     P?=>>HJKLNPe     9(c) Christopher ChalmersBSD3Christopher Chalmers provisional non-portableNone 9:;<=DORT\t  #"!%$'&.-,+*)(/018765432=>?HJKLNPcdefg     "#{H=>>?JKLPNgfedc10/877665543322.--,+*)(      "#%$ '&#"!1 !"#$%&'()'(*'+,-,.,/,01234567867867967:67;6<=6<>6<?6<@6<A6<A6<B6<C6<D6EF6EG6EG6EH6EI6EJ6KL6KL6KM6KN6OP6OQ6OR6OS6OT6OU6OV6WX6WY6WZ6W[6W\6W]6W^6W_6W`6Wabcddefghijklmnopqrstuvwxyz{|}~            !"#$%&'()*+,-.//0123456 7 8 9 : ;  < = > ? @ A                            ! " # $  !"#$BCD  !"#$3EF'GH'IJKLM3NO'PQR3ST'PU1VWXYZ3[\3E]1'G^_`3Ea3Ebcdefghijklmnopq'Pr3Sstuvwuvx1W'yzKL{ | }u~6 '3S   'G'      '            'y           1W''12W$dense-0.1.0.0-8BjrPZxGpaCFKCA0IN2qtI Data.DenseData.Dense.IndexData.Dense.StorableData.Dense.UnboxedData.Dense.MutableData.Dense.BaseData.Dense.GenericData.Dense.Stencil Data.Dense.THData.Dense.BoxedArrayMArrayDelayedFocusedData.Primitive.TypesPrimForeign.Storable StoreableData.Vector.UnboxedUnbox Data.VectorGenericData.Vector.Genericslicestencil makeStencilTH extendFocusUArrayBArraycomonad-5-8Y6ObIcrvUxUD6HTvjIWiControl.Comonad.Store.Class ComonadStorepospeekpeeksseekseeks experimentbaseGHC.IO.ExceptionIndexOutOfBoundsArrayExceptionStorableControl.Comonadextend duplicateextractComonad&vector-0.11.0.0-6uB77qGCxR6GPLxI2sqsX3Data.Vector.Unboxed.Base lens-4.14-HMh2G5kdxeX3VaHcHHq3qEControl.Exception.Lens_IndexOutOfBounds$linear-1.20.5-7wYpWNZANRhKtNZ0kWxto6 Linear.V4V4_xyzw_wR4 Linear.V3_zy_zx_yz_xzV3_xyz_zR3 Linear.V2_yxV2_xy_yR2 Linear.V1V1_xR1 Linear.Metricsignormnormdistanceqd quadrancedotMetric Linear.Vector^/^**^liftI2liftU2lerp^-^^+^zeroAdditiveAsSizeMissmatch_SizeMissmatch SizeMissmatch HasLayoutlayoutShape shapeToIndexshapeFromIndexshapeIntersectunsafeShapeStep shapeStepshapeStepBetween shapeInRange shapeSizeLayoutindexIsoextentsizeindexes shapeIndexes indexesFromshapeIndexesFromindexesBetweenshapeIndexesBetween boundsCheck sizeMissmatch showShape$fAsSizeMissmatchSomeException$fAsSizeMissmatchSizeMissmatch$fShowSizeMissmatch$fExceptionSizeMissmatch$fHasLayoutV4V4$fHasLayoutV3V3$fHasLayoutV2V2$fHasLayoutV1V1$fHasLayoutV0V0 $fShapeV4 $fShapeV3 $fShapeV2 $fShapeV1 $fShapeV0PMArraySMArrayUMArrayBMArraymlayoutmvectornew replicate replicateMcloneclearreadwritemodifyswapexchange linearRead linearWrite linearSwap linearModifylinearExchange unsafeRead unsafeWrite unsafeSwap unsafeModifyunsafeExchangeunsafeLinearReadunsafeLinearWriteunsafeLinearSwapunsafeLinearModifyunsafeLinearExchangesetcopy$fMVectorMArraya$fHasLayoutfMArrayBoxedvaluesvector unsafeFreeze unsafeThawdelay indexDelayedmanifest genDelayed $fIxedFocused$fTraversableWithIndexfFocused$fFoldableWithIndexfFocused$fFunctorWithIndexfFocused$fTraversableFocused$fFoldableFocused $fShowFocused$fComonadStorefFocused$fExtendFocused$fComonadFocused$fHasLayoutfFocused $fIxedDelayed$fAsEmptyDelayed$fEachDelayedDelayedab$fTraversableWithIndexfDelayed$fFoldableWithIndexfDelayed$fFunctorWithIndexfDelayed$fMetricDelayed$fAdditiveDelayed$fApplyDelayed$fTraversableDelayed $fShowDelayed$fFoldableDelayed$fHasLayoutfDelayed$fHashableArray$fSerializeArray $fBinaryArray $fSerialArray$fVectorArraya$fSerial1Array$fTraversableWithIndexfArray$fFoldableWithIndexfArray$fFunctorWithIndexfArray $fRead1Array $fEq1Array$fTraversableArray$fFoldableArray$fFunctorArray $fNFDataArray $fReadArray$fAsEmptyArray$fEachArrayArrayab $fIxedArray $fShowArray $fEqArray$fHasLayoutfArray$fFunctorDelayed$fFunctorFocused $fDataArrayBoundaryClampMirrorWrapPArraySArrayvalues' valuesBetweenflatfromList fromListInto fromListInto_fromVectorIntofromVectorInto_emptynull!!? unsafeIndex linearIndexunsafeLinearIndexindexM unsafeIndexM linearIndexMunsafeLinearIndexMcreatelinearGenerategenerate generateMlinearGenerateMmapimap//accumstreamGeneratestreamGenerateM streamIndexesbundleGeneratebundleGenerateM bundleIndexeszipzip3zipWithzipWith3izipWith izipWith3rowsixRowcolumnsixColumnixPlaneplanes flattenPlaneunsafeOrdinalsfreezethawdelayed seqDelayed seqManifestaffirm seqAffirmfocusOnunfocus unfocusedlocale shiftFocuspeekB peekRelativeBpeeksB$fShowBoundary$fReadBoundaryStencil mkStencilmkStencilUnboxed stencilSum$fFunctorStencil$fFoldableWithIndexfStencil$fFoldableStencil $fShowStencil ShapeLift liftShape liftShape'densev mkStencilTH mkStencilTHBy $fShapeLiftV4 $fShapeLiftV3 $fShapeLiftV2 $fShapeLiftV1 unsafeWithPtrunsafeToForeignPtrunsafeFromForeignPtrControl.Lens.TypePrism'GHC.BaseString GHC.Exception SomeExceptionghc-prim GHC.TypesIntControl.Lens.Prism_Show Data.Foldablelength guardPureControl.Lens.IndexedifoldMapfoldMapData.Vector.Generic.BaseVectorgenGet foldDelayedlinearIndexesBetweenControl.Lens.SetteroverIsoNothingunsafeStreamSub streamSub TraversalLens' unstreamM unstreamPrimMunstreamPrimM_IOunstreamPrimM_ST getColumntransposeConcat concatPlanesgetPlane setOrdinals wrapPeeks wrapIndex clampPeeks clampIndex mirrorPeeks mirrorIndexFoldableFoldableWithIndexmyfoldrtemplate-haskellLanguage.Haskell.TH.SyntaxliftLiftGHC.NumNumChar parseDense paragraphsLanguage.Haskell.TH.Quote QuasiQuoterLinear.VV parseStencilGHC.Real FractionalifoldrcloseNegateFailnoAppExpression expressionJustmodinfixExpanExpridentsymbolpuncnumber integer-gmpGHC.Integer.TypeIntegerRationalidentPpuncPvTupleparse1Dparse2Dparse3DifindOf'mkArrayparseVparseStencilLine mkStencilE parseLinenegateprefixcommapatternV parsePatternpatternprefixPv1v2v3v4oneData.Vector.StorableGHC.PtrPtrGHC.ForeignPtr ForeignPtr