| Date Assigned: | Thu Oct-5 |
| Date Due: | Fri Oct-6 |
Note: For this assignment, you will need apmatrix.h and apmatrix.cpp -- remember to only include apmatrix.h in your project.
Note 2: Upon further reflection, I decided that the assignment we described in class was to take a bit more time than I'd prefer, so you get a less complex assignment for tonight, but one which still demonstrates the key aspects of apmatrix.
Note 3: For this assignment, you may only create exactly 3 matrices, and they must be the smallest possible size on each iteration. Thus, you must resize them on each iteration.
Your task here is to demonstrate matrix multiplication. Like all our programs, your program will repeatedly take input from the user until a quit-pattern is entered (say, the first number is a 0). The input here will be 3 numbers, all between 1 and 9 inclusive (else, indicate an error and try again). These will represent the dimensions of the 3 matrices you should create for this iteration in the following manner: if the numbers are 2 8 3, you should create a 2x8 matrix, a 8x3 matrix, and a 2x3 matrix.
The first two matrices should be filled with random integers in the range -9 to +9 inclusive.
The third matrix represents the matrix product of the first two matrices. Each element er,c of this matrix is simply the dot product of two equal-length vectors: the rth row of matrix1 and the cth column of matrix2. Thus, for instance, if the 3 numbers are 2 8 3, and if we call the matrices x, y, and z (so z is the matrix product of x and y):
z21 = x21y11 + x22y21 + x23y31 + ... + x28y81What to output? For each iteration, output the matrices in succession. Thus, your program output should look as follows (be sure your output matches this as closely as possible!):
Please enter 3 dimensions (1-9), or 0 to quit: 2 4 3Good luck!Matrix1 = 2 3 5 -3
-3 0 1 7Matrix2 = -9 3 2
7 2 12
-5 9 8
1 0 1Matrix3 = -25 57 77
29 0 9Please enter 3 dimensions (1-9), or 0 to quit: 0
Goodbye!