|
|
◆ HBReadInfo1()
| Sub HBReadInfo1 |
( |
Fname As |
String, |
|
|
Title As |
String, |
|
|
Key As |
String, |
|
|
Nrow As |
Long, |
|
|
Ncol As |
Long, |
|
|
Nnz As |
Long, |
|
|
DataType As |
Long, |
|
|
MatShape As |
Long, |
|
|
MatForm As |
Long, |
|
|
Optional Info As |
Long, |
|
|
Optional Nrhs As |
Long |
|
) |
| |
Read matrix information from Harwell-Boeing file (Simple driver)
- Purpose
- This function reads format and size of sparse matrix from the Harwell-Boeing file.
The information on RHS (including initial guess and exact solution) is not returned. Nrhs, however, is returned through optional parameter.
- Parameters
-
| [in] | Fname | Input file name. |
| [out] | Title | Title string. |
| [out] | Key | Key string. |
| [out] | Nrow | Number of rows of the matrix. |
| [out] | Ncol | Number of columns of the matrix. |
| [out] | Nnz | Number of non-zero elements. |
| [out] | DataType | Data type of the matrix.
= 0: Real.
= 1: Complex.
= 2: Pattern. |
| [out] | MatShape | Matrix shape.
= 0: Unsymmetric.
= 1: Symmetric.
= 2: Skew-symmetric.
= 3: Hermitian.
= 4: Rectangular. |
| [out] | MatForm | Storage format of the matrix.
= 0: Sparse matrix. |
| [out] | Info | (Optional)
= 0: Successful exit.
= i < 0: The (-i)-th argument is invalid.
= 1: Could not open file.
= 3: File read error.
= 4: Invalid read format. |
| [out] | Nrhs | (Optional)
Number of columns of RHS matrix. |
- Example Program
- Reads the matrix information of the following file (Test_HBWrite1.rua) in Harwell-Boeing format.
6 1 2 3 0
RUA 3 3 9 0
(8I10) (8I10) (3D23.15) (3D23.15)
1 4 7 10
1 2 3 1 2 3 1 2
3
2.000000000000000e-01 -3.200000000000000e-01 -8.000000000000000e-01
-1.100000000000000e-01 8.100000000000001e-01 -9.200000000000000e-01
-9.300000000000000e-01 3.700000000000000e-01 -2.900000000000000e-01
Sub HBWrite1(Fname As String, ByVal Title As String, Key As String, Nrow As Long, Ncol As Long, Nnz As Long, Val() As Double, Ptr() As Long, Ind() As Long, DataType As Long, MatShape As Long, MatForm As Long, Optional Info As Long, Optional Fchk As Long=0, Optional Base As Long=-1, Optional Format As Long=0) Write a matrix to the Harwell-Boeing file (Simple driver)
Sub Ex_HBReadInfo1()
Dim Title As String, Key As String
Dim M As Long, N As Long, Nnz As Long, DataType As Long, MatShape As Long, MatForm As Long
Dim Info As Long
Call HBReadInfo1("Test_HBWrite1.rua", Title, Key, M, N, Nnz, DataType, MatShape, MatForm, Info)
Debug.Print "Title = """ + Title + """, Key = """ + Key + """, M =" + Str(M) + ", N =" + Str(N) + ", Nnz =" + Str(Nnz)
Debug.Print "DataType =" + Str(DataType) + ", MatShape =" + Str(MatShape) + ", MatForm =" + Str(MatForm)
End Sub
Sub HBReadInfo1(Fname As String, Title As String, Key As String, Nrow As Long, Ncol As Long, Nnz As Long, DataType As Long, MatShape As Long, MatForm As Long, Optional Info As Long, Optional Nrhs As Long) Read matrix information from Harwell-Boeing file (Simple driver)
- Example Results
Title = "Test HBWrite1", Key = "Key", M = 3, N = 3, Nnz = 9
DataType = 0, MatShape = 0, MatForm = 0
|