Saint Louis University |
Computer Science 146
|
Dept. of Math & Computer Science |
Topic: Matrix Multiplication
Due:
11:59pm Tuesday, 2 October 2012
Please make sure you adhere to the policies on academic integrity.
In class, we gave an initial implementation of the matrix class that supported construction, indexing, and addition, as well as scalar multiplication. Your goal is to implement the function to support matrix multiplications. It has signature
matrix operator*(const matrix& other) constIts responsibility is to return a new matrix that results when multiplying two matrices (e.g., A*B).
We are providing the basic framework for the matrix class, and a very simple driver named test that allows you to enter the name of a file that contains data for two matrices, separated by a blank line, and which reads those matrices and then tries to perform the appropriate additions and multiplications based upon the dimensions of those matrices.
cp -R /Public/goldwasser/146/asgn03 .This will cause a new folder named asgn03 to appear in your working directory including all files that you need for this assignment. Alternatively, these files can be downloaded individual from this website. There are four files in the distribution:
34.000 22.000 126.000 82.000The product B*A is also a 2x2 matrix, with contents:
52.000 72.000 46.000 64.000
140.000 150.000 348.000 374.000The product of B*A should be the 4x4 result
65.000 86.000 107.000 128.000 77.000 102.000 127.000 152.000 89.000 118.000 147.000 176.000 101.000 134.000 167.000 200.000
makeit will attempt to compile your matrix code and the test driver. Assuming it compiles cleanly, you can execute the driver by subsequently typing
./test
Your assignment should be submitted electronically (details on the submission process). The only file that I need from you is the source code matrix.h.