MACM 316 – Computing Assignment 3


Rate this product

MACM 316 – Computing Assignment 3
A. Computing Assignment – Computational time for Gaussian elimination
In class we saw that the computation time can be calculated using Matlab’s tic and toc commands
(see the demo TicToc.m). The purpose of this assignment is to investigate the actual computation
time for Gaussian elimination for a number of different types of matrices and compare this to
theoretical results discussed in lectures.
These matrices are as follows:
1. An N × N random matrix
2. An N × N random, diagonally-dominant matrix
3. An N × N random, upper triangular matrix
4. An N × N tridiagonal matrix
5. An N × N tridiagonal matrix stored as a sparse array
Code for generating these matrices is given in the file Matrices.m.
Detailed instructions are as follows:
• Choose an appropriate number of trials and set of values for N.
• For each matrix, compute the the average time taken Tavg(N) and plot the data points
(log(N), log(Tavg(N))).
• You should find that the data follows roughly a straight line. Perform a linear fit of the data
and find the slope of the line.
• For matrices 1., 2. and 3., discuss how this value relates to theoretical results on ‘flop counts’
discussed in the lectures.
Your conclusions should be explained in a one-page report.

Scroll to Top