Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IMPORTANT NOTE = MUST USE *char INSTEAD OF STRINGS. STRINGS MUST NOT BE USED . Q3: Matrix Operations A matrix is a collection of values

image text in transcribed

image text in transcribed

IMPORTANT NOTE = MUST USE *char INSTEAD OF STRINGS. STRINGS MUST NOT BE USED .

Q3: Matrix Operations A matrix is a collection of values in the form of rows and columns. In this question, you are required to implement the following matrix functions using C++. You can only use int** data type and DMA to create a matrix 1. Matrix Multiplication 1 int** Matrix Mul (int ** MatrixA, int rowsA, int cols A, 2 int** MatrixB, int rowsB, int cols B) { 3 /* MatrixMul implements Matrix A x Matrix B 4 Both the matrices are stored using DMA. 5 Number of rows are columns of both the matrices 6 are available in rowsA, colsA , rows B, and cols B variables. 2. Matrix Addition 1 int ** Matrix Add (int ** MatrixA, int rowsA, int cols A, int** MatrixB, int rowsB, int cols B) { 3 /# MatrixAdd implements MatrixA + Matrix 4 Both the matrices are stored using DMA. 5 Number of rows are columns of both the matrices 6 are available in rows A, colsA , rows, and cols B variables. 8 } 3. Matrix Subtraction 1 int ** Matrix Sub (int ** MatrixA, int rowsA, int cols A, int** MatrixB, int rowsB, int cols B) { 3 /* Matrix Sub implements MatrixA - Matrix B 4 Both the matrices are stored using DMA. 5 Number of rows are columns of both the matrices 6 are available in rows A, cols A , rows, and cols B variables. 8 } 4. Matrix Transpose 1 int ** Matrix Transpose( float** Matrix, int rows, int cols) { 2 /# Matrix Transpose implements transpose of a Matrix 3 The matrix is stored using DMA. 4 Number of rows are columns of the matrix 5 are available in rows and cols. 6 */ 7 } 5. Matrix Rotate 1 int ** Matrix Rotate (int ** Matrix, int rows, int cols) { 2 /* Matrix Rotate rotates a matrix 90 degree clockwise. 3 The matrix is stored using DMA. 4 Number of rows are columns of the matrix 11 22 33 44 55 66 77 88 99 into the matrix 77 44 11 88 55 22 99 66 33 Figure 1: Matrix rotation 90 degree clockwise 5 are available in rows and cols 7 } 6. Matrix Determinant See: https://people.richland.edu/james/lecture/m116/matrices/determinant.html See: https://www.math10.com/en/algebra/matrices/determinant.html 1 int Matrix Det(int ** Matrix, int rows, int cols) { 2 /* Matrix Det implements determinant of a square Matrix 3 The matrix is stored using DMA. 4 Number of rows are columns of the matrix 5 are available in rows and cols. 6 */ 7 } 7. Matrix Inverse See: https://people.richland.edu/james/lecture/m116/matrices/inverses.html 1 float** Matrix Inverse (int **Matrix, int rows, int cols) { 2 /* MatrixInverse implements in verse of a Matrix 3 The matrix is stored using DMA. 4 Number of rows are columns of the matrix 5 are available in rows and cols. 6 */ Q3: Matrix Operations A matrix is a collection of values in the form of rows and columns. In this question, you are required to implement the following matrix functions using C++. You can only use int** data type and DMA to create a matrix 1. Matrix Multiplication 1 int** Matrix Mul (int ** MatrixA, int rowsA, int cols A, 2 int** MatrixB, int rowsB, int cols B) { 3 /* MatrixMul implements Matrix A x Matrix B 4 Both the matrices are stored using DMA. 5 Number of rows are columns of both the matrices 6 are available in rowsA, colsA , rows B, and cols B variables. 2. Matrix Addition 1 int ** Matrix Add (int ** MatrixA, int rowsA, int cols A, int** MatrixB, int rowsB, int cols B) { 3 /# MatrixAdd implements MatrixA + Matrix 4 Both the matrices are stored using DMA. 5 Number of rows are columns of both the matrices 6 are available in rows A, colsA , rows, and cols B variables. 8 } 3. Matrix Subtraction 1 int ** Matrix Sub (int ** MatrixA, int rowsA, int cols A, int** MatrixB, int rowsB, int cols B) { 3 /* Matrix Sub implements MatrixA - Matrix B 4 Both the matrices are stored using DMA. 5 Number of rows are columns of both the matrices 6 are available in rows A, cols A , rows, and cols B variables. 8 } 4. Matrix Transpose 1 int ** Matrix Transpose( float** Matrix, int rows, int cols) { 2 /# Matrix Transpose implements transpose of a Matrix 3 The matrix is stored using DMA. 4 Number of rows are columns of the matrix 5 are available in rows and cols. 6 */ 7 } 5. Matrix Rotate 1 int ** Matrix Rotate (int ** Matrix, int rows, int cols) { 2 /* Matrix Rotate rotates a matrix 90 degree clockwise. 3 The matrix is stored using DMA. 4 Number of rows are columns of the matrix 11 22 33 44 55 66 77 88 99 into the matrix 77 44 11 88 55 22 99 66 33 Figure 1: Matrix rotation 90 degree clockwise 5 are available in rows and cols 7 } 6. Matrix Determinant See: https://people.richland.edu/james/lecture/m116/matrices/determinant.html See: https://www.math10.com/en/algebra/matrices/determinant.html 1 int Matrix Det(int ** Matrix, int rows, int cols) { 2 /* Matrix Det implements determinant of a square Matrix 3 The matrix is stored using DMA. 4 Number of rows are columns of the matrix 5 are available in rows and cols. 6 */ 7 } 7. Matrix Inverse See: https://people.richland.edu/james/lecture/m116/matrices/inverses.html 1 float** Matrix Inverse (int **Matrix, int rows, int cols) { 2 /* MatrixInverse implements in verse of a Matrix 3 The matrix is stored using DMA. 4 Number of rows are columns of the matrix 5 are available in rows and cols. 6 */

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Richard T. Watson

3rd Edition

0471418455, 978-0471418450

More Books

Students also viewed these Databases questions

Question

Explain in your own words the idea of subjective probability.

Answered: 1 week ago

Question

=+(18.17) [ G(n)fn=F(x)G(x)-["F(t)8(t)dt ROEnEX

Answered: 1 week ago