Rate This Document
Findability
Accuracy
Completeness
Readability

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. Table 1 describes the three arrays in sparse matrix A in CSR format.

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]

CSC (Compressed Sparse Column) format, which contains three elements: value, row, and pointerB (column index). The format is similar to the CSR format and is not described here.

COO (Coordinate) format, which contains three elements: value, row, and column. Table 4 describes the three arrays in sparse matrix A in COO format.

Table 4 Storage arrays of sparse matrix A in COO format

Parameter

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.

row

  • Number of the row 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.

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.

Matrix A can be represented in COO format as in Table 5.

Table 5 Matrix A in COO format

Matrix

COO Format

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

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

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

Storage Formats of Dense Matrices

Dense formats are classified into row-major and column-major layouts, which consist of the data values and the leading dimension (ld). If dense matrix A is row-major, ld represents the array length required to store each row; if it is column-major, ld represents the array length required to store each column. Table 6 describes the parameters of dense matrix A.

Table 6 Dense matrix A

Parameter

Description

value

  • All elements in matrix A, stored in row-major order (column-major)
  • The array length is equal to the number of rows (columns) multiplied by ld.

ld

An integer representing the stride between elements of two rows (columns), which is greater than or equal to the number of elements in a row (column).

Assume that matrix A is . Table 7 shows the dense storage formats of matrix A.

Table 7 Matrix A in dense format

Matrix

Dense Format (Row-Major)

Dense Format (Column-Major)

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

ld = 4

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

ld = 4