Project 2 / Matrices
Project 2
The Task
Please write a program based on the software components we have developed in our lecture for the multiplication of some matrices as given in equation ??.
S=A1 · A2 ···An
The User Interface
The problem should be described in an input file with the following format. The first line contents the number of matrices to multiply. The second line contents the number of rows and columns of the first matrix. The following lines content the values of the first matrix. The next line contents the dimension of the next matrix and the following lines content the data of the matrix.
The problem should be scalable, that means you should use dynamical allocatable arrays to implement the program variables. To hold the matrix data in memory you should minimize the allocated memory to make the program as efficient as possible. Step by step the read matrices should be printed to an output file and at the end the product matrix should be given in the output file.
The format and the values of the used matrix data are given in an text input file of the following format as discussed above.
- [number of matrices]
- [rows 1] [columns 1]
- [data of matrix 1]
- [rows 2] [columns 2]
- [data of matrix 2]
...- [rows of last matrix] [columns of last matrix]
- [data of last matrix]
An example data file to multiply three matrices is given below.
- 3
- 3 4
- 2. 3. 4.
- 6. 7. 8.
- 10. 11. 12.
- 4 2
- 1 0.2
- 3 0.4
- 5 0.6
- 7 0.8
- 2 1
- -1.
- -2.