|
|
◆ mm_read1()
| def mm_read1 |
( |
fname |
, |
|
|
val |
, |
|
|
rowptr |
, |
|
|
colind |
, |
|
|
base |
= 0, |
|
|
sort |
= 0 |
|
) |
| |
Read a matrix from the Matrix Market file
- Purpose
- This function reads real sparse matrix from the Matrix Market file, and stores in CSR format.
- Returns
- (info, nrow, ncol)
info (int):
= 0: Successful exit.
= i < 0: The (-i)-th argument is invalid.
= 1: Failed to open file.
= 3: File read error.
= 4: Invalid type.
= 5: Not real sparse matrix file.
nrow (int):
Number of rows of the matrix.
ncol (int):
Number of columns of the matrix.
- Parameters
-
| [in] | fname | Input file name. |
| [out] | val | Numpy ndarray (1-dimensional, float, nnz)
Values of nonzero elements of sparse matrix (where nnz is the number of nonzero elements). |
| [out] | rowptr | Numpy ndarray (1-dimensional, int32, nrow + 1)
Row pointers of sparse matrix. |
| [out] | colind | Numpy ndarray (1-dimensional, int32, nnz)
Column indices of sparse matrix (where nnz is the number of nonzero elements). |
| [in] | base | (Optional)
Indexing of rowptr and colind. (default = 0)
= 0: Zero-based (C style) indexing: Starting index is 0.
= 1: One-based (Fortran style) indexing: Starting index is 1. |
| [in] | sort | (Optional)
Specify whether to sort elements of sparse matrix in ascending order of column number within each row. (default = 0)
= 0: Do not sort elements.
= 1: Sort elements. |
|