In-class quiz 5 (Solutions)


CS 59000-NMC, 8 September

Please answer the following questions. You may not use any outside references or technology. Justify and explain all answers. This quiz is for my own evaluation, so that I can provide better instruction in the course.

Question

Let $\mA$ be a binary matrix. Suppose this matrix is composed of mostly ones and that the zeros are stored with a compressed-sparse row data structure. Write down an efficient algorithm to compute $\vy = \mA \vx$ give the compressed sparse row data structure for $\mA$’s zeros in the arrays pointer and columns.

Solution

When the matrix $\mA$ is upper-triangular, then there are no updated values of the solution that are affected by the entries of the matrix, and the two iterations will be the same.

Unexpected, and correct, but slightly trivial answer When you start the two with the correct solution!

Reason you shouldn’t solve the system them When $\mA$ is upper-triangular, then we can employ a technique called back-substitution to solve the system without an iterative method.

Back-substitution

Let $\mA$ be upper triangular:

e.g.

Note that for $\mA \vx = \vb$ that

We can use this value to find $x_{n-1}$ now:

so

Just continue in this manner through the rest of the matrix:

For this algorithm, note that you have to proceed backwards through the rows of the matrix.