Matthew's Stats
Time it took Matthew to complete: 3.5 hours (you'll likely be much faster. I tried using macros here and ran into a lot of problems with them)
What to Submit
matmult.s
Starter Code
Download StarterCode.zip for the starter code. It should contain
main.c
matmult.s (intentionally left empty)
Makefile
Tests
Prompt
Write a function that implements matrix multiplication in assembly. The function should have the following signature: int** matMult(int **a, int num_rows_a, int num_cols_a, int** b, int num_rows_b, int num_cols_b);
If you don't know how to do matrix multiplication, you can find a tutorial at https://www.mathsisfun.com/algebra/matrix- multiplying.html
You have been given a C file called main.c that accepts as command line arguments the names of two files that contain the matrices to be multiplied. main.c will read in these matrices, call your function, and then display the result. After it has displayed the result, it will then free the space that has been dynamically allocated. You may NOT edit main.c
You have also been given a Makefile that should compile your program.
Program Requirements And Restrictions
You may NOT use the data section in your solution. Doing so will result in a SCORE OF ZERO
You MUST dynamically allocate space for your resulting matrix
Your program MUST be compilable by the given Makefile.
Compiling To A 32-Bit Program On A 64-Bit Machine
If you are on a 64-bit machine, you will need to install gcc-multilib to be able to compile to a 32 bit binary. If you are on Ubuntu (or running Ubuntu inside WSL), you can do this by running the following command: sudo apt-get -y install gcc- multilib.
Examples Example 1
cat mata/0-test.txt
3
3
470 -192 -539
235 -814 -538
-503 -418 541
https://us.prairielearn.com/pl/course_instance/147529/instance_question/362524469/
1/2
2/29/24, 4:52 PM HW3.1 - ECS 50 | PrairieLearn
Files |
matmult.s not uploaded |
./matmult.out mata/0-test.txt matb/0-test.txt
-150559 -384480 81146
-239743 -1043315 370572
125456 -155903 361902