这是我第一次处理列压缩存储 (CCS) 格式来存储矩阵。谷歌搜索了一下,如果我是对的,在一个有 n 个非零元素的矩阵中,CCS 如下:
-we define a vector A_v of dimensions n x 1 storing the n non-zero elements
of the matrix
- we define a second vector A_ir of dimensions n x 1 storing the rows of the
non-zero elements of the matrix
-we finally define a third vector A_jc whose elements are the indices of the
elements of A_v which corresponds to the beginning of new column, plus a
final value which is by convention equal t0 n+1, and identifies the end of
the matrix (pointing theoretically to a virtual extra-column).
例如,如果
M = [1 0 4 0 0;
0 3 5 2 0;
2 0 0 4 6;
0 0 7 0 8]
我们得到
A_v = [1 2 3 4 5 7 2 4 6 8];
A_ir = [1 3 2 1 2 4 2 3 3 4];
A_jc = [1 3 4 7 9 11];
我的问题是
我)是我写的正确,还是我误解了什么?
II)如果我想用一些为零的列来表示一个矩阵,例如,
M2 = [0 1 0 0 4 0 0;
0 0 3 0 5 2 0;
0 2 0 0 0 4 6;
0 0 0 0 7 0 8]
CCS 中 M2 的表示不与 M 的表示相同吗?
谢谢您的帮助!