Matrix.h


// Matrix: a simple dynamic matrix of doubles
//    stored internally as in Fortran (by columns)
//    indices start at 1

#ifndef _matrix_h_

class Matrix {
  
private:
 
  int   nRows, nCols;    // dimensions:  A(nCols, nRows)
  double *data;          // pointer to array data

public:

  Matrix();
  Matrix(int m, int n);
  Matrix(double* src, int m, int n); 
                   // create a matrix from a Fortran-like vector
  ~Matrix();

  Matrix &copy();                  // returns a (deep!) copy of this

  int     getColumnDimension();
  int     getRowDimension();
  double* getArray();

  double  get(int i, int j);                  // element read access
  void    set(int i, int j, double val);      // element write access
};

#define _matrix_h_
#endif

previous    contents     next

Peter Junglas 20.6.2000