Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/08/16 11:41:45 (8 years ago)
Author:
gkronber
Message:

#2650: merged r14245:14273 from trunk to branch (fixing conflicts in RegressionSolutionTargetResponseGradientView)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/symbreg-factors-2650/HeuristicLab.ExtLibs/HeuristicLab.Igraph/0.8.0-pre/HeuristicLab.Igraph-0.8.0-pre/Wrappers/Matrix.cs

    r14276 r14277  
    3939      DllImporter.igraph_matrix_copy(matrix, other.NativeInstance);
    4040    }
     41    public Matrix(double[,] mat) {
     42      if (mat == null) throw new ArgumentNullException("mat");
     43      matrix = new igraph_matrix_t();
     44      var nrows = mat.GetLength(0);
     45      var ncols = mat.GetLength(1);
     46      DllImporter.igraph_matrix_init(matrix, nrows, ncols);
     47      var colwise = new double[ncols * nrows];
     48      for (var j = 0; j < ncols; j++)
     49        for (var i = 0; i < nrows; i++)
     50          colwise[j * nrows + i] = mat[i, j];
     51      DllImporter.igraph_vector_init_copy(matrix.data, colwise);
     52    }
    4153    ~Matrix() {
    4254      DllImporter.igraph_matrix_destroy(matrix);
     
    4860      matrix = null;
    4961      GC.SuppressFinalize(this);
     62    }
     63
     64    public void Fill(double v) {
     65      DllImporter.igraph_matrix_fill(matrix, v);
     66    }
     67
     68    public void Transpose() {
     69      DllImporter.igraph_matrix_transpose(matrix);
     70    }
     71
     72    public void Scale(double by) {
     73      DllImporter.igraph_matrix_scale(matrix, by);
    5074    }
    5175
Note: See TracChangeset for help on using the changeset viewer.