Question: (Please Answer this question) Answer IN C++ A matrix is a two-dimensional array of values that is often used to represent a linear transformation or
(Please Answer this question) Answer IN C++
A matrix is a two-dimensional array of values that is often used to represent a linear transformation or a system of equations.
The implementation of the Matrix class should involve two files. The first, containing the class definition, is located in matrix.h(pp). The second file, matrix.cpp, contains the definitions of all functions and operators pertaining to the matrix class. A tester file should also be included.
Two unsigned integers, representing the number of rows and columns of the matrix
A 2-dimensional array of doubles which contains the data for the matrix. This array must be dynamically allocated
The constructor takes two arguments, one for number of rows, and one for number of columns
The constructor sets all values in the matrix to zero
Do not allow for a copy constructor
Allow for automatic conversion from unsigned integer, which creates an n x n identity matrix
getNumRows and getNumColumns which get the number of rows and columns respectively. Allow for inlining of these two functions.
getRow and getColumn which take in an index and return the specified row/column as an array
setRow and setColumn which take in a std::vector of doubles, and an index, which sets the contents of the row/column respectively
Automatic type conversion from Matrix to double which returns the average of all elements.
Overloaded operators for multiplication, addition, subtraction, and division of a matrix and a scalar
Overloaded operators for multiplication, addition, and subtraction of matrices
Overloaded index operator, which gives direct access to the contents of the row specified at the index. There should be a const and non-const version of this operator.
The ostream operator, which prints out the matrix in a row-wise manner.
The istream operator, which reads the matrix in the following format: { { a, b, c }, { d, e, f }, { g, h, i }, { j, k, l } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
