Exemple #1
0
        public double[,] ToMatrix()
        {
            var result = new double[Rows, Columns];

            for (var i = 0; i < Rows; i++)
            {
                for (var j = 0; j < Columns; j++)
                {
                    result[i, j] = DllImporter.igraph_matrix_e(matrix, i, j);
                }
            }
            return(result);
        }
Exemple #2
0
 public double this[int row, int col] {
     get {
         if (row < 0 || row > Rows || col < 0 || col > Columns)
         {
             throw new IndexOutOfRangeException("Trying to get cell(" + row + ";" + col + ") of matrix(" + Rows + ";" + Columns + ").");
         }
         return(DllImporter.igraph_matrix_e(matrix, row, col));
     }
     set {
         if (row < 0 || row > Rows || col < 0 || col > Columns)
         {
             throw new IndexOutOfRangeException("Trying to set cell(" + row + ";" + col + ") of matrix(" + Rows + ";" + Columns + ").");
         }
         DllImporter.igraph_matrix_set(matrix, row, col, value);
     }
 }