You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
LECTURE NOTES OF ADVANCED DATA STRUCTURE (MT-CSE 110)<br />
Sparse Matrix Storage Representation<br />
A sparse matrix can be stored in full‐matrix storage mode or a packed<br />
storage mode. When a sparse matrix is stored in full‐matrix storage<br />
mode, all its elements, including its zero elements, are stored in an<br />
array.<br />
The seven packed storage modes used for storing sparse matrices are<br />
described in the following:<br />
• Compressed‐Matrix Storage Mode<br />
• Compressed‐Diagonal Storage Mode<br />
• Storage‐by‐Indices<br />
• Storage‐by‐Columns<br />
• Storage‐by‐Rows<br />
<strong>1.</strong> Compressed‐Matrix Storage Mode<br />
The sparse matrix A, stored in compressed‐matrix storage mode, uses<br />
two two‐dimensional arrays to define the sparse matrix storage, AC<br />
and KA. Given the m by n sparse matrix A, having a maximum of nz<br />
nonzero elements in each row:<br />
• AC is defined as AC(lda,nz), where the leading dimension, lda,<br />
must be greater than or equal to m. Each row of array AC<br />
contains the nonzero elements of the corresponding row of<br />
matrix A. For each row in matrix A containing less than nz<br />
nonzero elements, the corresponding row in array AC is padded<br />
with zeros. The elements in each row can be stored in any order.<br />
• KA is an integer array defined as KA(lda,nz), where the leading<br />
dimension, lda, must be greater than or equal to m. It contains<br />
the column numbers of the matrix A elements that are stored in<br />
the corresponding positions in array AC. For each row in matrix<br />
Prepared By :<br />
Er. Harvinder Singh<br />
Assist Prof., CSE, H.C.T.M (Kaithal) Page ‐ 126 ‐