Performing Matrix Operations Instructions Design a class to perform various matrix operations. A matrix is a set of numbers arranged in rows and columns. Therefore, every element of a matrix has a row...



Programming Language: C++



Performing Matrix Operations<br>Instructions<br>Design a class to perform various matrix operations. A matrix is a set of numbers arranged in rows<br>and columns. Therefore, every element of a matrix has a row position and a column position. If A is<br>a matrix of five rows and six columns, we say that the matrix A is of the size 5 X 6. Clearly, a<br>convenient place to store a matrix is in a two-dimensional array. Two matrices can be added and<br>subtracted if they have the same size. Suppose A = [aj] and B = [b] and are two matrices of the<br>same size m *n in which aj denotes the element of A in the i th row and the jth column, and so on.<br>The sum and difference of A and B are given by:<br>A + B = [aj + bij]<br>A -B = [aj - bj]<br>The multiplication of A and B (A * B) is defined only if the number of columns of A is the same as<br>the number of rows of B. If A is of the size m n and B is of the size n t, then A B = [c ik ] is of the size<br>mt and the element cik is given by the formula:<br>Cik = ajbik + ajzb2k + ... + ainbnk<br>Design and implement a class matrixType that can store a matrix of any size. Overload the<br>operators +, - , and * to perform the addition, subtraction, and multiplication operations,<br>respectively, and overload the operator << to output a matrix. Also, write a test program to test<br>various operations on the matrices.<br>

Extracted text: Performing Matrix Operations Instructions Design a class to perform various matrix operations. A matrix is a set of numbers arranged in rows and columns. Therefore, every element of a matrix has a row position and a column position. If A is a matrix of five rows and six columns, we say that the matrix A is of the size 5 X 6. Clearly, a convenient place to store a matrix is in a two-dimensional array. Two matrices can be added and subtracted if they have the same size. Suppose A = [aj] and B = [b] and are two matrices of the same size m *n in which aj denotes the element of A in the i th row and the jth column, and so on. The sum and difference of A and B are given by: A + B = [aj + bij] A -B = [aj - bj] The multiplication of A and B (A * B) is defined only if the number of columns of A is the same as the number of rows of B. If A is of the size m n and B is of the size n t, then A B = [c ik ] is of the size mt and the element cik is given by the formula: Cik = ajbik + ajzb2k + ... + ainbnk Design and implement a class matrixType that can store a matrix of any size. Overload the operators +, - , and * to perform the addition, subtraction, and multiplication operations, respectively, and overload the operator < to="" output="" a="" matrix.="" also,="" write="" a="" test="" program="" to="" test="" various="" operations="" on="" the="">
Test Case<br>Incomplete<br>Input / output test 1<br>Input<br>1 2 3 4<br>1 2 3 4<br>1 2 3 4<br>5 6 7 8<br>5 6 7 8<br>5 6 7 8<br>8 9<br>8 9<br>8 9<br>8 9<br>Expected Output O<br>80 80 | 80 90 | 90 | 90<br>

Extracted text: Test Case Incomplete Input / output test 1 Input 1 2 3 4 1 2 3 4 1 2 3 4 5 6 7 8 5 6 7 8 5 6 7 8 8 9 8 9 8 9 8 9 Expected Output O 80 80 | 80 90 | 90 | 90

Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here