#include <Matrix.h>
Public Member Functions | |
Matrix (int m, int n) | |
Create a matrix Note that the elements of the matrix will be random, they have NOT been initialized to zero or any other value. | |
Matrix (Matrix &M) | |
Copy constructor. | |
Matrix (Matrix *M) | |
Similar to the copy constructor. | |
virtual | ~Matrix () |
virtual void | print () |
Prints the matrix on the screen. | |
virtual real & | elementAt (int i, int j) |
Value of a given cell in the matrix. | |
virtual Matrix * | multiply (Matrix &other) |
Multiplies the matrix with the given matrix and returns a new matrix. | |
virtual Matrix * | multiply (Matrix *other) |
Multiplies the matrix with the given matrix and returns a new matrix. | |
virtual void | multiply (real f) |
Multiplies the matrix with the scalar quantity provided. | |
virtual void | swapRows (int i, int j) |
Swaps the ith and jth row of the matrix. | |
virtual Matrix * | transpose () |
Finds the transpose of the matrix You will have to deallocate the tranpose matrix with delete. | |
virtual Matrix * | inverse () |
Finds the inverse of the matrix You will have to deallocate the inverse matrix with delete. | |
Static Public Member Functions | |
Matrix * | Identity (int n) |
Returns the identity matrix of size nxn. | |
Friends | |
std::ostream & | operator<< (std::ostream &s, Matrix &M) |
Prints matrix to the provided output stream. |
This probably isn't the most efficient way to do matrix operations, use of optimized matrix libraries would be preferable, but this should suffice for most applications
|
Create a matrix Note that the elements of the matrix will be random, they have NOT been initialized to zero or any other value.
|
|
Copy constructor.
|
|
Similar to the copy constructor.
|
|
|
|
Value of a given cell in the matrix.
|
|
Returns the identity matrix of size nxn. You will have to deallocate the identity matrix with delete
|
|
Finds the inverse of the matrix You will have to deallocate the inverse matrix with delete. Uses the gaussian elmination technique to calculate the inverse
|
|
Multiplies the matrix with the scalar quantity provided.
|
|
Multiplies the matrix with the given matrix and returns a new matrix. You will have to deallocate the product matrix with delete.
|
|
Multiplies the matrix with the given matrix and returns a new matrix. You will have to deallocate the product matrix with delete.
|
|
Prints the matrix on the screen.
|
|
Swaps the ith and jth row of the matrix.
|
|
Finds the transpose of the matrix You will have to deallocate the tranpose matrix with delete.
|
|
Prints matrix to the provided output stream.
|