XLPack 7.0
XLPack Numerical Library (Excel VBA) Reference Manual
Loading...
Searching...
No Matches

◆ HBReadInfo()

Sub HBReadInfo ( Fname As  String,
Title As  String,
Key As  String,
Nrow As  Long,
Ncol As  Long,
Nnz As  Long,
Neltvl As  Long,
Nrhs As  Long,
Nrhsix As  Long,
DataType As  Long,
MatShape As  Long,
MatForm As  Long,
RhsForm As  Long,
IniVec As  Long,
SolVec As  Long,
Optional Info As  Long 
)

Read matrix information from Harwell-Boeing file

Purpose
This function reads format and size of matrix from the Harwell-Boeing file.
Parameters
[in]FnameInput file name.
[out]TitleTitle string.
[out]KeyKey string.
[out]NrowNumber of rows of the matrix (if sparse matrix).
Number of variables (Nu) (if finite-element matrix).
[out]NcolNumber of columns of the matrix (if sparse matrix).
Number of elemental matrices (if finite-element matrix).
[out]NnzNumber of non-zero elements (if sparse matrix).
Number of variable indices (Nind) (if finite-element matrix).
[out]NeltvlNot used (if sparse matrix).
Number of elements (if finite-element matrix).
[out]NrhsNumber of columns of RHS matrix.
[out]NrhsixNumber of row indices of RHS matrix. (If RhsForm = 1, MatForm = 0 (sparse matrix))
[out]DataTypeData type of the matrix.
= 0: Real.
= 1: Complex.
= 2: Pattern.
[out]MatShapeMatrix shape.
= 0: Unsymmetric.
= 1: Symmetric.
= 2: Skew-symmetric.
= 3: Hermitian.
= 4: Rectangular.
[out]MatFormStorage format of the matrix.
= 0: Sparse matrix.
= 1: Finite element matrix.
[out]RhsFormStorage format of the RHS matrix.
= 0: Dense matrix.
= 1: Same format with coefficient matrix.
[out]IniVecWhether initial guess vector is stored.
= 0: Not stored.
= 1: Stored.
[out]SolVecWhether exact solution vector is stored.
= 0: Not stored.
= 1: Stored.
[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.
Example Program
Reads the matrix information of the following file (Test_HBWrite.rua) in Harwell-Boeing format.
Test HBWrite Key
7 1 2 3 1
RUA 3 3 9 0
(8I10) (8I10) (3D23.15) (3D23.15)
F 1 0
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
-3.727000000000000e-01 4.319000000000000e-01 -1.424700000000000e+00
Sub HBWrite(Fname As String, ByVal Title As String, Key As String, Nrow As Long, Ncol As Long, Nnz As Long, Neltvl As Long, Val() As Double, Ptr() As Long, Ind() As Long, Nrhs As Long, Nrhsix As Long, Rhsval() As Double, Rhsptr() As Long, Rhsind() As Long, Sguess() As Double, Xexact() As Double, DataType As Long, MatShape As Long, MatForm As Long, RhsForm As Long, IniVec As Long, SolVec As Long, Optional Info As Long, Optional Fchk As Long=0, Optional Base As Long=-1, Optional Format As Long=0, Optional IntN As Long=8, Optional IntW As Long=10, Optional DblN As Long=3, Optional DblW As Long=23, Optional DblD As Long=15)
Write a matrix to the file in Harwell-Boeing format
Sub Ex_HBReadInfo()
Dim Title As String, Key As String
Dim M As Long, N As Long, Nnz As Long, Neltvl As Long, Nrhs As Long, Nrhsix As Long
Dim DataType As Long, MatShape As Long, MatForm As Long, RhsForm As Long, IniVec As Long, SolVec As Long
Dim Info As Long
Call HBReadInfo("Test_HBWrite.rua", Title, Key, M, N, Nnz, Neltvl, Nrhs, Nrhsix, DataType, MatShape, MatForm, RhsForm, IniVec, SolVec, Info)
Debug.Print "HBReadInfo: Info =" + Str(Info)
Debug.Print "Title = """ + Title + """, Key = """ + Key + """, M =" + Str(M) + ", N =" + Str(N) + ", Nnz =" + Str(Nnz) + ", Neltvl =" + Str(Neltvl) + ", Nrhs =" + Str(Nrhs) + ", Nrhsix =" + Str(Nrhsix)
Debug.Print "DataType =" + Str(DataType) + ", MatShape =" + Str(MatShape) + ", MatForm =" + Str(MatForm) + ", RhsForm = " + Str(RhsForm) + ", IniVec =" + Str(IniVec) + ", SolVec = " + Str(SolVec); ""
End Sub
Sub HBReadInfo(Fname As String, Title As String, Key As String, Nrow As Long, Ncol As Long, Nnz As Long, Neltvl As Long, Nrhs As Long, Nrhsix As Long, DataType As Long, MatShape As Long, MatForm As Long, RhsForm As Long, IniVec As Long, SolVec As Long, Optional Info As Long)
Read matrix information from Harwell-Boeing file
Example Results
HBReadInfo: Info = 0
Title = "Test HBWrite", Key = "Key", M = 3, N = 3, Nnz = 9, Neltvl = 0, Nrhs = 1, Nrhsix = 0
DataType = 0, MatShape = 0, MatForm = 0, RhsForm = 0, IniVec = 0, SolVec = 0