Hi!
I'm building a Class for matrixes.
I have already built several funtions for adding, subtracting, transpose, multiply,..
Now I'm trying to do a function to calculate the inverse...
Can anyone help me?
class CMatrix
{
public:
void Identity();
void SetMaxColRow(int nRow, int nCol);
void SetElement(int nRow, int nCol, double element);
void Show();
double GetElement(int nRow, int nCol);
CMatrix operator+(CMatrix tmpMatriz);
CMatrix operator-(CMatrix tmpMatriz);
CMatrix operator*(double scalar);
CMatrix operator*(CMatrix tmpMatriz);
CMatrix Transpose();
CMatrix(int nRows, int nCols);
CMatrix();
virtual ~CMatrix();
int m_nRows;
int m_nCols;
private:
double **m_pMatriz;
// constructor
CMatrix::CMatrix(int nRows, int nCols)
{
m_nCols= nCols;
m_nRows = nRows;
m_pMatriz = new double* [m_nRows];
for (int i=0; i<m_nRows; i++)
{
m_pMatriz[i] = new double[m_nCols];
for (int j=0; j<m_nCols; j++)
m_pMatriz[i][j] = 1.0;
}
}