我要评分
获取效率
正确性
完整性
易理解

Data Storage

Full-Storage Format for Vectors

All elements in a vector are stored.

Sparse Matrix Storage Format

The compressed sparse row (CSR) format is specified by the following arrays: value, column, and pointerB. For the LLT or LLH factorization method in cluster mode, only the upper or lower triangular part of a matrix is stored.

See Table 1 for details.

Table 1 Storage arrays of sparse matrix A in CSR format

Array

Description

value

  • Non-zero elements in matrix A, stored in row-major order
  • The array length is equal to the number of non-zero elements in matrix A.

column

  • Number of the column in matrix A that contains the i-th value in the value array
  • The array length is equal to the number of non-zero elements in matrix A.

pointerB

  • For zero-based indexing, pointerB(j) indicates the index of the element in the value array that is the first non-zero element in the j-th row of matrix A.
  • Array length = Number of rows of matrix A + 1

Matrix A can be represented in CSR format as in Table 2.

When the LLT or LLH factorization method in cluster mode is used, only the upper triangular matrix needs to be stored. See Table 3.

Table 2 Matrix A in CSR format

Matrix

Indexing Method

CSR Format

Zero-based indexing

value = [2, -3, 7, -3, 1, -6, 1, -4, 5, 7, -6, 5]

column = [0, 1, 3, 0, 2, 3, 1, 2, 3, 0, 1, 2]

pointerB = [0, 3, 6, 9, 12]

Table 3 Upper triangular part of symmetric matrix A in CSR format

Matrix

Indexing Method

CSR Format

Zero-based indexing

value = [2, -3, 7, 1, -6, -4, 5]

column = [0, 1, 3, 2, 3, 2, 3]

pointerB = [0, 3, 5, 7, 7]