Page MenuHomec4science

Matrix2x2.hpp
No OneTemporary

File Metadata

Created
Mon, Feb 24, 16:57

Matrix2x2.hpp

#ifndef Matrix2x2HEADERDEF
#define Matrix2x2HEADERDEF
#include <iostream>
class Matrix2x2
{
private:
// Private data members
// We can store the data members as a 1D array:
// M[i][j] = mMatrix[2 * i + j]
double matrix[4];
public:
// CONSTRUCTORS
Matrix2x2();
// Overriden Copy constructor
Matrix2x2(const Matrix2x2& m);
// Alternate constructor (4 entry)
Matrix2x2(const double m11, const double m12,
const double m21, const double m22);
// Deconstructor
virtual ~Matrix2x2();
// METHODS
// Method to get the matrix value
double Get(const int& i, const int& j) const;
// Method used to compute the determinant
double getDeterminant() const;
// Compute inverse of the matrix
Matrix2x2 Inverse() const;
// OPERATORS
// Overload assignment operator
Matrix2x2& operator=(const Matrix2x2& m);
// Overload unary operator
Matrix2x2 operator-() const;
// Overload plus operator
Matrix2x2 operator+(const Matrix2x2& m) const;
// Overload minus operator
Matrix2x2 operator-(const Matrix2x2& m) const;
// Method to multiply by a constant
void Multiply(const double d);
// Friends
friend std::ostream& operator<<(std::ostream& output,
const Matrix2x2& z);
};
#endif
//Code from Chapter06.tex line 746 save as ComplexNumber.hpp

Event Timeline