예제 #1
0
 public static void PrintMatrixInfo(COOMatrix coo)
 {
     Console.WriteLine("------------------- Matrix Info -------------------");
     Console.WriteLine("Rows: " + coo.Rows.ToString());
     Console.WriteLine("Cols: " + coo.Cols.ToString());
     Console.WriteLine("NNZ: " + coo.NNZ.ToString());
 }
예제 #2
0
 public static void PrintCOO(COOMatrix coo)
 {
     for (int i = 0; i < coo.NNZ; i++)
     {
         Console.WriteLine(coo.RowArray[i].ToString() + '\t'
                           + coo.ColArray[i].ToString() + '\t'
                           + coo.ValueArray[i].ToString());
     }
 }
예제 #3
0
        public static void WriteCOOMatrix(COOMatrix mat, string path)
        {
            StreamWriter sw = new StreamWriter(path);

            sw.WriteLine("# ALFE COO Matrix");
            sw.WriteLine(mat.Rows.ToString() + ' ' + mat.Cols.ToString() + ' ' + mat.NNZ.ToString());
            for (int i = 0; i < mat.NNZ; i++)
            {
                sw.WriteLine((mat.RowArray[i] + 1).ToString() + ' ' + (mat.ColArray[i] + 1).ToString() + ' ' + mat.ValueArray[i].ToString());
            }
            sw.Flush();
            sw.Close();
            sw.Dispose();
        }