h$ɉ      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                      (c) Christopher ChalmersBSD3Christopher Chalmers provisional non-portableNone39>?9dense(Exception thown from missmatching sizes.:denseExtract information about an ;. : ::  ;  : ::    ;dense/Thrown when two sizes that should match, don't.=denseClass of things that have a H. This means we can use the same functions for the various different arrays in the library.>denseLens onto the H of something.?denseClass for types that can be converted to and from linear indexes.@dense.Convert a shape to its linear index using the H.Adense&Convert a linear index to a shape the H.Bdense)Calculate the intersection of two shapes.CdenseIncrement a shape by one. It is assumed that the provided index is inRange.DdenseIncrement a shape by one. It is assumed that the provided index is inRange.Edense/Increment a shape by one between the two boundsFdense inRange ex i checks i < ex for every coordinate of f.Gdense"The number of elements in a shape.HdenseA 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.IdensetoIndex l and  fromIndex l" form two halfs of an isomorphism.JdenseGet the extent of an array. J ::   v f a -> f  J ::   v f s a -> f  J ::   f a -> f  J ::  f a -> f  Kdense-Get the total number of elements in an array. K ::   v f a ->  K ::   v f s a ->  K ::   f a ->  K ::  f a ->  Ldense/Indexed fold for all the indexes in the layout.MdenseL for a ?.NdenseIndexed fold starting starting from some point, where the index is the linear index for the original layout.OdenseN for a ?.PdenseIndexed fold between the two indexes where the index is the linear index for the original layout.QdenseP for a ?.RdenseboundsCheck 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)catching _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:trying (_IndexOutOfBounds . _Show) (boundsCheck (V1 2) (V1 20) (putStrLn "in range")) :: IO (Either (V1 Int, V1 Int) ())Left (V1 20,V1 2)Sdense)Check the sizes are equal. If not, throw ;.TdenseShow a shape in the form VN i1 i2 .. iN where N is the  of the shape.9:;<=>?@ABCDGEFHIJKLMNOPQRSTH?@ABCDGEFIMOQ=>JKLPNR;<9:ST(c) Christopher ChalmersBSD3Christopher Chalmers provisional non-portableNone 3>"cdensePrimitive mutable array.ddenseStorable mutable array.edenseUnboxed mutable array.fdenseBoxed mutable array.gdenseA mutable array with a shape.idenseLens onto the shape of the vector. The total size of the layout _must_ remain the same or an error is thrown.jdenseIndexed lens over the underlying vector of an array. The index is the J of the array. You must not change the length of the vector, otherwise an error will be thrown.kdenseNew mutable array with shape l.ldenseNew mutable array with shape l filled with element a.mdenseNew mutable array with shape l) filled with result of monadic action a.ndense?&denseA delayed representation of an array with a focus on a single element. This element is the target of  .denseA delayed representation of an array. This useful for mapping over an array in parallel.denseThe vector is the boxed vector.denseAn  is a vector with a shape.denseIndexed traversal over the elements of an array. The index is the current position in the array.denseIndexed lens over the underlying vector of an array. The index is the J of the array. You must _not_ change the length of the vector, otherwise an error will be thrown (even for % layouts, use flat for %).denseO(1) Unsafe convert a mutable array to an immutable one without copying. The mutable array may not be used after this operation.denseO(1) Unsafely convert an immutable array to a mutable one without copying. The immutable array may not be used after this operation.dense=Turn a material array into a delayed one with the same shape.dense#Index a delayed array, returning a + exception if the index is out of range.dense>Parallel manifestation of a delayed array into a material one.dense Generate a  array using the given H and construction function.dense#1D Arrays can be used as a generic .denseThe K of the > must' remain the same or an error is thrown.dense in parallel.dense in parallel.denseThe K of the > must' remain the same or an error is thrown.denseIndex relative to focus.denseIndex relative to focus.denseIndex relative to focus.denseIndex relative to focus.denseThe K of the > must' remain the same or an error is thrown.(c) Christopher ChalmersBSD3Christopher Chalmers provisional non-portableNone3>?I*denseThe boundary condition used for indexing relative elements in a .dense,clamp coordinates to the extent of the arraydense*mirror coordinates beyond the array extentdense)wrap coordinates around on each dimensiondense array.dense array.dense ed array.dense array.denseSame as $ but restrictive in the vector type.denseTraverse over the  between two indexes.dense1D 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.dense1Contruct a flat array from a list. (This is just  from .)denseO(n) Convert the first n elements of a list to an Array with the given shape. Returns 1 if there are not enough elements in the list.denseO(n) Convert the first n elements of a list to an Array with the given shape. Throw an error if the list is not long enough.denseCreate an array from a  and a > . Return ) if the vector is not the right shape.denseCreate an array from a  and a >:. Throws an error if the vector is not the right shape.dense The empty  with a 7 shape.denseTest is if the array is .dense%Index an element of an array. Throws " if the index is out of bounds.denseSafe index of an element.dense5Index an element of an array without bounds checking.dense6Index an element of an array while ignoring its shape.denseIndex an element of an array while ignoring its shape, without bounds checking.denseO(1) Indexing in a monad.The monad allows operations to be strict in the vector when necessary. Suppose vector copying is implemented like this: © 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.denseO(1)0 Indexing in a monad without bounds checks. See - for an explanation of why this is useful.denseO(1) Indexing in a monad. Throws an error if the index is out of range.denseO(1)0 Indexing in a monad without bounds checks. See - for an explanation of why this is useful.dense:Execute the monadic action and freeze the resulting array.dense:Execute the monadic action and freeze the resulting array.denseO(n) Array of the given shape with the same value in each position.denseO(n) Construct an array of the given shape by applying the function to each index.denseO(n) Construct an array of the given shape by applying the function to each index.denseO(n) Construct an array of the given shape by filling each position with the monadic value.denseO(n) Construct an array of the given shape by applying the monadic function to each index.denseO(n) Construct an array of the given shape by applying the monadic function to each index.denseO(n) Map a function over an arraydenseO(n)< Apply a function to every element of a vector and its indexdenseFor each pair (i,a) from the list, replace the array element at position i by a.denseO(m+n) For each pair (i,b)- from the list, replace the array element a at position i by f a b.denseGenerate a stream from a Layout' s indices.denseGenerate a stream from a Layout' s indices.dense"Make a stream of the indexes of a H.denseGenerate a bundle from H indices.denseGenerate a bundle from H indices.dense+Generate a bundle of indexes for the given H.denseZip 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.denseZip 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.denseZip 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.denseZip 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.denseZip 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.denseZip 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.denseIndexed 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]dense/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]The 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]dense7Indexed 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.dense2Affine 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]denseTraversal over a single plane of a 3D array given a lens onto that plane (like !, , ).denseTraversal over all planes of 3D array given a lens onto that plane (like !, , ).denseFlatten a plane by reducing a vector in the third dimension to a single value.denseThis : should not have any duplicates in the list of indices.dense2O(n) Yield a mutable copy of the immutable vector.dense2O(n) Yield an immutable copy of the mutable array.denseIsomorphism between an array and its delayed representation. Conversion to the array is done in parallel.denseIsomorphism between an array and its delayed representation. Conversion to the array is done in parallel.dense,Sequential manifestation of a delayed array.dense an array to a  and delay again. See Data.Dense.Boxed or Data.Dense.Storable to  for other types of arrays.dense an array to a  and delay again. See Data.Dense.Boxed or Data.Dense.Storable to  for other types of arrays.dense1Focus on a particular element of a delayed array.dense0Discard the focus to retrieve the delayed array.dense:Indexed lens onto the delayed array, indexed at the focus.dense Modify a $ array by extracting a value from a  each point.denseLens onto the position of a .  ::  ( l a) (l ) dense?Focus on a neighbouring element, relative to the current focus.denseIndex a focused using a  condition.dense7Index an element relative to the current focus using a  condition.denseIndex an element by applying a function the current position, using a boundary condition.denseaccumulating function fdense initial arraydense%list of index/value pairs (of length n)=>?@ABCDGEFHJKLNPcdefg?@ABCDGEF=>HJKLNPgfedc(c) Christopher ChalmersBSD3Christopher Chalmers provisional non-portableNone?i9denseSame as $ but restrictive in the vector type.denseSame as $ but restrictive in the vector type.denseSame as $ but restrictive in the vector type.dense1D 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.denseIndexed lens over the underlying vector of an array. The index is the J of the array. You must _not_ change the length of the vector, otherwise an error will be thrown (even for % layouts, use  for %).dense1Contruct a flat array from a list. (This is just  from .)denseO(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.denseO(n) Convert the first n elements of a list to an BArrayith the given shape. Throw an error if the list is not long enough.denseCreate an array from a  and a > . Return ) if the vector is not the right shape.denseCreate an array from a  and a >:. Throws an error if the vector is not the right shape.dense The empty  with a 7 shape.denseTest is if the array is .dense%Index an element of an array. Throws " if the index is out of bounds.denseSafe index of an element.dense5Index an element of an array without bounds checking.dense6Index an element of an array while ignoring its shape.denseIndex an element of an array while ignoring its shape, without bounds checking.denseO(1) Indexing in a monad.The monad allows operations to be strict in the vector when necessary. Suppose vector copying is implemented like this: © 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.denseO(1)0 Indexing in a monad without bounds checks. See - for an explanation of why this is useful.denseO(1) Indexing in a monad. Throws an error if the index is out of range.denseO(1)0 Indexing in a monad without bounds checks. See - for an explanation of why this is useful.dense:Execute the monadic action and freeze the resulting array.denseO(n) BArray of the given shape with the same value in each position.denseO(n) Construct an array of the given shape by applying the function to each index.denseO(n) Construct an array of the given shape by applying the function to each index.denseO(n) Construct an array of the given shape by filling each position with the monadic value.denseO(n) Construct an array of the given shape by applying the monadic function to each index.denseO(n) Construct an array of the given shape by applying the monadic function to each index.denseO(n) Map a function over an arraydenseO(n)< Apply a function to every element of a vector and its indexdenseFor each pair (i,a) from the list, replace the array element at position i by a.denseO(m+n) For each pair (i,b)- from the list, replace the array element a at position i by f a b.denseZip 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.denseZip 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.denseZip 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.denseZip 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.denseZip 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.denseZip 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.denseIndexed 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]dense/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]The 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]dense7Indexed 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.dense2Affine 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]denseTraversal over a single plane of a 3D array given a lens onto that plane (like !, , ).denseTraversal over all planes of 3D array given a lens onto that plane (like !, , ).denseFlatten a plane by reducing a vector in the third dimension to a single value.denseThis : should not have any duplicates in the list of indices.dense2O(n) Yield a mutable copy of the immutable vector.dense2O(n) Yield an immutable copy of the mutable array.denseO(1) Unsafe convert a mutable array to an immutable one without copying. The mutable array may not be used after this operation.denseO(1) Unsafely convert an immutable array to a mutable one without copying. The immutable array may not be used after this operation.denseIsomorphism between an array and its delayed representation. Conversion to the array is done in parallel.denseIsomorphism between an array and its delayed representation. Conversion to the array is done in sequence.dense=Turn a material array into a delayed one with the same shape.dense>Parallel manifestation of a delayed array into a material one.dense,Sequential manifestation of a delayed array.dense an array to a  and delay again.dense an array to a  and delay again.denseaccumulating function fdense initial arraydense%list of index/value pairs (of length n)=>?HJKLNPf?=>HJKLNPf (c) Christopher ChalmersBSD3Christopher Chalmers provisional non-portableNone 5>ndenseStencils 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.dense#Make a stencil folding over a list.If the list is staticlly known this should expand at compile time via rewrite rules, similar to   but less reliable. If that does not happen the resulting could be slow. If the list is not know at compile time,  can be signifcantly faster (but isn't subject expending via rewrite rules).dense . Return ) if the vector is not the right shape.denseCreate an array from a  and a >:. Throws an error if the vector is not the right shape.dense The empty  with a 7 shape.denseTest is if the array is .dense%Index an element of an array. Throws " if the index is out of bounds.denseSafe index of an element.dense5Index an element of an array without bounds checking.dense6Index an element of an array while ignoring its shape.denseIndex an element of an array while ignoring its shape, without bounds checking.denseO(1) Indexing in a monad.The monad allows operations to be strict in the vector when necessary. Suppose vector copying is implemented like this: © 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.denseO(1)0 Indexing in a monad without bounds checks. See - for an explanation of why this is useful.denseO(1) Indexing in a monad. Throws an error if the index is out of range.denseO(1)0 Indexing in a monad without bounds checks. See - for an explanation of why this is useful.dense:Execute the monadic action and freeze the resulting array.denseO(n) SArray of the given shape with the same value in each position.denseO(n) Construct an array of the given shape by applying the function to each index.denseO(n) Construct an array of the given shape by applying the function to each index.denseO(n) Construct an array of the given shape by filling each position with the monadic value.denseO(n) Construct an array of the given shape by applying the monadic function to each index.denseO(n) Construct an array of the given shape by applying the monadic function to each index.denseO(n) Map a function over an arraydenseO(n)< Apply a function to every element of a vector and its indexdenseFor each pair (i,a) from the list, replace the array element at position i by a.denseO(m+n) For each pair (i,b)- from the list, replace the array element a at position i by f a b.denseZip 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.denseZip 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.denseZip 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.denseZip 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.denseIndexed 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]dense/Affine traversal over a single row in a matrix.0traverseOf_ rows print $ m & ixRow 1 . each +~ 2[1,2,3][6,7,8]The 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]dense7Indexed 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.dense2Affine traversal over a single column in a matrix.4traverseOf_ rows print $ m & ixColumn 2 . each *~ 10[1,2,30][4,5,60]denseTraversal over a single plane of a 3D array given a lens onto that plane (like !, , ).denseTraversal over all planes of 3D array given a lens onto that plane (like !, , ).denseFlatten a plane by reducing a vector in the third dimension to a single value.denseThis : should not have any duplicates in the list of indices.dense2O(n) Yield a mutable copy of the immutable vector.dense2O(n) Yield an immutable copy of the mutable array.denseO(1) Unsafe convert a mutable array to an immutable one without copying. The mutable array may not be used after this operation.denseO(1) Unsafely convert an immutable array to a mutable one without copying. The immutable array may not be used after this operation.denseIsomorphism between an array and its delayed representation. Conversion to the array is done in parallel.denseIsomorphism between an array and its delayed representation. Conversion to the array is done in sequence.dense=Turn a material array into a delayed one with the same shape.dense>Parallel manifestation of a delayed array into a material one.dense,Sequential manifestation of a delayed array.dense an array to a  and delay again.dense an array to a  and delay again.densePass a pointer to the array's data to the IO action. Modifying data through the  is unsafe.denseYield the underlying ForeignPtr. Modifying the data through the  is unsafe.dense'O(1) Create an array from a layout and . It is assumed the pointer points directly to the data (no offset). Modifying data through the  afterwards is unsafe.denseaccumulating function fdense initial arraydense%list of index/value pairs (of length n) =>?HJKLNPd ?=>HJKLNPd (c) Christopher ChalmersBSD3Christopher Chalmers experimental non-portableNone 5>denseClass of shapes that can be ed.#This is to prevent orphans for the  class.dense for ?s.dense Polymorphic  for a ?s.denseQuasiQuoter for producing a dense arrays using a custom parser. Values are space separated, while also allowing infix expressions (like 5/7). If you want to apply a function, it should be done in brackets. Supports 1D, 2D and 3D arrays.The number of rows/columns must be consistent thought out the array.Examples1D 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 2D 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' |] 3D 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" |] dense Type safe  for fixed length vectors . 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) Variables 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]} denseQuasiQuoter 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 |] dense 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 dense with a custom  function for a.(c) Christopher ChalmersBSD3Christopher Chalmers provisional non-portableNone >?  #"!%$'&.-,+*)(/018765432=>?HJKLNPcdefgH=>?JKLPNgfedc10/8765432.-,+*)( %$ '&#"!(c) Christopher ChalmersBSD3Christopher Chalmers provisional non-portableNone?9denseSame as $ but restrictive in the vector type.denseSame as $ but restrictive in the vector type.denseSame as $ but restrictive in the vector type.dense1D 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.denseIndexed lens over the underlying vector of an array. The index is the J of the array. You must _not_ change the length of the vector, otherwise an error will be thrown (even for % layouts, use  for %).dense1Contruct a flat array from a list. (This is just  from .)denseO(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.denseO(n) Convert the first n elements of a list to an UArrayith the given shape. Throw an error if the list is not long enough.denseCreate an array from a  and a > . Return ) if the vector is not the right shape.denseCreate an array from a  and a >:. Throws an error if the vector is not the right shape.dense The empty  with a 7 shape.denseTest is if the array is .dense%Index an element of an array. Throws " if the index is out of bounds.denseSafe index of an element.dense5Index an element of an array without bounds checking.dense6Index an element of an array while ignoring its shape.denseIndex an element of an array while ignoring its shape, without bounds checking.denseO(1) Indexing in a monad.The monad allows operations to be strict in the vector when necessary. Suppose vector copying is implemented like this: © 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.denseO(1)0 Indexing in a monad without bounds checks. See - for an explanation of why this is useful.denseO(1) Indexing in a monad. Throws an error if the index is out of range.denseO(1)0 Indexing in a monad without bounds checks. See - for an explanation of why this is useful.dense:Execute the monadic action and freeze the resulting array.denseO(n) UArray of the given shape with the same value in each position.denseO(n) Construct an array of the given shape by applying the function to each index.denseO(n) Construct an array of the given shape by applying the function to each index.denseO(n) Construct an array of the given shape by filling each position with the monadic value.denseO(n) Construct an array of the given shape by applying the monadic function to each index.denseO(n) Construct an array of the given shape by applying the monadic function to each index.denseO(n) Map a function over an arraydenseO(n)< Apply a function to every element of a vector and its indexdenseFor each pair (i,a) from the list, replace the array element at position i by a.denseO(m+n) For each pair (i,b)- from the list, replace the array element a at position i by f a b.denseZip 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.denseZip 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.denseZip 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.denseZip 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.denseZip 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.denseZip 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.denseIndexed 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]dense/Affine traversal over a single row in a matrix.0traverseOf_ rows print $ m & ixRow 1 . each +~ 2[1,2,3][6,7,8]The 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]dense7Indexed 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.dense2Affine traversal over a single column in a matrix.4traverseOf_ rows print $ m & ixColumn 2 . each *~ 10[1,2,30][4,5,60]denseTraversal over a single plane of a 3D array given a lens onto that plane (like !, , ).denseTraversal over all planes of 3D array given a lens onto that plane (like !, , ).denseFlatten a plane by reducing a vector in the third dimension to a single value.denseThis : should not have any duplicates in the list of indices.dense2O(n) Yield a mutable copy of the immutable vector.dense2O(n) Yield an immutable copy of the mutable array.denseO(1) Unsafe convert a mutable array to an immutable one without copying. The mutable array may not be used after this operation.denseO(1) Unsafely convert an immutable array to a mutable one without copying. The immutable array may not be used after this operation.denseIsomorphism between an array and its delayed representation. Conversion to the array is done in parallel.denseIsomorphism between an array and its delayed representation. Conversion to the array is done in sequence.dense=Turn a material array into a delayed one with the same shape.dense>Parallel manifestation of a delayed array into a material one.dense,Sequential manifestation of a delayed array.dense an array to a  and delay again.dense an array to a  and delay again.denseaccumulating function fdense initial arraydense%list of index/value pairs (of length n)=>?HJKLNPe?=>HJKLNPe !"#$%&'()'(*'+,-,.,/,01234567867867967:67;6<=6<>6<?6<@6<A6<A6<B6<C6<D6EF6EG6EG6EH6EI6EJ6KL6KL6KM6KN6OP6OQ6OR6OS6OT6OU6OV6WX6WY6WZ6W[6W\6W]6W^6W_6W`6Wabcddefghijklmnopqrstuvwxyz{|}~                           3''3'13'331'331'31'''6'312$dense-0.1.0.1-BeZYkNUEQy9D3GldJrJbBE Data.DenseData.Dense.IndexData.Dense.StorableData.Dense.UnboxedData.Dense.MutableData.Dense.BaseData.Dense.GenericData.Dense.BoxedData.Dense.Stencil Data.Dense.THArrayMArrayDelayedFocusedData.Primitive.TypesPrimForeign.Storable StoreableData.Vector.UnboxedUnbox Data.VectorGenericData.Vector.Genericslicestencil makeStencilTH extendFocusUArrayBArray#comonad-5.0.6-wmqqkMLXWW8Oafzxo6qb2Control.Comonad.Store.Class ComonadStorepospeekpeeksseekseeks experimentbaseGHC.IO.ExceptionIndexOutOfBoundsArrayExceptionStorableControl.Comonadextend duplicateextractComonad&vector-0.12.1.2-CaO9Aaqgvq4EOvKKmDELAEData.Vector.Unboxed.Base"lens-4.19.2-HWSZlyOqf8a6Jd3WpCMkrRControl.Exception.Lens_IndexOutOfBounds$linear-1.21.1-8shKxkKQUSF4N39Qjrte3Y 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 $fShapeV4 $fShapeV3 $fShapeV2 $fShapeV1 $fShapeV0$fHasLayoutV4V4$fHasLayoutV3V3$fHasLayoutV2V2$fHasLayoutV1V1$fHasLayoutV0V0$fShowSizeMissmatch$fExceptionSizeMissmatch$fAsSizeMissmatchSomeException$fAsSizeMissmatchSizeMissmatchPMArraySMArrayUMArrayBMArraymlayoutmvectornew replicate replicateMcloneclearreadwritemodifyswapexchange linearRead linearWrite linearSwap linearModifylinearExchange unsafeRead unsafeWrite unsafeSwap unsafeModifyunsafeExchangeunsafeLinearReadunsafeLinearWriteunsafeLinearSwapunsafeLinearModifyunsafeLinearExchangesetcopy$fMVectorMArraya$fHasLayoutfMArrayBoxedvaluesvector unsafeFreeze unsafeThawdelay indexDelayedmanifest genDelayed$fHashableArray$fSerializeArray $fBinaryArray $fSerialArray$fVectorArraya $fNFDataArray $fReadArray$fAsEmptyArray$fEachArrayArrayab $fIxedArray $fShowArray $fEqArray$fHasLayoutfArray$fSerial1Array$fTraversableWithIndexfArray$fFoldableWithIndexfArray$fFunctorWithIndexfArray $fRead1Array $fEq1Array$fTraversableArray$fFoldableArray$fFunctorArray $fIxedDelayed$fAsEmptyDelayed$fEachDelayedDelayedab$fTraversableWithIndexfDelayed$fFoldableWithIndexfDelayed$fFunctorWithIndexfDelayed$fMetricDelayed$fAdditiveDelayed$fApplyDelayed$fTraversableDelayed $fShowDelayed$fFoldableDelayed$fHasLayoutfDelayed $fIxedFocused$fTraversableWithIndexfFocused$fFoldableWithIndexfFocused$fFunctorWithIndexfFocused$fTraversableFocused$fFoldableFocused $fShowFocused$fComonadStorefFocused$fExtendFocused$fComonadFocused$fHasLayoutfFocused$fFunctorFocused$fFunctorDelayed $fDataArrayBoundaryClampMirrorWrapPArraySArrayvalues' valuesBetweenflatfromList fromListInto fromListInto_fromVectorIntofromVectorInto_emptynull!!? unsafeIndex linearIndexunsafeLinearIndexindexM unsafeIndexM linearIndexMunsafeLinearIndexMcreatecreateTlinearGenerategenerate generateMlinearGenerateMmapimap//accumstreamGeneratestreamGenerateM streamIndexesbundleGeneratebundleGenerateM bundleIndexeszipzip3zipWithzipWith3izipWith izipWith3rowsixRowcolumnsixColumnixPlaneplanes flattenPlaneunsafeOrdinalsfreezethawdelayed seqDelayed seqManifestaffirm seqAffirmfocusOnunfocus unfocusedlocale shiftFocuspeekB peekRelativeBpeeksB$fShowBoundary$fReadBoundaryStencil mkStencilmkStencilUnboxed stencilSum$fFunctorStencil$fFoldableWithIndexfStencil$fFoldableStencil $fShowStencil unsafeWithPtrunsafeToForeignPtrunsafeFromForeignPtr ShapeLift liftShape liftShape'densev mkStencilTH mkStencilTHBy $fShapeLiftV4 $fShapeLiftV3 $fShapeLiftV2 $fShapeLiftV1Control.Lens.TypePrism'GHC.BaseStringGHC.Exception.Type SomeExceptionghc-prim GHC.TypesIntControl.Lens.Prism_Show Data.FoldablelengthData.Vector.Generic.BaseVectorControl.Lens.IndexedifoldMapfoldMapControl.Lens.SetteroverIso GHC.MaybeNothing TraversalLens'FoldableFoldableWithIndexData.Vector.StorableGHC.PtrPtrGHC.ForeignPtr ForeignPtrtemplate-haskellLanguage.Haskell.TH.SyntaxliftLiftGHC.NumNumCharLanguage.Haskell.TH.Quote QuasiQuoterLinear.VVGHC.Real Fractionalifoldr