For this lab, you will write parallel code for multiplying square matrices. You will start with this MatrixLab.java program which contains a simple matrix class and a main method containing a test.
You will need to fill in the multiplyMatrices function to perform the multiplication. You will also need to create a class representing the thread.
The example in main uses these two 3x3 matrices:
Matrix multiplication is done based on the row and column of the two matrices. The value of location (i,j) in the product is the dot product of row i in the left matrix and column j in the right matrix.
This is illustrated below:
The correct answer for the example should be:
You should create one thread for each cell in the result matrix (9 threads in the example above). Each one should be sent the two matrices and the result matrix.
Copyright © 2018 Ian Finlayson | Licensed under a Creative Commons Attribution 4.0 International License.