Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F102836980
Matrix2x2.hpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Feb 24, 16:57
Size
1 KB
Mime Type
text/x-c++
Expires
Wed, Feb 26, 16:57 (1 d, 19 h)
Engine
blob
Format
Raw Data
Handle
24429316
Attached To
R1106 Programming Concept Rouaze
Matrix2x2.hpp
View Options
#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
Log In to Comment