Apply2Cells

STD.BLAS.Apply2Cells( m, n , x, f );

mNumber of rows
nNumber of columns
xMatrix
fFunction to apply
Return:The updated matrix

The Apply2Cells function iterates a matrix and applies a function to each cell.

Example:

IMPORT STD;
STD.BLAS.Types.value_t example_1(STD.BLAS.Types.value_t v, 
                                 STD.BLAS.Types.dimensiopn_t x, 
                                 STD.BLAS.Types.dimension_t y) := FUNCTION
  RETURN IF(x=y, 1.0, 1/v);
END;

init_mat := [1, 2, 4, 4, 5, 10, 2, 5, 2];
new_mat := STD.BLAS.Apply2Cells(3, 3, init_mat, example_1);

// The new_mat matrix will be [1, .5, .25, .25, 1, .1, .5, .2, 1]

See Also: ICellFunc