public void MergeColumns(params int[] colIndices)
        {
            int rows   = matrix.Rows;
            int cols   = colIndices.Length;
            int srcCol = colIndices[0];

            foreach (var i in matrix.GetNonZeroRows(srcCol).ToArray())
            {
                for (int j = 1; j < cols; j++)
                {
                    int col = colIndices[j];
                    var old = matrix[i, col];
                    matrix[i, col] = !old;
                }

                matrix[i, srcCol] = false;
            }
        }
Exemplo n.º 2
0
 public static void CopyNonZero(IBitMatrix matrix, IBitMatrix other)
 {
     if (other.IsRowMajor)
     {
         for (int i = 0; i < other.Rows; i++)
         {
             foreach (var j in other.GetNonZeroCols(i))
                 matrix[i, j] = true;
         }
     }
     else
     {
         for (int j = 0; j < other.Cols; j++)
         {
             foreach (var i in other.GetNonZeroRows(j))
                 matrix[i, j] = true;
         }
     }
 }
Exemplo n.º 3
0
 public static void CopyNonZero(IBitMatrix matrix, IBitMatrix other)
 {
     if (other.IsRowMajor)
     {
         for (int i = 0; i < other.Rows; i++)
         {
             foreach (var j in other.GetNonZeroCols(i))
             {
                 matrix[i, j] = true;
             }
         }
     }
     else
     {
         for (int j = 0; j < other.Cols; j++)
         {
             foreach (var i in other.GetNonZeroRows(j))
             {
                 matrix[i, j] = true;
             }
         }
     }
 }