Matrix
- Objective:
Array implementation of a matrix.
- Description:
The objective is to build a matrix class. The matrix class member functions/methods include but are not limited to the following:
-
a)Multiply a given matrix by another matrix or a scalar (a real or integer number).Overload the "*" operator.
- b) Multiply a single row of a matrix by a scalar. If M is a matrix M[i] represents
the ith row.
-
c) Adding two matrices or adding each matrix element to a scalar. Overload the "+" operator.
- d) Adding a row of a matrix to a scalar or another row. For example, If M is a matrix, we can use the syntax M[i] = M[i] + 100 or M[i] = M[i] + M[j].
- e) Swapping two rows of a matrix by using the statement swap(M[k], M[j]).
- f) Creating a transpose of given matrix. In order to transpose we need to
swap(M[i,j], M[j,i]) for all possible i's and j's. Overload the "!" operator for
transpose so that we can use the syntax
Matrix Mtranspose = !M;
- This program is coded in MicrosoftVisual C++, but it also compiles in the UNIX G++ C++ compiler.
- Implementation:
To view this program in MS Word format Click here