Question: COSC 1430 HW3: Sparse Matrix Addition 1-Objective This homework assignment will give you a better understanding of how to parse an input file and use





COSC 1430 HW3: Sparse Matrix Addition 1-Objective This homework assignment will give you a better understanding of how to parse an input file and use structs to combine several variables in one object 2 - Problemm For this assignment, you will create a C++ program, named spa rseAdd.epp and you must submit in your home folder on the server. This program will add two sparse matrices in an efficient manner. Sparse matrices have many zero entries, but such entries are omitted in the input file and corresponding data structures to save memory and reduce processing time. You will read in 2 files and output 1 file you must ask the user for the names of the files in the console. Note: Functions are a good way to increase the modularity of your code. 2.1 Matrices and Matrix Addition: Subscripts in input and output files are matrices that are based on a standared mathematical definition, indexed from 1. Matrices of size m x n start on 1,1 and go up to m,n. Therefore, the input foutput matrices should always have subscripts starting at 1,1 2.2 Matrix Addition: The addition of 2 matrices is done by adding each element of the matrices that are the same size. Assuming a matrix Mi and M2 are of size m x n, the sum would be M3-M1, M2 Yrewhere i srs m, 1scs n. M., represents the value of the matrix at row r and column c, and Ma and M2 are the input matrices 2.2 Storage You must store each input matrix as a single 1-dimensional dynamic array of structs struct efement f F8 F9 F10 F11 F F6 F7
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
