doc/app/wavefront/omp.cpp
//computation given block row index i, block col index j
computation given block row index i, block col index j
computation given block row index i block col index j
void block_computation(int i, int j){
  int start_i = i*B;
  int end_i = (i*B+B > M) ? M : i*B+B;
  int start_j = j*B;
  int end_j = (j*B+B > N) ? N : j*B+B;
  for ( int ii = start_i; ii < end_i; ++ii ) {
    for ( int jj = start_j; jj < end_j; ++jj ) {
      double v0 = ii == 0 ? 0 : matrix[ii-1][jj];
      double v1 = jj == 0 ? 0 : matrix[ii][jj-1];
      matrix[ii][jj] = ii==0 && jj==0 ? 1 : calc(v0,v1);
    }
  }
}
void block_computation ( int i , int j ) { int start_i = i * B ; int end_i = ( i * B + B > M ) ? M : i * B + B ; int start_j = j * B ; int end_j = ( j * B + B > N ) ? N : j * B + B ; for ( int ii = start_i ; ii < end_i ; ++ ii ) { for ( int jj = start_j ; jj < end_j ; ++ jj ) { double v0 = ii == 0 ? 0 : matrix [ ii - 1 ] [ jj ] ; double v1 = jj == 0 ? 0 : matrix [ ii ] [ jj - 1 ] ; matrix [ ii ] [ jj ] = ii == 0 && jj == 0 ? 1 : calc ( v0 , v1 ) ; } } }
computation given block row index i, block col index j
computation given block row index i block col index j