Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
LECTURE NOTES OF ADVANCED DATA STRUCTURE (MT-CSE 110)<br />
AD and LA. Using the above convention for numbering the<br />
diagonals, and given that sparse matrix A contains nd diagonals<br />
having nonzero elements, arrays AD and LA are set up as follows:<br />
• AD is defined as AD(lda,nd), where the leading dimension,<br />
lda, must be greater than or equal to n. Each diagonal of<br />
matrix A that has at least one nonzero element is stored in a<br />
column of array AD. All of the elements of the diagonal,<br />
including its zero elements, are stored in n contiguous<br />
locations in the array, in the same order as they appear in<br />
the diagonal. Padding with zeros is required as follows to fill<br />
the n locations in each column of array AD:<br />
o Each superdiagonal (k > 0), which has n‐k elements, is<br />
padded with k trailing zeros.<br />
o The main diagonal (k = 0), which has n elements, does<br />
not require padding.<br />
o Each subdiagonal (k < 0), which has n‐|k| elements, is<br />
padded with |k| leading zeros.<br />
• LA is a one‐dimensional integer array of length nd, containing<br />
the diagonal numbers k for the diagonals stored in each<br />
corresponding column in array AD.<br />
3. Storage‐by‐Indices<br />
For a sparse matrix A, storage‐by‐indices uses three one‐<br />
dimensional arrays to define the sparse matrix storage, AR, IA, and<br />
JA. Given the m by n sparse matrix A having ne nonzero elements,<br />
the arrays are set up as follows:<br />
• AR of (at least) length ne contains the ne nonzero elements of<br />
the sparse matrix A, stored contiguously in any order.<br />
• IA, an integer array of (at least) length ne contains the<br />
Prepared By :<br />
Er. Harvinder Singh<br />
Assist Prof., CSE, H.C.T.M (Kaithal) Page ‐ 129 ‐