19.07.2014 Views

Contents - Student subdomain for University of Bath

Contents - Student subdomain for University of Bath

Contents - Student subdomain for University of Bath

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

3.2. LINEAR EQUATIONS IN SEVERAL VARIABLES 65<br />

3.2.2 Representations <strong>of</strong> Matrices<br />

The first question that comes to mind here is “dense or sparse?”, as in definition<br />

22 (page 31). For a dense representation <strong>of</strong> matrices, the solution is obvious:<br />

we store a two-dimensional array (or one-dimensional array <strong>of</strong> one-dimensional<br />

arrays if our language does not support two-dimensional arrays) containing the<br />

values m i,j <strong>of</strong> the elements <strong>of</strong> the matrix. The algorithms <strong>for</strong> adding and multiplying<br />

dense matrices are pretty obvious, though in fact it is possible to multiply<br />

two 2 × 2 matrices with seven multiplications <strong>of</strong> entries rather than the obvious<br />

eight [Str69, Win71]: this leads to being able to multiply two n × n matrices<br />

with O(n log 2 7≈2.807 ) element multiplications rather than O(n 3 ): see Excursus<br />

B.4.<br />

For a sparse representation <strong>of</strong> matrices, we have more choices.<br />

row-sparse Here M is stored as a one–dimensional array <strong>of</strong> rows: the i-th<br />

row consisting <strong>of</strong> a list <strong>of</strong> pairs (j, m i,j ). This representation is equivalent<br />

to that <strong>of</strong> the sparse polynomial ∑ j m i,jx j , and this technique has been<br />

used in practice [CD85] and has a useful analogue in the case <strong>of</strong> non-linear<br />

equations (see section 3.3.5).<br />

column-sparse Here M is stored as a one–dimensional array <strong>of</strong> columns: the<br />

j-th column consisting <strong>of</strong> a list <strong>of</strong> pairs (i, m i,j ).<br />

totally sparse Here M is stored as a list <strong>of</strong> triples (i, j, m i,j ).<br />

structured There are a large variety <strong>of</strong> special structures <strong>of</strong> matrices familar to<br />

numerical analysts, such as ‘banded’, ‘Toeplitz’ etc. Each <strong>of</strong> these can be<br />

stored efficiently according to their special <strong>for</strong>m. For example, circulant<br />

(a special <strong>for</strong>m <strong>of</strong> Toeplitz) matrices, <strong>of</strong> the <strong>for</strong>m<br />

⎛<br />

a 1 a 2 a 3 . . . a n−1 a n<br />

⎞<br />

a 2 a 3 . . . a n−1 a n a 1 a n a 1 a 2 a 3 . . . a n−1<br />

⎜<br />

⎝ .<br />

. .. .<br />

⎟<br />

· · · · · · .. ⎠ ,<br />

.<br />

are, strictly speaking, dense, but only have n distinct entries, so are<br />

“in<strong>for</strong>mation-sparse”.<br />

Clearly, if the matrix is structured, we should use the corresponding representation.<br />

For randomly sparse matrices, the choice depends on what we are doing<br />

with the matrix: if it is row operations, then row-sparse is best, and so on. One<br />

big issue with sparse matrices is known as fill-in — the tendency <strong>for</strong> operations<br />

on sparse matrices to yield less sparse matrices. For example, if we multiply two<br />

n × n matrices, each with e non-zero elements per row, with n ≫ e, we would<br />

expect, assuming the non-zero elements are scattered at random, the resulting<br />

matrix to have e 2 non-zero elements per row. This has some apparently paradoxical<br />

consequences. Suppose M and N are two such matrices, and we wish to<br />

compute MNv <strong>for</strong> many vectors v. Clearly, we compute MN once and <strong>for</strong> all,

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!