Klasse Matrix, Schnittstelle


/* Matrix:
 *  matrix of doubles
 *  secure version with checks
 *  organized like Fortran array:
 *    indices running from 1 to n
 *    stored in column order
 */

class Matrix {

  public:
  
  // creates a new matrix with given number of rows and columns
  Matrix(int rows, int cols);
  
  // delete a matrix
  ~Matrix();
    
  // returns shape (= number of rows and columns) of the matrix
  int* shape();
  
  // sets Matrix(i,j) to v
  void set(int i, int j, double v);
  
  // returns Matrix(i,j)
  double get(int i, int j);
  
  // result = matmul(this, b)
  void mult(Matrix &b, Matrix &result);
  
  protected:
  
  int  nRows;
  int  nCols;         // number of colums and rows
  double  *val;       // vector of values
};

previous    contents     next

Peter Junglas 8.10.1999