model_server/edge/src/matrix.cxx
/*
 * crossings_rev_rows
 * computes difference of the number of crossings before and after reversing
 * rows r and r+1
 * The algorithm follows from the algorithm to compute all crossings but is
 * linear in the number of columns.
 */
crossings_rev_rows
computes difference of the number of crossings before and after reversing
rows r and r+1
The algorithm follows from the algorithm to compute all crossings but is
linear in the number of columns.
crossings_rev_rows computes difference of the number of crossings before and after reversing rows r and r + 1 The algorithm follows from the algorithm to compute all crossings but is linear in the number of columns .
int 
matrix::crossings_rev_rows(int r)
{
  register int s, i, subrow0, subrow1;
  s = subrow0 = subrow1 = 0;
  for (i=1; i<columns; i++) {
    subrow0 += m[r][i-1];
    subrow1 += m[r+1][i-1];
    s += m[r][i] * subrow1 - m[r+1][i] * subrow0;
  } 
  return s;
}
int matrix :: crossings_rev_rows ( int r ) { register int s , i , subrow0 , subrow1 ; s = subrow0 = subrow1 = 0 ; for ( i = 1 ; i < columns ; i ++ ) { subrow0 += m [ r ] [ i - 1 ] ; subrow1 += m [ r + 1 ] [ i - 1 ] ; s += m [ r ] [ i ] * subrow1 - m [ r + 1 ] [ i ] * subrow0 ; } return s ; }
crossings_rev_rows
 computes difference of the number of crossings before and after reversing
 rows r and r+1
 The algorithm follows from the algorithm to compute all crossings but is
 linear in the number of columns.
crossings_rev_rows computes difference of the number of crossings before and after reversing rows r and r + 1 The algorithm follows from the algorithm to compute all crossings but is linear in the number of columns .