View the matrix.pdf file for the full assignment details.Based on the aforementioned representation, implement a matrix data structure, along with thethree operators: addition, multiplication, and...

1 answer below »



View the matrix.pdf file for the full assignment details.






Based on the aforementioned representation, implement a matrix data structure, along with the



three operators: addition, multiplication, and transpose. You must adhere to the C structures and



function prototypes as given in the matrix.C starter file.






The starter file matrix.c is provided. You may add your own user defined functions, but not



your own user defined types. You may not modify existing function signatures. You may not



add/remove a single attribute to/from ANY of the existing C structures.






Untitled document A matrix is a two-dimensional structure of elements arranged into rows and columns with associated algebraic operations. The dimensions of a matrix are written as m * n; with m representing the number of rows and n representing the number of columns. Matrix elements are indexed from 1 to m and 1 to n. Each element is identified by naming the row and column in which it appears. For example, consider matrix A with dimensions 4 x 6: The element a31 is the entry in the third row and the first column. In this case a31 = 4. In general, the element in row i and column j of matrix A is denoted as aj. Algebraic Operations The three main algebraic operations on matrices that we will define are addition, multiplication, and transpose. First, consider addition. Addition is applied only to pairs of matrices that have the exact same number of rows and the exact same number of columns. Multiplication is a little more complicated. If A is m*x and B is p*q, then we can compute C=A*B if and only if n=p. Lastly, the transpose of a matrix is an operator which flips a matrix over its diagonal andis defined for any matrix. Matrix Representation It is frequently necessary to manipulate large matrices by means of a computer. Matrices are heavily used to perform image processing on digital images and videos Manipulating an image with 4K resolution, for example, requires at least two matrices with approximately ten million elements each. However, typically, about half of the matrices required for image manipulation have elements with a dominant value such as -1, 0, or 1. In fact, often there are only 0(m) elements which have values different from the dominant one. In such cases, explicitly representing the elements with the dominant value wastes valuable memory space. Therefore, special-purpose matrix representations are often developed. There are many established ways to minimally store a matrix in memory. It is of course necessary to tailor common matrix computation algorithms to the specific data structure in use. One popular representation is a structure where linked lists are used to represent a matrix. This representation uses two different types of nodes; namely header nodes and element nodes. In this scheme, the 4 x 6 matrix represented as: Has the following linked representation: Task Based on the aforementioned representation, implement a matrix data structure, along with the three operators: addition, multiplication, and transpose. You must adhere to the C structures and function prototypes as given in the matrix.C starter file. - You must follow the data structure design in the handout down to every little detail. Your input/output test data must match the sample given (matrixA.txt and matrixT.txt). - The test data use single digit integers, but that is not necessarily true for all test cases. For all practical purposes, the elements in the matrix are signed integers. - Do not make any assumption regarding the length of each line in the input/output files. A single line in the input/output files contains all the elements for the corresponding matrix row. Matrix elements in the input/output files are separated by a single space character. Each line in the input/output files ends with a linefeed character. - Do not make any assumptions regarding the size of the matrices. The test data use matrices of enormous size. - The starter file matrix.c is provided. You may add your own user defined functions, but not your own user defined types. You may not modify existing function signatures. You may not add/remove a single attribute to/from ANY of the existing C structures. When it comes to C-code compliancy rules, please follow these guidelines: - Global variables are not allowed. - Static variables defined at the file level are not allowed. - Static variables defined at a function level are not allowed. - The use of the preprocessor directives, except for #include, is not allowed. - The valid Standard C Library functions are the ones documented in the textbook (The C Programming Language, Kernighan & Ritchie), Appendix B (Pg 220-235). Deliverables A file named matrix.C containing the ANSI C source code. The submission must not produce any compilation warnings or errors. Therefore, make sure it compiles cleanly using the gcc compiler as follows: $ gcc -ansi -Wall -Wextra -Wpedantic -Werror matrix.c 0 0 0 0 9 0 0 0 0 0 0 0 4 0 0 8 0 0 0 0 2 0 4 0 0 0 4 0 0 0 0 0 0 0 0 2 0 0 8 0 9 0 0 4 0 0 0 0
Answered 4 days AfterMar 04, 2023

Answer To: View the matrix.pdf file for the full assignment details.Based on the aforementioned representation,...

Ashutosh Sanjay answered on Mar 07 2023
31 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here