Sparse matrix: Difference between revisions

Content deleted Content added
m Reverted 1 edit by 85.170.132.241 (talk) to last revision by Fgnievinski
Ennomien (talk | contribs)
no external links in text
Line 102:
* The arrays {{math|V}} and {{math|COL_INDEX}} are of length {{math|NNZ}}, and contain the non-zero values and the column indices of those values respectively
* {{math|COL_INDEX}} contains the column in which the corresponding entry {{math|V}} is located.
* The array {{math|ROW_INDEX}} is of length {{math|''m'' + ''1''}} and encodes the index in {{math|V}} and {{math|COL_INDEX}} where the given row starts. This is equivalent to {{math|ROW_INDEX[j]}} encoding the total number of nonzeros above row {{math|j}}. The last element is {{math|NNZ}} , i.e., the fictitious index in {{Math|V}} immediately after the last valid index {{math|NNZ - 1}}. <ref>{{cite book |last1=Saad |first1=Yousef |title=Iterative methods for sparse linear systems |date=2003 |publisher=SIAM}}</ref>
 
For example, the matrix
Line 153:
 
===Compressed sparse column (CSC or CCS)===
[http://netlib.org/linalg/html_templates/node92.html#SECTION00931200000000000000 CSC] is similar to CSR except that values are read first by column, a row index is stored for each value, and column pointers are stored. For example, CSC is {{math|(val, row_ind, col_ptr)}}, where {{math|val}} is an array of the (top-to-bottom, then left-to-right) non-zero values of the matrix; {{math|row_ind}} is the row indices corresponding to the values; and, {{math|col_ptr}} is the list of {{math|val}} indexes where each column starts. The name is based on the fact that column index information is compressed relative to the COO format. One typically uses another format (LIL, DOK, COO) for construction. This format is efficient for arithmetic operations, column slicing, and matrix-vector products. See [http://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csc_matrix.html scipy.sparse.csc_matrix]. This is the traditional format for specifying a sparse matrix in MATLAB (via the [https://www.mathworks.com/help/matlab/ref/sparse.html <code>sparse</code>] function).
 
[http://netlib.org/linalg/html_templates/node92.html#SECTION00931200000000000000 CSC] is similar to CSR except that values are read first by column, a row index is stored for each value, and column pointers are stored. For example, CSC is {{math|(val, row_ind, col_ptr)}}, where {{math|val}} is an array of the (top-to-bottom, then left-to-right) non-zero values of the matrix; {{math|row_ind}} is the row indices corresponding to the values; and, {{math|col_ptr}} is the list of {{math|val}} indexes where each column starts. The name is based on the fact that column index information is compressed relative to the COO format. One typically uses another format (LIL, DOK, COO) for construction. This format is efficient for arithmetic operations, column slicing, and matrix-vector products. See [http://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csc_matrix.html scipy.sparse.csc_matrix]. This is the traditional format for specifying a sparse matrix in MATLAB (via the [https://www.mathworks.com/help/matlab/ref/sparse.html <code>sparse</code>] function).
 
==Software==