Q1. Design a generic matrix multiplier. Here 'generic' means the design should work for any matrix multiplication X-Y = Z, where the matrices X, Y, and Z are of sizes axb, bxc, and axc respectively. Now, pick a, b, c from the last three digits of your roll number. ( If any of the digits is 0, take 3 instead of it; if two digits are Os, then take 3 for the first 0, and 5 for the second 0) For Example, if the last three digits are 123 then a = 1, b = 2, and c = 3; if the last three digits are 204 then a = 2, b = 3, c = 4; f the last three digits are 100 then a = 1, b = 3, c = 5. You are free to choose the elements of the matrices but you need to use those while solving the problem on paper.
Q1. Design a generic matrix multiplier. Here ‘generic’ means the design should work for any
matrix multiplication X∙Y = Z, where the matrices X, Y, and Z are of sizes a×b, b×c, and a×c
respectively. Now, pick a, b, c from the last three digits of your roll number. ( If any of the digits
is 0, take 3 instead of it; if two digits are 0s, then take 3 for the first 0, and 5 for the second 0)
For Example, if the last three digits are 123 then a = 1, b = 2, and c = 3; if the last three digits
are 204 then a = 2, b = 3, c = 4; f the last three digits are 100 then a = 1, b = 3, c = 5.
NOTE: Implementation provided in c++ language.
Considerations are made as specified in the question:
- While implementing the program, the last three digits of the roll number are taken as input from the user.
- If any digit in the number is '0' then that digit is replaced with '3'.
- If any two digits in the number are '0' then the first digit is replaced with '3' and the second digit is replaced with '5'.
- Three digits of roll numbers are used as sizes of the matrix.
- The first digit of the roll number is 'a'.
- The second digit is 'b'.
- The third digit is 'c'.
- Matrix X with size a*b, Matrix Y with size b*c
- ex: a=1 b=2 c=3
- Data in matrix X with size 1*2,rows =1, columns=2
-
- Data in matrix Y with size 2*3, rows=2 columns =3
-
- multiplication of matrix X and Y:
The matrix Z of size 1*3 is generated. Matrix Z size is a*c
Step by step
Solved in 3 steps with 4 images