This program performs operations on sparse matrices (addition, subtraction, and multiplication) and stores the results in files.
- Load sparse matrices from files
- Perform matrix operations:
- Addition
- Subtraction
- Multiplication
- Save results to files in a 'results' directory
Matrix files should be in the following format:
rows=<number_of_rows> cols=<number_of_columns> (row, column, value) (row, column, value)
-
Run the program:
python sparse_matrix.py -
Choose an operation:
- 1: Add matrices
- 2: Subtract matrices
- 3: Multiply matrices
-
Enter paths to the two matrix files when prompted
-
copy the relative path of the sample input file you want to use
-
Results will be saved in the 'results' directory as well as the result of the previously ran results
-
You can delete the file in the results to save the new file
-
View the generated output from the previously ran code in the Result folder
- Python 3
- No external dependencies required
- Run with Python3 if you are using ubuntu
- The program automatically creates a 'results' directory if it doesn't exist
- Matrix dimensions must be compatible for the chosen operation
- Zero values are not stored in the sparse matrix representation
To Alu for this deeply Insightful project!