英文资料来自http://netlib2.cs.utk.edu/linalg/html_templates/node91.html#sparseA
http://netlib2.cs.utk.edu/linalg/html_templates/node92.html
Analogous to Compressed Row Storage there is Compressed Column Storage (CCS), which is also called the Harwell-Boeing sparse matrix format [78]. The CCS format is identical to the CRS format except that the columns of are stored (traversed) instead of the rows. In other words, the CCS format is the CRS format for .
The CCS format is specified by the arrays {val, row_ind, col_ptr}, where row_ind stores the row indices of each nonzero, and col_ptr stores the index of the elements in valwhich start a column of . The CCS format for the matrix in () is given by
.
The Compressed Row and Column (in the next section) Storage formats are the most general: they make absolutely no assumptions about the sparsity structure of the matrix, and they don't store any unnecessary elements. On the other hand, they are not very efficient, needing an indirect addressing step for every single scalar operation in a matrix-vector product or preconditioner solve.
The Compressed Row Storage (CRS) format puts the subsequent nonzeros of the matrix rows in contiguous memory locations. Assuming we have a nonsymmetric sparse matrix , we create vectors: one for floating-point numbers (val), and the other two for integers (col_ind, row_ptr). The val vector stores the values of the nonzero elements of the matrix , as they are traversed in a row-wise fashion. The col_ind vector stores the column indexes of the elements in the val vector. That is, if then . The row_ptr vector stores the locations in the val vector that start a row, that is, if then . By convention, we define , where is the number of nonzeros in the matrix . The storage savings for this approach is significant. Instead of storing elements, we need only storage locations.
As an example, consider the nonsymmetric matrix defined by
The CRS format for this matrix is then specified by the arrays {val, col_ind, row_ptr} given below
.
If the matrix is symmetric, we need only store the upper (or lower) triangular portion of the matrix. The trade-off is a more complicated algorithm with a somewhat different pattern of data access.
具体的翻译不做了。写一下自己的理解。
以CRS为模板,CCS即为CRS的转置矩阵。
有三个向量,分别为val用于存储矩阵中的值。 col_ind用于存储行坐标,row_ptr这个一时想不到怎么概括。下面简介:
设val[1] = a11这里即为矩阵中的存储方式a11。
所以col[1] = 1,即上面公式val(k) = aij 中的i。
row_ptr[1]=1 <= k=1 < row_ptr[1+1]=3,
val[2] = a15
所以col[2] = 5
因为还是第一行中的数,所以 row_ptr[1]=1 <= k=2 < row_ptr[1+1]=3依旧成立。
val[3] = a21
col[3] = 1
row_ptr[2]=3 <= 3 <row[2+1]=6成立。即为第二行中的数。
由观察得,row[i+1]-row[i]即为该行中的元素数。再由col向量即可生成该系数矩阵。
CCS为CRS的转置,思路类似。。
CCS用于TAUCS中sparse matrix的存储。