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