sw/benchmarks/src/ocean.c
// calculate the 5-point stencil Laplacian of a subblock x
calculate the 5-point stencil Laplacian of a subblock x
calculate the 5 - point stencil Laplacian of a subblock x
void laplacian(double **result, double **x, double factor, 
    int lastrow, int lastcol)
{
    int i, j;
    for (i=1; i<=lastrow; i++) {
        for (j=1; j<=lastcol; j++) {
            result[i][j] = factor *
                (x[i+1][j] + x[i-1][j] + x[i][j+1] + x[i][j-1] - 4.0*x[i][j]);
        }
    }
}
void laplacian ( double * * result , double * * x , double factor , int lastrow , int lastcol ) { int i , j ; for ( i = 1 ; i <= lastrow ; i ++ ) { for ( j = 1 ; j <= lastcol ; j ++ ) { result [ i ] [ j ] = factor * ( x [ i + 1 ] [ j ] + x [ i - 1 ] [ j ] + x [ i ] [ j + 1 ] + x [ i ] [ j - 1 ] - 4.0 * x [ i ] [ j ] ) ; } } }
calculate the 5-point stencil Laplacian of a subblock x
calculate the 5 - point stencil Laplacian of a subblock x