Changes between Version 18 and Version 19 of DataParallel/Regular


Ignore:
Timestamp:
Jan 18, 2010 5:29:31 AM (4 years ago)
Author:
gckeller
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DataParallel/Regular

    v18 v19  
    149149 
    150150The `map` operation takes a function over element types and applies it to every 
    151 data element of the DArray, which can have arbitrary dimensionality. Note that  
    152 it is not possible to use this function to apply an operation for example to every 
    153 row or column of a matrix. We will discuss how this can be done later on. 
    154  
    155 {{{map:: (U.Elt a, U.Elt b, A.Shape dim) =>  (a -> b) -> DArray dim a -> DArray dim b}}} 
     151data element of the DArray, which can have arbitrary dimensionality. 
     152{{{ 
     153map:: (U.Elt a, U.Elt b, A.Shape dim) =>  (a -> b) -> DArray dim a -> DArray dim b 
     154}}} 
    156155 
    157156Similarily, `zip` and `zipWith` apply to every data element in the array as well. Both arguments 
     
    280279to be done at run time using assertions. 
    281280 
     281== `Nesting' Array Functions == 
     282 
     283We already introduced the `map` function, which applies a given function to all data elements 
     284of an array: 
     285{{{ 
     286map:: (U.Elt a, U.Elt b, A.Shape dim) =>  (a -> b) -> DArray dim a -> DArray dim b 
     287}}} 
     288We can't use `map`, however, to apply a function to all columns, rows, or other sub-arrays of  
     289a multidimensional array, and generalising `map` to be able to handle this wouldn't make sense 
     290in this framework. Consider, for example, a function `filter`, which takes a one-dimensional  
     291array and creates a new array containing only the even elements of the argument array. If we mapped 
     292this function over all the rows of a two-dimensional array, the resulting structure would, in general, 
     293not be a two dimensional array anymore, since each row might potentially have a different length.  
     294Therefore, we restrict the class of functions that can be mapped over sub-arrays to functions where  
     295the shape of the argument determines the shape of the result. In other words, it can't depend on the data 
     296values.  
     297 
     298 
     299 
    282300== Open Questions == 
    283301