-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDblMatrix.H
55 lines (49 loc) · 1.83 KB
/
DblMatrix.H
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/***********************************************************************
DblMatrix.H
BOOM : Bioinformatics Object Oriented Modules
Copyright (C)2012 William H. Majoros ([email protected]).
This is OPEN SOURCE SOFTWARE governed by the Gnu General Public
License (GPL) version 3, as described at www.opensource.org.
***********************************************************************/
#ifndef INCL_BOOM_DblMatrix_H
#define INCL_BOOM_DblMatrix_H
#include <iostream>
#include "Array2D.H"
#include "Array1D.H"
#include "Vector.H"
using namespace std;
namespace BOOM {
class DblMatrix;
void multiply(BOOM::DblMatrix &leftM,BOOM::DblMatrix &rightM,
BOOM::DblMatrix &resultMatrix);
class DblMatrix
{
public:
DblMatrix(int rows,int columns);
DblMatrix(const BOOM::DblMatrix &other);
virtual double operator()(int row,int col) const;
virtual double &operator()(int row,int col);
DblMatrix &operator=(BOOM::DblMatrix &);
bool invert(BOOM::DblMatrix &resultingMatrix) const;
virtual int getNumColumns() const;
virtual int getNumRows() const;
int getFirstDim() const {return getNumRows();}
int getSecondDim() const {return getNumColumns();}
void addRowMultiple(int sourceRow,int destinationRow,double factor);
void getColumn(int column,BOOM::DblArray1D &into) const;
void getColumn(int column,BOOM::Vector<double> &into) const;
void getRow(int row,BOOM::DblArray1D &into) const;
void getRow(int row,BOOM::Vector<double> &into) const;
void multiplyRowBy(int whichRow,double factor);
void printOn(ostream &);
void setAllTo(double d);
void swapRows(int r1,int r2);
void times(const BOOM::DblMatrix &,BOOM::DblMatrix &resultMatrix) const;
void transpose(BOOM::DblMatrix &resultMatrix) const;
void resize(int,int);
private:
BOOM::Array2D<double> theArray;
};
}
ostream &operator<<(ostream &,BOOM::DblMatrix &);
#endif