'Primary Row Transformation: interchange two rows
Public Sub Matrix_Specify_Tow_Row_Exchange (Row_A_Index As Integer, Row_ B _Index As Integer, temp_matrix () As Single)
Dim I As Integer
For I = 1 To UBound (temp_matrix, 2)
Swap temp_matrix (Row_A_Index, I), temp_matrix (Row_ B _Index, I)
Next I
End Sub
'One of the primary row transformations is multiplied by one number and then added to another row.
Public Sub Matrix_Single_Row_ShuChen_Addition_To_Other_Row (temp_matrix () As Single, Row_A_Index As Integer, Row_ B _Index As Integer, k As Single)
Dim I As Integer
For I = 1 To UBound (temp_matrix, 2)
Temp_matrix (Row_ B _Index, I) = temp_matrix (Row_ B _Index, I) + k * temp_matrix (Row_A_Index, I)
Next I
End Sub
'All multiplication of a Certain Row of elementary row is one number.
Public Sub Matrix_Single_Row_ShuChen (k As Single, temp_a () As Single, Row_Index As Integer)
Dim I As Integer
For I = 1 To UBound (temp_a, 2)
Temp_a (Row_Index, I) = k * temp_a (Row_Index, I)
Next I
End Sub
'The simplest row is the calculation of a tiered array.
Option Explicit
Public Function Matrix_Basic_Row_Transformation (temp_matrix () As Single)
Dim Row_Index As Integer, col_index As Integer, Row_Num As Integer, Col_Num As Integer
Dim I As Integer, j As Integer, Not_Zero_Row_Index As Integer
Dim temp_chen As Single
Dim flag As Boolean
Row_Num = UBound (temp_matrix, 1)
Col_Num = UBound (temp_matrix, 2)
Row_Index = 1: col_index = 1
Do While (Row_Index <= Row_Num And col_index <= Col_Num)
'Do While (col_index <= Col_Num)
Flag = If_Specify_Col_Zero (temp_matrix, col_index, Row_Index, Not_Zero_Row_Index)
If (flag = False) Then
'Formtest. Print "did it! "
'If col_index = 2 And Row_Index = 2 Then output_matrix temp_matrix
If (Not_Zero_Row_Index <> Row_Index) Then
Matrix_Specify_Tow_Row_Exchange Row_Index, Not_Zero_Row_Index, temp_matrix
End If
'Formtest. List1.AddItem Row_Index
'Formtest. List2.AddItem col_index
For I = 1 To Row_Num
If (I <> Row_Index) Then
Matrix_Single_Row_ShuChen_Addition_To_Other_Row temp_matrix, Row_Index, I,-temp_matrix (I, col_index)/temp_matrix (Row_Index, col_index)
End If
'If Row_Index = 2 Then FormTest. List1.AddItem temp_matrix (I, Col_Num)
Next I
Matrix_Single_Row_ShuChen 1/temp_matrix (Row_Index, col_index), temp_matrix, Row_Index
Row_Index = Row_Index + 1
Col_index = col_index + 1
Else
'Formtest. Print col_index, Row_Index
Col_index = col_index + 1
End If
Loop
End Function