|
|
◆ MMReadInfo()
| Sub MMReadInfo |
( |
Fname As |
String, |
|
|
Nrow As |
Long, |
|
|
Ncol As |
Long, |
|
|
Nnz As |
Long, |
|
|
DataType As |
Long, |
|
|
MatShape As |
Long, |
|
|
MatForm As |
Long, |
|
|
Optional Info As |
Long |
|
) |
| |
Read matrix information from Matrix Market file
- Purpose
- This routine reads format and size of matrix from the Matrix Market file.
- Parameters
-
| [in] | Fname | Input file name. |
| [out] | Nrow | Number of rows of the matrix. |
| [out] | Ncol | Number of columns of the matrix. |
| [out] | Nnz | Number of nonzero elements of the matrix. |
| [out] | DataType | Data type of the matrix.
= 0: Real.
= 1: Complex
= 2: Pattern.
= 3: Integer. |
| [out] | MatShape | Matrix shape.
= 0: General.
= 1: Symmetric.
= 2: Skew-symmetric.
= 3: Hermitian. |
| [out] | MatForm | Storage format of the matrix.
= 0: Sparse.
= 1: Dense. |
| [out] | Info | (Optional)
= 0: Successful exit.
= i < 0: The (-i)-th argument is invalid.
= 1: Failed to open file.
= 3: File read error.
= 4: Invalid type. |
- Example Program
- Reads the matrix information of the following file (Test_MMWrite.mtx) in Matrix Market format.
%%MatrixMarket matrix coordinate real general
3 3 9
1 1 2.000000000000000e-01
1 2 -1.100000000000000e-01
1 3 -9.300000000000000e-01
2 1 -3.200000000000000e-01
2 2 8.100000000000001e-01
2 3 3.700000000000000e-01
3 1 -8.000000000000000e-01
3 2 -9.200000000000000e-01
3 3 -2.900000000000000e-01
Sub Ex_MMReadInfo()
Dim M As Long, N As Long, Nnz As Long, DataType As Long, MatShape As Long, MatForm As Long
Dim Info As Long
Call MMReadInfo("Test_MMWrite.mtx", M, N, Nnz, DataType, MatShape, MatForm, Info)
Debug.Print "M =" + Str(M) + ", N =" + Str(N) + ", Nnz =" + Str(Nnz)
Debug.Print "DataType =" + Str(DataType) + ", MatShape =" + Str(MatShape) + ", MatForm =" + Str(MatForm)
End Sub
Sub MMReadInfo(Fname As String, Nrow As Long, Ncol As Long, Nnz As Long, DataType As Long, MatShape As Long, MatForm As Long, Optional Info As Long) Read matrix information from Matrix Market file
- Example Results
M = 3, N = 3, Nnz = 9
DataType = 0, MatShape = 0, MatForm = 0
|