PREVIEW :
CLASS :
Option Strict Off
Option Explicit On
Imports System.Math
Public Class MatLib
Private Shared Sub Find_R_C(ByVal Mat(,) As Double, ByRef Row As Integer, ByRef Col As Integer)
Row = Mat.GetUpperBound(0)
Col = Mat.GetUpperBound(1)
End Sub
#Region "Add Matrices"
Public Shared Function Add(ByVal Mat1(,) As Double, ByVal Mat2(,) As Double) As Double(,)
Dim sol(,) As Double
Dim i, j As Integer
Dim Rows1, Cols1 As Integer
Dim Rows2, Cols2 As Integer
On Error GoTo Error_Handler
Find_R_C(Mat1, Rows1, Cols1)
Find_R_C(Mat2, Rows2, Cols2)
If Rows1 <> Rows2 Or Cols1 <> Cols2 Then
GoTo Error_Dimension
End If
ReDim sol(Rows1, Cols1)
For i = 0 To Rows1
For j = 0 To Cols1
sol(i, j) = Mat1(i, j) + Mat2(i, j)
Next j
Next i
Return sol
Error_Dimension:
Err.Raise("5005", , "Dimensions of the two matrices do not match !")
Error_Handler:
If Err.Number = 5005 Then
Err.Raise("5005", , "Dimensions of the two matrices do not match !")
Else
Err.Raise("5022", , "One or both of the matrices are null, this operation cannot be done !!")
End If
End Function
#End Region
#Region "Subtract Matrices"
Public Shared Function Subtract(ByVal Mat1(,) As Double, ByVal Mat2(,) As Double) As Double(,)
Dim i, j As Integer
Dim sol(,) As Double
Dim Rows1, Cols1 As Integer
Dim Rows2, Cols2 As Integer
On Error GoTo Error_Handler
Find_R_C(Mat1, Rows1, Cols1)
Find_R_C(Mat2, Rows2, Cols2)
If Rows1 <> Rows2 Or Cols1 <> Cols2 Then
GoTo Error_Dimension
End If
ReDim sol(Rows1, Cols1)
For i = 0 To Rows1
For j = 0 To Cols1
sol(i, j) = Mat1(i, j) - Mat2(i, j)
Next j
Next i
Return sol
Error_Dimension:
Err.Raise("5007", , "Dimensions of the two matrices do not match !")
Error_Handler:
If Err.Number = 5007 Then
Err.Raise("5007", , "Dimensions of the two matrices do not match !")
Else
Err.Raise("5022", , "One or both of the matrices are null, this operation cannot be done !!")
End If
End Function
#End Region
#Region "Multiply Matrices"
Public Shared Function Multiply(ByVal Mat1(,) As Double, ByVal Mat2(,) As Double) As Double(,)
Dim l, i, j As Integer
Dim OptiString As String
Dim sol(,) As Double, MulAdd As Double
Dim Rows1, Cols1 As Integer
Dim Rows2, Cols2 As Integer
On Error GoTo Error_Handler
MulAdd = 0
Find_R_C(Mat1, Rows1, Cols1)
Find_R_C(Mat2, Rows2, Cols2)
If Cols1 <> Rows2 Then
GoTo Error_Dimension
End If
ReDim sol(Rows1, Cols2)
For i = 0 To Rows1
For j = 0 To Cols2
For l = 0 To Cols1
MulAdd = MulAdd + Mat1(i, l) * Mat2(l, j)
Next l
sol(i, j) = MulAdd
MulAdd = 0
Next j
Next i
Return sol
Error_Dimension:
Err.Raise("5009", , "Dimensions of the two matrices not suitable for multiplication !")
Error_Handler:
If Err.Number = 5009 Then
Err.Raise("5009", , "Dimensions of the two matrices not suitable for multiplication !")
Else
Err.Raise("5022", , "One or both of the matrices are null, this operation cannot be done !!")
End If
End Function
#End Region
#Region "Determinant of a Matrix"
Public Shared Function Det(ByVal Mat(,) As Double) As Double
Dim DArray(,) As Double, S As Integer
Dim k, k1, i, j As Integer
Dim save, ArrayK As Double
Dim M1 As String
Dim Rows, Cols As Integer
On Error GoTo Error_Handler
Find_R_C(Mat, Rows, Cols)
If Rows <> Cols Then GoTo Error_Dimension
S = Rows
Det = 1
DArray = Mat.Clone()
For k = 0 To S
If DArray(k, k) = 0 Then
j = k
Do While ((j < S) And (DArray(k, j) = 0))
j = j + 1
Loop
If DArray(k, j) = 0 Then
Det = 0
Exit Function
Else
For i = k To S
save = DArray(i, j)
DArray(i, j) = DArray(i, k)
DArray(i, k) = save
Next i
End If
Det = -Det
End If
ArrayK = DArray(k, k)
Det = Det * ArrayK
If k < S Then
k1 = k + 1
For i = k1 To S
For j = k1 To S
DArray(i, j) = DArray(i, j) - DArray(i, k) * (DArray(k, j) / ArrayK)
Next j
Next i
End If
Next
Exit Function
Error_Dimension:
Err.Raise("5011", , "Matrix should be a square matrix !")
Error_Handler:
If Err.Number = 5011 Then
Err.Raise("5011", , "Matrix should be a square matrix !")
Else
Err.Raise("5022", , "In order to do this operation values must be assigned to the matrix !!")
End If
End Function
#End Region
#Region "Inverse of a Matrix"
Public Shared Function Inv(ByVal Mat(,) As Double) As Double(,)
Dim AI(,) As Double, AIN As Double, AF As Double, _
Mat1(,) As Double
Dim LL As Integer, LLM As Integer, L1 As Integer, _
L2 As Integer, LC As Integer, LCA As Integer, _
LCB As Integer, i As Integer, j As Integer
Dim Rows, Cols As Integer
On Error GoTo Error_Handler
Find_R_C(Mat, Rows, Cols)
If Rows <> Cols Then GoTo Error_Dimension
If Det(Mat) = 0 Then GoTo Error_Zero
LL = Rows
LLM = Cols
Mat1 = Mat.Clone()
ReDim AI(LL, LL)
For L2 = 0 To LL
For L1 = 0 To LL
AI(L1, L2) = 0
Next
AI(L2, L2) = 1
Next
For LC = 0 To LL
If Abs(Mat1(LC, LC)) < 0.0000000001 Then
For LCA = LC + 1 To LL
If LCA = LC Then GoTo 1090
If Abs(Mat1(LC, LCA)) > 0.0000000001 Then
For LCB = 0 To LL
Mat1(LCB, LC) = Mat1(LCB, LC) + Mat1(LCB, LCA)
AI(LCB, LC) = AI(LCB, LC) + AI(LCB, LCA)
Next
GoTo 1100
End If
1090: Next
End If
1100:
AIN = 1 / Mat1(LC, LC)
For LCA = 0 To LL
Mat1(LCA, LC) = AIN * Mat1(LCA, LC)
AI(LCA, LC) = AIN * AI(LCA, LC)
Next
For LCA = 0 To LL
If LCA = LC Then GoTo 1150
AF = Mat1(LC, LCA)
For LCB = 0 To LL
Mat1(LCB, LCA) = Mat1(LCB, LCA) - AF * Mat1(LCB, LC)
AI(LCB, LCA) = AI(LCB, LCA) - AF * AI(LCB, LC)
Next
1150: Next
Next
Return AI
Error_Zero:
Err.Raise("5012", , "Determinent equals zero, inverse can't be found !")
Error_Dimension:
Err.Raise("5014", , "Matrix should be a square matrix !")
Error_Handler:
If Err.Number = 5012 Then
Err.Raise("5012", , "Determinent equals zero, inverse can't be found !")
ElseIf Err.Number = 5014 Then
Err.Raise("5014", , "Matrix should be a square matrix !")
End If
End Function
#End Region
#Region "Multiply Vectors"
Public Shared Function MultiplyVectors(ByVal Mat1(,) As Double, ByVal Mat2(,) As Double) As Double(,)
Dim i, j, k As Double
Dim sol(2, 0) As Double
Dim Rows1, Cols1 As Integer
Dim Rows2, Cols2 As Integer
On Error GoTo Error_Handler
Find_R_C(Mat1, Rows1, Cols1)
Find_R_C(Mat2, Rows2, Cols2)
If Rows1 <> 2 Or Cols1 <> 0 Then
GoTo Error_Dimension
End If
If Rows2 <> 2 Or Cols2 <> 0 Then
GoTo Error_Dimension
End If
i = Mat1(1, 0) * Mat2(2, 0) - Mat1(2, 0) * Mat2(1, 0)
j = Mat1(2, 0) * Mat2(0, 0) - Mat1(0, 0) * Mat2(2, 0)
k = Mat1(0, 0) * Mat2(1, 0) - Mat1(1, 0) * Mat2(0, 0)
sol(0, 0) = i : sol(1, 0) = j : sol(2, 0) = k
Return sol
Error_Dimension:
Err.Raise("5016", , "Dimension should be (2 x 0) for both matrices in order to do cross multiplication !")
Error_Handler:
If Err.Number = 5016 Then
Err.Raise("5016", , "Dimension should be (2 x 0) for both matrices in order to do cross multiplication !")
Else
Err.Raise("5022", , "One or both of the matrices are null, this operation cannot be done !!")
End If
End Function
#End Region
#Region "Magnitude of a Vector"
Public Shared Function VectorMagnitude(ByVal Mat(,) As Double) As Double
Dim Rows, Cols As Integer
On Error GoTo Error_Handler
Find_R_C(Mat, Rows, Cols)
If Rows <> 2 Or Cols <> 0 Then
GoTo Error_Dimension
End If
Return Sqrt(Mat(0, 0) * Mat(0, 0) + Mat(1, 0) * Mat(1, 0) + Mat(2, 0) * Mat(2, 0))
Error_Dimension:
Err.Raise("5018", , "Dimension of the matrix should be (2 x 0) in order to find the vector's norm !")
Error_Handler:
If Err.Number = 5018 Then
Err.Raise("5018", , "Dimension of the matrix should be (2 x 0) in order to find the vector's magnitude !")
Else
Err.Raise("5022", , "In order to do this operation values must be assigned to the matrix !!")
End If
End Function
#End Region
#Region "Transpose of a Matrix"
Public Shared Function Transpose(ByVal Mat(,) As Double) As Double(,)
Dim Tr_Mat(,) As Double
Dim i, j, Rows, Cols As Integer
On Error GoTo Error_Handler
Find_R_C(Mat, Rows, Cols)
ReDim Tr_Mat(Cols, Rows)
For i = 0 To Cols
For j = 0 To Rows
Tr_Mat(j, i) = Mat(i, j)
Next j
Next i
Return Tr_Mat
Error_Handler:
Err.Raise("5028", , "In order to do this operation values must be assigned to the matrix !!")
End Function
#End Region
#Region "Multiply a matrix or a vector with a scalar quantity"
Public Shared Function ScalarMultiply(ByVal Value As Double, ByVal Mat(,) As Double) As Double(,)
Dim i, j, Rows, Cols As Integer
Dim sol(,) As Double
On Error GoTo Error_Handler
Find_R_C(Mat, Rows, Cols)
ReDim sol(Rows, Cols)
For i = 0 To Rows
For j = 0 To Cols
sol(i, j) = Mat(i, j) * Value
Next j
Next i
Return (sol)
Error_Handler:
Err.Raise("5022", , "Matrix was not assigned")
End Function
#End Region
#Region "Divide a matrix or a vector with a scalar quantity"
Public Shared Function ScalarDivide(ByVal Value As Double, ByVal Mat(,) As Double) As Double(,)
Dim i, j, Rows, Cols As Integer
Dim sol(,) As Double
On Error GoTo Error_Handler
Find_R_C(Mat, Rows, Cols)
ReDim sol(Rows, Cols)
For i = 0 To Rows
For j = 0 To Cols
sol(i, j) = Mat(i, j) / Value
Next j
Next i
Return sol
Exit Function
Error_Handler:
Err.Raise("5022", , "Matrix was not assigned")
End Function
#End Region
#Region "Print Matrix"
Public Shared Function PrintMat(ByVal Mat(,) As Double) As String
Dim N_Rows As Integer, N_Columns, k As Integer, _
i As Integer, j As Integer, m As Integer
Dim StrElem As String, StrLen As Long, _
Greatest() As Integer, LarString As String
Dim OptiString As String, sol As String
Find_R_C(Mat, N_Rows, N_Columns)
sol = ""
OptiString = ""
ReDim Greatest(N_Columns)
For i = 0 To N_Rows
For j = 0 To N_Columns
If i = 0 Then
Greatest(j) = 0
For m = 0 To N_Rows
StrElem = Format$(Mat(m, j), "0.0000")
StrLen = Len(StrElem)
If Greatest(j) < StrLen Then
Greatest(j) = StrLen
LarString = StrElem
End If
Next m
If Mid$(LarString, 1, 1) = "-" Then Greatest(j) = Greatest(j) + 1
End If
StrElem = Format$(Mat(i, j), "0.0000")
If Mid$(StrElem, 1, 1) = "-" Then
StrLen = Len(StrElem)
If Greatest(j) >= StrLen Then
For k = 1 To (Greatest(j) - StrLen)
OptiString = OptiString & " "
Next k
OptiString = OptiString & " "
End If
Else
StrLen = Len(StrElem)
If Greatest(j) > StrLen Then
For k = 1 To (Greatest(j) - StrLen)
OptiString = OptiString & " "
Next k
End If
End If
OptiString = OptiString & " " & Format$(Mat(i, j), "0.0000")
Next j
If i <> N_Rows Then
sol = sol & OptiString & vbCrLf
OptiString = ""
End If
sol = sol & OptiString
OptiString = ""
Next i
PrintMat = sol
Exit Function
End Function
#End Region
End Class
Option Explicit On
Imports System.Math
Public Class MatLib
Private Shared Sub Find_R_C(ByVal Mat(,) As Double, ByRef Row As Integer, ByRef Col As Integer)
Row = Mat.GetUpperBound(0)
Col = Mat.GetUpperBound(1)
End Sub
#Region "Add Matrices"
Public Shared Function Add(ByVal Mat1(,) As Double, ByVal Mat2(,) As Double) As Double(,)
Dim sol(,) As Double
Dim i, j As Integer
Dim Rows1, Cols1 As Integer
Dim Rows2, Cols2 As Integer
On Error GoTo Error_Handler
Find_R_C(Mat1, Rows1, Cols1)
Find_R_C(Mat2, Rows2, Cols2)
If Rows1 <> Rows2 Or Cols1 <> Cols2 Then
GoTo Error_Dimension
End If
ReDim sol(Rows1, Cols1)
For i = 0 To Rows1
For j = 0 To Cols1
sol(i, j) = Mat1(i, j) + Mat2(i, j)
Next j
Next i
Return sol
Error_Dimension:
Err.Raise("5005", , "Dimensions of the two matrices do not match !")
Error_Handler:
If Err.Number = 5005 Then
Err.Raise("5005", , "Dimensions of the two matrices do not match !")
Else
Err.Raise("5022", , "One or both of the matrices are null, this operation cannot be done !!")
End If
End Function
#End Region
#Region "Subtract Matrices"
Public Shared Function Subtract(ByVal Mat1(,) As Double, ByVal Mat2(,) As Double) As Double(,)
Dim i, j As Integer
Dim sol(,) As Double
Dim Rows1, Cols1 As Integer
Dim Rows2, Cols2 As Integer
On Error GoTo Error_Handler
Find_R_C(Mat1, Rows1, Cols1)
Find_R_C(Mat2, Rows2, Cols2)
If Rows1 <> Rows2 Or Cols1 <> Cols2 Then
GoTo Error_Dimension
End If
ReDim sol(Rows1, Cols1)
For i = 0 To Rows1
For j = 0 To Cols1
sol(i, j) = Mat1(i, j) - Mat2(i, j)
Next j
Next i
Return sol
Error_Dimension:
Err.Raise("5007", , "Dimensions of the two matrices do not match !")
Error_Handler:
If Err.Number = 5007 Then
Err.Raise("5007", , "Dimensions of the two matrices do not match !")
Else
Err.Raise("5022", , "One or both of the matrices are null, this operation cannot be done !!")
End If
End Function
#End Region
#Region "Multiply Matrices"
Public Shared Function Multiply(ByVal Mat1(,) As Double, ByVal Mat2(,) As Double) As Double(,)
Dim l, i, j As Integer
Dim OptiString As String
Dim sol(,) As Double, MulAdd As Double
Dim Rows1, Cols1 As Integer
Dim Rows2, Cols2 As Integer
On Error GoTo Error_Handler
MulAdd = 0
Find_R_C(Mat1, Rows1, Cols1)
Find_R_C(Mat2, Rows2, Cols2)
If Cols1 <> Rows2 Then
GoTo Error_Dimension
End If
ReDim sol(Rows1, Cols2)
For i = 0 To Rows1
For j = 0 To Cols2
For l = 0 To Cols1
MulAdd = MulAdd + Mat1(i, l) * Mat2(l, j)
Next l
sol(i, j) = MulAdd
MulAdd = 0
Next j
Next i
Return sol
Error_Dimension:
Err.Raise("5009", , "Dimensions of the two matrices not suitable for multiplication !")
Error_Handler:
If Err.Number = 5009 Then
Err.Raise("5009", , "Dimensions of the two matrices not suitable for multiplication !")
Else
Err.Raise("5022", , "One or both of the matrices are null, this operation cannot be done !!")
End If
End Function
#End Region
#Region "Determinant of a Matrix"
Public Shared Function Det(ByVal Mat(,) As Double) As Double
Dim DArray(,) As Double, S As Integer
Dim k, k1, i, j As Integer
Dim save, ArrayK As Double
Dim M1 As String
Dim Rows, Cols As Integer
On Error GoTo Error_Handler
Find_R_C(Mat, Rows, Cols)
If Rows <> Cols Then GoTo Error_Dimension
S = Rows
Det = 1
DArray = Mat.Clone()
For k = 0 To S
If DArray(k, k) = 0 Then
j = k
Do While ((j < S) And (DArray(k, j) = 0))
j = j + 1
Loop
If DArray(k, j) = 0 Then
Det = 0
Exit Function
Else
For i = k To S
save = DArray(i, j)
DArray(i, j) = DArray(i, k)
DArray(i, k) = save
Next i
End If
Det = -Det
End If
ArrayK = DArray(k, k)
Det = Det * ArrayK
If k < S Then
k1 = k + 1
For i = k1 To S
For j = k1 To S
DArray(i, j) = DArray(i, j) - DArray(i, k) * (DArray(k, j) / ArrayK)
Next j
Next i
End If
Next
Exit Function
Error_Dimension:
Err.Raise("5011", , "Matrix should be a square matrix !")
Error_Handler:
If Err.Number = 5011 Then
Err.Raise("5011", , "Matrix should be a square matrix !")
Else
Err.Raise("5022", , "In order to do this operation values must be assigned to the matrix !!")
End If
End Function
#End Region
#Region "Inverse of a Matrix"
Public Shared Function Inv(ByVal Mat(,) As Double) As Double(,)
Dim AI(,) As Double, AIN As Double, AF As Double, _
Mat1(,) As Double
Dim LL As Integer, LLM As Integer, L1 As Integer, _
L2 As Integer, LC As Integer, LCA As Integer, _
LCB As Integer, i As Integer, j As Integer
Dim Rows, Cols As Integer
On Error GoTo Error_Handler
Find_R_C(Mat, Rows, Cols)
If Rows <> Cols Then GoTo Error_Dimension
If Det(Mat) = 0 Then GoTo Error_Zero
LL = Rows
LLM = Cols
Mat1 = Mat.Clone()
ReDim AI(LL, LL)
For L2 = 0 To LL
For L1 = 0 To LL
AI(L1, L2) = 0
Next
AI(L2, L2) = 1
Next
For LC = 0 To LL
If Abs(Mat1(LC, LC)) < 0.0000000001 Then
For LCA = LC + 1 To LL
If LCA = LC Then GoTo 1090
If Abs(Mat1(LC, LCA)) > 0.0000000001 Then
For LCB = 0 To LL
Mat1(LCB, LC) = Mat1(LCB, LC) + Mat1(LCB, LCA)
AI(LCB, LC) = AI(LCB, LC) + AI(LCB, LCA)
Next
GoTo 1100
End If
1090: Next
End If
1100:
AIN = 1 / Mat1(LC, LC)
For LCA = 0 To LL
Mat1(LCA, LC) = AIN * Mat1(LCA, LC)
AI(LCA, LC) = AIN * AI(LCA, LC)
Next
For LCA = 0 To LL
If LCA = LC Then GoTo 1150
AF = Mat1(LC, LCA)
For LCB = 0 To LL
Mat1(LCB, LCA) = Mat1(LCB, LCA) - AF * Mat1(LCB, LC)
AI(LCB, LCA) = AI(LCB, LCA) - AF * AI(LCB, LC)
Next
1150: Next
Next
Return AI
Error_Zero:
Err.Raise("5012", , "Determinent equals zero, inverse can't be found !")
Error_Dimension:
Err.Raise("5014", , "Matrix should be a square matrix !")
Error_Handler:
If Err.Number = 5012 Then
Err.Raise("5012", , "Determinent equals zero, inverse can't be found !")
ElseIf Err.Number = 5014 Then
Err.Raise("5014", , "Matrix should be a square matrix !")
End If
End Function
#End Region
#Region "Multiply Vectors"
Public Shared Function MultiplyVectors(ByVal Mat1(,) As Double, ByVal Mat2(,) As Double) As Double(,)
Dim i, j, k As Double
Dim sol(2, 0) As Double
Dim Rows1, Cols1 As Integer
Dim Rows2, Cols2 As Integer
On Error GoTo Error_Handler
Find_R_C(Mat1, Rows1, Cols1)
Find_R_C(Mat2, Rows2, Cols2)
If Rows1 <> 2 Or Cols1 <> 0 Then
GoTo Error_Dimension
End If
If Rows2 <> 2 Or Cols2 <> 0 Then
GoTo Error_Dimension
End If
i = Mat1(1, 0) * Mat2(2, 0) - Mat1(2, 0) * Mat2(1, 0)
j = Mat1(2, 0) * Mat2(0, 0) - Mat1(0, 0) * Mat2(2, 0)
k = Mat1(0, 0) * Mat2(1, 0) - Mat1(1, 0) * Mat2(0, 0)
sol(0, 0) = i : sol(1, 0) = j : sol(2, 0) = k
Return sol
Error_Dimension:
Err.Raise("5016", , "Dimension should be (2 x 0) for both matrices in order to do cross multiplication !")
Error_Handler:
If Err.Number = 5016 Then
Err.Raise("5016", , "Dimension should be (2 x 0) for both matrices in order to do cross multiplication !")
Else
Err.Raise("5022", , "One or both of the matrices are null, this operation cannot be done !!")
End If
End Function
#End Region
#Region "Magnitude of a Vector"
Public Shared Function VectorMagnitude(ByVal Mat(,) As Double) As Double
Dim Rows, Cols As Integer
On Error GoTo Error_Handler
Find_R_C(Mat, Rows, Cols)
If Rows <> 2 Or Cols <> 0 Then
GoTo Error_Dimension
End If
Return Sqrt(Mat(0, 0) * Mat(0, 0) + Mat(1, 0) * Mat(1, 0) + Mat(2, 0) * Mat(2, 0))
Error_Dimension:
Err.Raise("5018", , "Dimension of the matrix should be (2 x 0) in order to find the vector's norm !")
Error_Handler:
If Err.Number = 5018 Then
Err.Raise("5018", , "Dimension of the matrix should be (2 x 0) in order to find the vector's magnitude !")
Else
Err.Raise("5022", , "In order to do this operation values must be assigned to the matrix !!")
End If
End Function
#End Region
#Region "Transpose of a Matrix"
Public Shared Function Transpose(ByVal Mat(,) As Double) As Double(,)
Dim Tr_Mat(,) As Double
Dim i, j, Rows, Cols As Integer
On Error GoTo Error_Handler
Find_R_C(Mat, Rows, Cols)
ReDim Tr_Mat(Cols, Rows)
For i = 0 To Cols
For j = 0 To Rows
Tr_Mat(j, i) = Mat(i, j)
Next j
Next i
Return Tr_Mat
Error_Handler:
Err.Raise("5028", , "In order to do this operation values must be assigned to the matrix !!")
End Function
#End Region
#Region "Multiply a matrix or a vector with a scalar quantity"
Public Shared Function ScalarMultiply(ByVal Value As Double, ByVal Mat(,) As Double) As Double(,)
Dim i, j, Rows, Cols As Integer
Dim sol(,) As Double
On Error GoTo Error_Handler
Find_R_C(Mat, Rows, Cols)
ReDim sol(Rows, Cols)
For i = 0 To Rows
For j = 0 To Cols
sol(i, j) = Mat(i, j) * Value
Next j
Next i
Return (sol)
Error_Handler:
Err.Raise("5022", , "Matrix was not assigned")
End Function
#End Region
#Region "Divide a matrix or a vector with a scalar quantity"
Public Shared Function ScalarDivide(ByVal Value As Double, ByVal Mat(,) As Double) As Double(,)
Dim i, j, Rows, Cols As Integer
Dim sol(,) As Double
On Error GoTo Error_Handler
Find_R_C(Mat, Rows, Cols)
ReDim sol(Rows, Cols)
For i = 0 To Rows
For j = 0 To Cols
sol(i, j) = Mat(i, j) / Value
Next j
Next i
Return sol
Exit Function
Error_Handler:
Err.Raise("5022", , "Matrix was not assigned")
End Function
#End Region
#Region "Print Matrix"
Public Shared Function PrintMat(ByVal Mat(,) As Double) As String
Dim N_Rows As Integer, N_Columns, k As Integer, _
i As Integer, j As Integer, m As Integer
Dim StrElem As String, StrLen As Long, _
Greatest() As Integer, LarString As String
Dim OptiString As String, sol As String
Find_R_C(Mat, N_Rows, N_Columns)
sol = ""
OptiString = ""
ReDim Greatest(N_Columns)
For i = 0 To N_Rows
For j = 0 To N_Columns
If i = 0 Then
Greatest(j) = 0
For m = 0 To N_Rows
StrElem = Format$(Mat(m, j), "0.0000")
StrLen = Len(StrElem)
If Greatest(j) < StrLen Then
Greatest(j) = StrLen
LarString = StrElem
End If
Next m
If Mid$(LarString, 1, 1) = "-" Then Greatest(j) = Greatest(j) + 1
End If
StrElem = Format$(Mat(i, j), "0.0000")
If Mid$(StrElem, 1, 1) = "-" Then
StrLen = Len(StrElem)
If Greatest(j) >= StrLen Then
For k = 1 To (Greatest(j) - StrLen)
OptiString = OptiString & " "
Next k
OptiString = OptiString & " "
End If
Else
StrLen = Len(StrElem)
If Greatest(j) > StrLen Then
For k = 1 To (Greatest(j) - StrLen)
OptiString = OptiString & " "
Next k
End If
End If
OptiString = OptiString & " " & Format$(Mat(i, j), "0.0000")
Next j
If i <> N_Rows Then
sol = sol & OptiString & vbCrLf
OptiString = ""
End If
sol = sol & OptiString
OptiString = ""
Next i
PrintMat = sol
Exit Function
End Function
#End Region
End Class
FORM :
Option Strict Off
Option Explicit On
Friend Class mnFrm
Inherits System.Windows.Forms.Form
#Region "Windows Form Designer generated code "
Public Sub New()
MyBase.New()
If m_vb6FormDefInstance Is Nothing Then
If m_InitializingDefInstance Then
m_vb6FormDefInstance = Me
Else
Try
'For the start-up form, the first instance created is the default instance.
If System.Reflection.Assembly.GetExecutingAssembly.EntryPoint.DeclaringType Is Me.GetType Then
m_vb6FormDefInstance = Me
End If
Catch
End Try
End If
End If
'This call is required by the Windows Form Designer.
InitializeComponent()
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal Disposing As Boolean)
If Disposing Then
If Not components Is Nothing Then
components.Dispose()
End If
End If
MyBase.Dispose(Disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
Public ToolTip1 As System.Windows.Forms.ToolTip
Public WithEvents txtSolution As System.Windows.Forms.TextBox
Public WithEvents CalButton As System.Windows.Forms.Button
Public WithEvents txtDisplay As System.Windows.Forms.TextBox
Public WithEvents Label11 As System.Windows.Forms.Label
Public WithEvents Label10 As System.Windows.Forms.Label
Public WithEvents Label9 As System.Windows.Forms.Label
Public WithEvents Label8 As System.Windows.Forms.Label
Public WithEvents Label7 As System.Windows.Forms.Label
Public WithEvents Label6 As System.Windows.Forms.Label
Public WithEvents Label5 As System.Windows.Forms.Label
Public WithEvents Label4 As System.Windows.Forms.Label
Public WithEvents Label3 As System.Windows.Forms.Label
Public WithEvents Label2 As System.Windows.Forms.Label
Public WithEvents Label1 As System.Windows.Forms.Label
Public WithEvents FrmSelect As System.Windows.Forms.GroupBox
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Public WithEvents Option2 As System.Windows.Forms.RadioButton
Public WithEvents Option1 As System.Windows.Forms.RadioButton
Public WithEvents Option3 As System.Windows.Forms.RadioButton
Public WithEvents Option12 As System.Windows.Forms.RadioButton
Public WithEvents Option11 As System.Windows.Forms.RadioButton
Public WithEvents Option10 As System.Windows.Forms.RadioButton
Public WithEvents Option9 As System.Windows.Forms.RadioButton
Public WithEvents Option8 As System.Windows.Forms.RadioButton
Public WithEvents Option7 As System.Windows.Forms.RadioButton
Public WithEvents Option6 As System.Windows.Forms.RadioButton
Public WithEvents Option5 As System.Windows.Forms.RadioButton
Public WithEvents Option4 As System.Windows.Forms.RadioButton
Public WithEvents Label12 As System.Windows.Forms.Label
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container
Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components)
Me.txtSolution = New System.Windows.Forms.TextBox
Me.CalButton = New System.Windows.Forms.Button
Me.txtDisplay = New System.Windows.Forms.TextBox
Me.FrmSelect = New System.Windows.Forms.GroupBox
Me.Label12 = New System.Windows.Forms.Label
Me.Option3 = New System.Windows.Forms.RadioButton
Me.Option12 = New System.Windows.Forms.RadioButton
Me.Option11 = New System.Windows.Forms.RadioButton
Me.Option10 = New System.Windows.Forms.RadioButton
Me.Option9 = New System.Windows.Forms.RadioButton
Me.Option8 = New System.Windows.Forms.RadioButton
Me.Option7 = New System.Windows.Forms.RadioButton
Me.Option6 = New System.Windows.Forms.RadioButton
Me.Option5 = New System.Windows.Forms.RadioButton
Me.Option4 = New System.Windows.Forms.RadioButton
Me.Option2 = New System.Windows.Forms.RadioButton
Me.Option1 = New System.Windows.Forms.RadioButton
Me.Label11 = New System.Windows.Forms.Label
Me.Label10 = New System.Windows.Forms.Label
Me.Label9 = New System.Windows.Forms.Label
Me.Label8 = New System.Windows.Forms.Label
Me.Label7 = New System.Windows.Forms.Label
Me.Label6 = New System.Windows.Forms.Label
Me.Label5 = New System.Windows.Forms.Label
Me.Label4 = New System.Windows.Forms.Label
Me.Label3 = New System.Windows.Forms.Label
Me.Label2 = New System.Windows.Forms.Label
Me.Label1 = New System.Windows.Forms.Label
Me.FrmSelect.SuspendLayout()
Me.SuspendLayout()
'
'txtSolution
'
Me.txtSolution.AcceptsReturn = True
Me.txtSolution.BackColor = System.Drawing.SystemColors.Window
Me.txtSolution.Cursor = System.Windows.Forms.Cursors.IBeam
Me.txtSolution.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.txtSolution.ForeColor = System.Drawing.SystemColors.WindowText
Me.txtSolution.Location = New System.Drawing.Point(8, 336)
Me.txtSolution.MaxLength = 0
Me.txtSolution.Multiline = True
Me.txtSolution.Name = "txtSolution"
Me.txtSolution.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.txtSolution.ScrollBars = System.Windows.Forms.ScrollBars.Both
Me.txtSolution.Size = New System.Drawing.Size(393, 120)
Me.txtSolution.TabIndex = 8
Me.txtSolution.WordWrap = False
'
'CalButton
'
Me.CalButton.BackColor = System.Drawing.SystemColors.Control
Me.CalButton.Cursor = System.Windows.Forms.Cursors.Default
Me.CalButton.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.CalButton.ForeColor = System.Drawing.SystemColors.ControlText
Me.CalButton.Location = New System.Drawing.Point(416, 360)
Me.CalButton.Name = "CalButton"
Me.CalButton.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.CalButton.Size = New System.Drawing.Size(89, 73)
Me.CalButton.TabIndex = 1
Me.CalButton.Text = "Hitung"
Me.CalButton.UseVisualStyleBackColor = False
'
'txtDisplay
'
Me.txtDisplay.AcceptsReturn = True
Me.txtDisplay.BackColor = System.Drawing.SystemColors.Window
Me.txtDisplay.Cursor = System.Windows.Forms.Cursors.IBeam
Me.txtDisplay.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.txtDisplay.ForeColor = System.Drawing.SystemColors.WindowText
Me.txtDisplay.Location = New System.Drawing.Point(8, 8)
Me.txtDisplay.MaxLength = 0
Me.txtDisplay.Multiline = True
Me.txtDisplay.Name = "txtDisplay"
Me.txtDisplay.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.txtDisplay.ScrollBars = System.Windows.Forms.ScrollBars.Both
Me.txtDisplay.Size = New System.Drawing.Size(393, 328)
Me.txtDisplay.TabIndex = 10
Me.txtDisplay.WordWrap = False
'
'FrmSelect
'
Me.FrmSelect.BackColor = System.Drawing.SystemColors.Control
Me.FrmSelect.Controls.Add(Me.Label12)
Me.FrmSelect.Controls.Add(Me.Option3)
Me.FrmSelect.Controls.Add(Me.Option12)
Me.FrmSelect.Controls.Add(Me.Option11)
Me.FrmSelect.Controls.Add(Me.Option10)
Me.FrmSelect.Controls.Add(Me.Option9)
Me.FrmSelect.Controls.Add(Me.Option8)
Me.FrmSelect.Controls.Add(Me.Option7)
Me.FrmSelect.Controls.Add(Me.Option6)
Me.FrmSelect.Controls.Add(Me.Option5)
Me.FrmSelect.Controls.Add(Me.Option4)
Me.FrmSelect.Controls.Add(Me.Option2)
Me.FrmSelect.Controls.Add(Me.Option1)
Me.FrmSelect.Controls.Add(Me.Label11)
Me.FrmSelect.Controls.Add(Me.Label10)
Me.FrmSelect.Controls.Add(Me.Label9)
Me.FrmSelect.Controls.Add(Me.Label8)
Me.FrmSelect.Controls.Add(Me.Label7)
Me.FrmSelect.Controls.Add(Me.Label6)
Me.FrmSelect.Controls.Add(Me.Label5)
Me.FrmSelect.Controls.Add(Me.Label4)
Me.FrmSelect.Controls.Add(Me.Label3)
Me.FrmSelect.Controls.Add(Me.Label2)
Me.FrmSelect.Controls.Add(Me.Label1)
Me.FrmSelect.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.FrmSelect.ForeColor = System.Drawing.SystemColors.ControlText
Me.FrmSelect.Location = New System.Drawing.Point(408, 0)
Me.FrmSelect.Name = "FrmSelect"
Me.FrmSelect.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.FrmSelect.Size = New System.Drawing.Size(105, 456)
Me.FrmSelect.TabIndex = 1
Me.FrmSelect.TabStop = False
'
'Label12
'
Me.Label12.BackColor = System.Drawing.SystemColors.Control
Me.Label12.Cursor = System.Windows.Forms.Cursors.Default
Me.Label12.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label12.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label12.Location = New System.Drawing.Point(24, 80)
Me.Label12.Name = "Label12"
Me.Label12.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label12.Size = New System.Drawing.Size(56, 25)
Me.Label12.TabIndex = 37
Me.Label12.Text = " A x B"
'
'Option3
'
Me.Option3.BackColor = System.Drawing.SystemColors.Control
Me.Option3.Cursor = System.Windows.Forms.Cursors.Default
Me.Option3.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Option3.ForeColor = System.Drawing.SystemColors.ControlText
Me.Option3.Location = New System.Drawing.Point(8, 80)
Me.Option3.Name = "Option3"
Me.Option3.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Option3.Size = New System.Drawing.Size(17, 17)
Me.Option3.TabIndex = 36
Me.Option3.Text = "Option1"
Me.Option3.UseVisualStyleBackColor = False
'
'Option12
'
Me.Option12.BackColor = System.Drawing.SystemColors.Control
Me.Option12.Cursor = System.Windows.Forms.Cursors.Default
Me.Option12.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Option12.ForeColor = System.Drawing.SystemColors.ControlText
Me.Option12.Location = New System.Drawing.Point(8, 296)
Me.Option12.Name = "Option12"
Me.Option12.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Option12.Size = New System.Drawing.Size(17, 17)
Me.Option12.TabIndex = 35
Me.Option12.Text = "Option1"
Me.Option12.UseVisualStyleBackColor = False
'
'Option11
'
Me.Option11.BackColor = System.Drawing.SystemColors.Control
Me.Option11.Cursor = System.Windows.Forms.Cursors.Default
Me.Option11.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Option11.ForeColor = System.Drawing.SystemColors.ControlText
Me.Option11.Location = New System.Drawing.Point(8, 272)
Me.Option11.Name = "Option11"
Me.Option11.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Option11.Size = New System.Drawing.Size(17, 17)
Me.Option11.TabIndex = 34
Me.Option11.Text = "Option1"
Me.Option11.UseVisualStyleBackColor = False
'
'Option10
'
Me.Option10.BackColor = System.Drawing.SystemColors.Control
Me.Option10.Cursor = System.Windows.Forms.Cursors.Default
Me.Option10.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Option10.ForeColor = System.Drawing.SystemColors.ControlText
Me.Option10.Location = New System.Drawing.Point(8, 248)
Me.Option10.Name = "Option10"
Me.Option10.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Option10.Size = New System.Drawing.Size(17, 17)
Me.Option10.TabIndex = 33
Me.Option10.Text = "Option1"
Me.Option10.UseVisualStyleBackColor = False
'
'Option9
'
Me.Option9.BackColor = System.Drawing.SystemColors.Control
Me.Option9.Cursor = System.Windows.Forms.Cursors.Default
Me.Option9.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Option9.ForeColor = System.Drawing.SystemColors.ControlText
Me.Option9.Location = New System.Drawing.Point(8, 224)
Me.Option9.Name = "Option9"
Me.Option9.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Option9.Size = New System.Drawing.Size(17, 17)
Me.Option9.TabIndex = 32
Me.Option9.Text = "Option1"
Me.Option9.UseVisualStyleBackColor = False
'
'Option8
'
Me.Option8.BackColor = System.Drawing.SystemColors.Control
Me.Option8.Cursor = System.Windows.Forms.Cursors.Default
Me.Option8.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Option8.ForeColor = System.Drawing.SystemColors.ControlText
Me.Option8.Location = New System.Drawing.Point(8, 200)
Me.Option8.Name = "Option8"
Me.Option8.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Option8.Size = New System.Drawing.Size(17, 17)
Me.Option8.TabIndex = 31
Me.Option8.Text = "Option1"
Me.Option8.UseVisualStyleBackColor = False
'
'Option7
'
Me.Option7.BackColor = System.Drawing.SystemColors.Control
Me.Option7.Cursor = System.Windows.Forms.Cursors.Default
Me.Option7.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Option7.ForeColor = System.Drawing.SystemColors.ControlText
Me.Option7.Location = New System.Drawing.Point(8, 176)
Me.Option7.Name = "Option7"
Me.Option7.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Option7.Size = New System.Drawing.Size(17, 17)
Me.Option7.TabIndex = 30
Me.Option7.Text = "Option1"
Me.Option7.UseVisualStyleBackColor = False
'
'Option6
'
Me.Option6.BackColor = System.Drawing.SystemColors.Control
Me.Option6.Cursor = System.Windows.Forms.Cursors.Default
Me.Option6.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Option6.ForeColor = System.Drawing.SystemColors.ControlText
Me.Option6.Location = New System.Drawing.Point(8, 152)
Me.Option6.Name = "Option6"
Me.Option6.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Option6.Size = New System.Drawing.Size(17, 17)
Me.Option6.TabIndex = 29
Me.Option6.Text = "Option1"
Me.Option6.UseVisualStyleBackColor = False
'
'Option5
'
Me.Option5.BackColor = System.Drawing.SystemColors.Control
Me.Option5.Cursor = System.Windows.Forms.Cursors.Default
Me.Option5.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Option5.ForeColor = System.Drawing.SystemColors.ControlText
Me.Option5.Location = New System.Drawing.Point(8, 128)
Me.Option5.Name = "Option5"
Me.Option5.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Option5.Size = New System.Drawing.Size(17, 17)
Me.Option5.TabIndex = 28
Me.Option5.Text = "Option1"
Me.Option5.UseVisualStyleBackColor = False
'
'Option4
'
Me.Option4.BackColor = System.Drawing.SystemColors.Control
Me.Option4.Cursor = System.Windows.Forms.Cursors.Default
Me.Option4.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Option4.ForeColor = System.Drawing.SystemColors.ControlText
Me.Option4.Location = New System.Drawing.Point(8, 104)
Me.Option4.Name = "Option4"
Me.Option4.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Option4.Size = New System.Drawing.Size(17, 17)
Me.Option4.TabIndex = 27
Me.Option4.Text = "Option1"
Me.Option4.UseVisualStyleBackColor = False
'
'Option2
'
Me.Option2.BackColor = System.Drawing.SystemColors.Control
Me.Option2.Cursor = System.Windows.Forms.Cursors.Default
Me.Option2.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Option2.ForeColor = System.Drawing.SystemColors.ControlText
Me.Option2.Location = New System.Drawing.Point(8, 56)
Me.Option2.Name = "Option2"
Me.Option2.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Option2.Size = New System.Drawing.Size(17, 17)
Me.Option2.TabIndex = 26
Me.Option2.Text = "Option1"
Me.Option2.UseVisualStyleBackColor = False
'
'Option1
'
Me.Option1.BackColor = System.Drawing.SystemColors.Control
Me.Option1.Checked = True
Me.Option1.Cursor = System.Windows.Forms.Cursors.Default
Me.Option1.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Option1.ForeColor = System.Drawing.SystemColors.ControlText
Me.Option1.Location = New System.Drawing.Point(8, 32)
Me.Option1.Name = "Option1"
Me.Option1.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Option1.Size = New System.Drawing.Size(17, 17)
Me.Option1.TabIndex = 25
Me.Option1.TabStop = True
Me.Option1.Text = "Option1"
Me.Option1.UseVisualStyleBackColor = False
'
'Label11
'
Me.Label11.BackColor = System.Drawing.SystemColors.Control
Me.Label11.Cursor = System.Windows.Forms.Cursors.Default
Me.Label11.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label11.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label11.Location = New System.Drawing.Point(24, 104)
Me.Label11.Name = "Label11"
Me.Label11.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label11.Size = New System.Drawing.Size(56, 25)
Me.Label11.TabIndex = 24
Me.Label11.Text = " Det (A)"
'
'Label10
'
Me.Label10.BackColor = System.Drawing.SystemColors.Control
Me.Label10.Cursor = System.Windows.Forms.Cursors.Default
Me.Label10.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label10.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label10.Location = New System.Drawing.Point(24, 296)
Me.Label10.Name = "Label10"
Me.Label10.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label10.Size = New System.Drawing.Size(57, 25)
Me.Label10.TabIndex = 23
Me.Label10.Text = " A x Tr (B) + Inv(A)"
'
'Label9
'
Me.Label9.BackColor = System.Drawing.SystemColors.Control
Me.Label9.Cursor = System.Windows.Forms.Cursors.Default
Me.Label9.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label9.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label9.Location = New System.Drawing.Point(24, 272)
Me.Label9.Name = "Label9"
Me.Label9.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label9.Size = New System.Drawing.Size(64, 25)
Me.Label9.TabIndex = 22
Me.Label9.Text = " B x Inv (B)"
'
'Label8
'
Me.Label8.BackColor = System.Drawing.SystemColors.Control
Me.Label8.Cursor = System.Windows.Forms.Cursors.Default
Me.Label8.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label8.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label8.Location = New System.Drawing.Point(24, 248)
Me.Label8.Name = "Label8"
Me.Label8.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label8.Size = New System.Drawing.Size(57, 25)
Me.Label8.TabIndex = 21
Me.Label8.Text = " V2 / 3 "
'
'Label7
'
Me.Label7.BackColor = System.Drawing.SystemColors.Control
Me.Label7.Cursor = System.Windows.Forms.Cursors.Default
Me.Label7.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label7.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label7.Location = New System.Drawing.Point(24, 224)
Me.Label7.Name = "Label7"
Me.Label7.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label7.Size = New System.Drawing.Size(57, 25)
Me.Label7.TabIndex = 20
Me.Label7.Text = " 5 A"
'
'Label6
'
Me.Label6.BackColor = System.Drawing.SystemColors.Control
Me.Label6.Cursor = System.Windows.Forms.Cursors.Default
Me.Label6.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label6.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label6.Location = New System.Drawing.Point(24, 200)
Me.Label6.Name = "Label6"
Me.Label6.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label6.Size = New System.Drawing.Size(57, 25)
Me.Label6.TabIndex = 19
Me.Label6.Text = " | V1 |"
'
'Label5
'
Me.Label5.BackColor = System.Drawing.SystemColors.Control
Me.Label5.Cursor = System.Windows.Forms.Cursors.Default
Me.Label5.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label5.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label5.Location = New System.Drawing.Point(24, 176)
Me.Label5.Name = "Label5"
Me.Label5.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label5.Size = New System.Drawing.Size(57, 25)
Me.Label5.TabIndex = 18
Me.Label5.Text = " V1 x V2"
'
'Label4
'
Me.Label4.BackColor = System.Drawing.SystemColors.Control
Me.Label4.Cursor = System.Windows.Forms.Cursors.Default
Me.Label4.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label4.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label4.Location = New System.Drawing.Point(24, 152)
Me.Label4.Name = "Label4"
Me.Label4.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label4.Size = New System.Drawing.Size(72, 25)
Me.Label4.TabIndex = 17
Me.Label4.Text = "Transpose(B)"
'
'Label3
'
Me.Label3.BackColor = System.Drawing.SystemColors.Control
Me.Label3.Cursor = System.Windows.Forms.Cursors.Default
Me.Label3.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label3.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label3.Location = New System.Drawing.Point(24, 128)
Me.Label3.Name = "Label3"
Me.Label3.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label3.Size = New System.Drawing.Size(57, 25)
Me.Label3.TabIndex = 16
Me.Label3.Text = "Inverse(A)"
'
'Label2
'
Me.Label2.BackColor = System.Drawing.SystemColors.Control
Me.Label2.Cursor = System.Windows.Forms.Cursors.Default
Me.Label2.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label2.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label2.Location = New System.Drawing.Point(24, 56)
Me.Label2.Name = "Label2"
Me.Label2.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label2.Size = New System.Drawing.Size(33, 25)
Me.Label2.TabIndex = 15
Me.Label2.Text = " A - B"
'
'Label1
'
Me.Label1.BackColor = System.Drawing.SystemColors.Control
Me.Label1.Cursor = System.Windows.Forms.Cursors.Default
Me.Label1.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label1.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label1.Location = New System.Drawing.Point(24, 32)
Me.Label1.Name = "Label1"
Me.Label1.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label1.Size = New System.Drawing.Size(40, 25)
Me.Label1.TabIndex = 14
Me.Label1.Text = " A + B"
'
'mnFrm
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(520, 456)
Me.Controls.Add(Me.txtSolution)
Me.Controls.Add(Me.CalButton)
Me.Controls.Add(Me.txtDisplay)
Me.Controls.Add(Me.FrmSelect)
Me.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Location = New System.Drawing.Point(4, 25)
Me.Name = "mnFrm"
Me.FrmSelect.ResumeLayout(False)
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
#End Region
#Region "Upgrade Support "
Private Shared m_vb6FormDefInstance As mnFrm
Private Shared m_InitializingDefInstance As Boolean
Public Shared Property DefInstance() As mnFrm
Get
If m_vb6FormDefInstance Is Nothing OrElse m_vb6FormDefInstance.IsDisposed Then
m_InitializingDefInstance = True
m_vb6FormDefInstance = New mnFrm()
m_InitializingDefInstance = False
End If
DefInstance = m_vb6FormDefInstance
End Get
Set
m_vb6FormDefInstance = Value
End Set
End Property
#End Region
Dim A(3, 3) As Double 'defines a matrix A with dimensions (4x4)
Dim B(3, 3) As Double 'defines a matrix B with dimensions (4x4)
Dim V1(2, 0) As Double 'define a vector V1
Dim V2(2, 0) As Double 'define a vector V2
Private Sub CalButton_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles CalButton.Click
'Assign a dynamic matrix C
Dim C(,) As Double
Dim Determinant As Double
Dim Magnitude As Double
If Option1.Checked = True Then
'Addition Case
C = MatLib.Add(A, B) 'C = Addition of A and B
txtSolution.Text = "Answer A + B = " & vbCrLf & vbCrLf
txtSolution.Text = txtSolution.Text & MatLib.PrintMat(C) 'Print C
ElseIf Option2.Checked = True Then
'Subtraction Case
C = MatLib.Subtract(A, B) 'C = Subtration of A from B
'Print C
txtSolution.Text = "Answer A - B = " & vbCrLf & vbCrLf
txtSolution.Text = txtSolution.Text & MatLib.PrintMat(C) 'Print C
ElseIf Option3.Checked = True Then
'Multiplication Case
C = MatLib.Multiply(A, B) 'C = Multiple of A and B
'Print C
txtSolution.Text = "Answer A x B = " & vbCrLf & vbCrLf
txtSolution.Text = txtSolution.Text & MatLib.PrintMat(C) 'Print C
ElseIf Option4.Checked = True Then
'Determinant Case of Matrix A
Determinant = MatLib.Det(A)
txtSolution.Text = "Answer Determinant of A = " & vbCrLf & vbCrLf
txtSolution.Text = txtSolution.Text & Determinant
ElseIf Option5.Checked = True Then
'Inverse Case of Matrix B
C = MatLib.Inv(A)
txtSolution.Text = "Answer Inverse of A = " & vbCrLf & vbCrLf
txtSolution.Text = txtSolution.Text & MatLib.PrintMat(C)
ElseIf Option6.Checked = True Then
'Transpose Case of Matrix B
C = MatLib.Transpose(B)
txtSolution.Text = "Answer Transpose of B = " & vbCrLf & vbCrLf
txtSolution.Text = txtSolution.Text & MatLib.PrintMat(C)
ElseIf Option7.Checked = True Then
'Mutiply Vectors V1 and V2 Case
C = MatLib.MultiplyVectors(V1, V2)
txtSolution.Text = "Answer V1 x V2 = " & vbCrLf & vbCrLf
txtSolution.Text = txtSolution.Text & MatLib.PrintMat(C)
ElseIf Option8.Checked = True Then
'Magnitude of Vector V1 Case
Magnitude = MatLib.VectorMagnitude(V1)
txtSolution.Text = "Answer |V1| = " & vbCrLf & vbCrLf
txtSolution.Text = txtSolution.Text & Magnitude
ElseIf Option9.Checked = True Then
'Scalar Multiply 5*A Case
C = MatLib.ScalarMultiply(5, A)
txtSolution.Text = "Answer 5A = " & vbCrLf & vbCrLf
txtSolution.Text = txtSolution.Text & MatLib.PrintMat(C)
ElseIf Option10.Checked = True Then
'Scalar Divide V2/3 Case
C = MatLib.ScalarDivide(3, V2)
txtSolution.Text = "Answer V2 / 3 = " & vbCrLf & vbCrLf
txtSolution.Text = txtSolution.Text & MatLib.PrintMat(C)
ElseIf Option11.Checked = True Then
'Case Bxinv(B)
C = MatLib.Multiply(A, MatLib.Inv(A))
txtSolution.Text = "Answer B x Inverse(B) = " & vbCrLf & vbCrLf
txtSolution.Text = txtSolution.Text & MatLib.PrintMat(C)
ElseIf Option12.Checked = True Then
'Case AxTranspose(B)+inv(A)
C = MatLib.Add(MatLib.Multiply(A, MatLib.Transpose(B)), MatLib.Inv(A))
txtSolution.Text = "Answer A x Transpose(B)+Inverse(A) = " & vbCrLf & vbCrLf
txtSolution.Text = txtSolution.Text & MatLib.PrintMat(C)
End If
End Sub
Private Sub mnFrm_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
Dim i, j As Short
'Assign some values to matrix A and B
A(0, 0) = 1 : A(0, 1) = 2 : A(0, 2) = 3 : A(0, 3) = 4
A(1, 0) = 5 : A(1, 1) = 6 : A(1, 2) = 7 : A(1, 3) = 8
A(2, 0) = 9 : A(2, 1) = 10 : A(2, 2) = 1 : A(2, 3) = 12
A(3, 0) = 13 : A(3, 1) = -14 : A(3, 2) = 15 : A(3, 3) = 16
For i = 0 To 3
For j = 0 To 3
B(i, j) = 2 * Rnd(1)
Next j
Next i
'Assign some values to vectors V1 and V2
V1(0, 0) = 1 : V1(1, 0) = 2 : V1(2, 0) = 3
V2(0, 0) = 4 : V2(1, 0) = 5 : V2(2, 0) = 6
'Print Matrices And Vectors
txtDisplay.Text = "Matix A = " & vbCrLf
txtDisplay.Text = txtDisplay.Text & MatLib.PrintMat(A) & vbCrLf & vbCrLf
txtDisplay.Text = txtDisplay.Text & "Matix B = " & vbCrLf
txtDisplay.Text = txtDisplay.Text & MatLib.PrintMat(B) & vbCrLf & vbCrLf
txtDisplay.Text = txtDisplay.Text & "Vector V1 = " & vbCrLf
txtDisplay.Text = txtDisplay.Text & MatLib.PrintMat(V1) & vbCrLf & vbCrLf
txtDisplay.Text = txtDisplay.Text & "Vector V2 = " & vbCrLf
txtDisplay.Text = txtDisplay.Text & MatLib.PrintMat(V2)
End Sub
Private Sub FrmSelect_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FrmSelect.Enter
End Sub
End Class
Option Explicit On
Friend Class mnFrm
Inherits System.Windows.Forms.Form
#Region "Windows Form Designer generated code "
Public Sub New()
MyBase.New()
If m_vb6FormDefInstance Is Nothing Then
If m_InitializingDefInstance Then
m_vb6FormDefInstance = Me
Else
Try
'For the start-up form, the first instance created is the default instance.
If System.Reflection.Assembly.GetExecutingAssembly.EntryPoint.DeclaringType Is Me.GetType Then
m_vb6FormDefInstance = Me
End If
Catch
End Try
End If
End If
'This call is required by the Windows Form Designer.
InitializeComponent()
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal Disposing As Boolean)
If Disposing Then
If Not components Is Nothing Then
components.Dispose()
End If
End If
MyBase.Dispose(Disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
Public ToolTip1 As System.Windows.Forms.ToolTip
Public WithEvents txtSolution As System.Windows.Forms.TextBox
Public WithEvents CalButton As System.Windows.Forms.Button
Public WithEvents txtDisplay As System.Windows.Forms.TextBox
Public WithEvents Label11 As System.Windows.Forms.Label
Public WithEvents Label10 As System.Windows.Forms.Label
Public WithEvents Label9 As System.Windows.Forms.Label
Public WithEvents Label8 As System.Windows.Forms.Label
Public WithEvents Label7 As System.Windows.Forms.Label
Public WithEvents Label6 As System.Windows.Forms.Label
Public WithEvents Label5 As System.Windows.Forms.Label
Public WithEvents Label4 As System.Windows.Forms.Label
Public WithEvents Label3 As System.Windows.Forms.Label
Public WithEvents Label2 As System.Windows.Forms.Label
Public WithEvents Label1 As System.Windows.Forms.Label
Public WithEvents FrmSelect As System.Windows.Forms.GroupBox
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Public WithEvents Option2 As System.Windows.Forms.RadioButton
Public WithEvents Option1 As System.Windows.Forms.RadioButton
Public WithEvents Option3 As System.Windows.Forms.RadioButton
Public WithEvents Option12 As System.Windows.Forms.RadioButton
Public WithEvents Option11 As System.Windows.Forms.RadioButton
Public WithEvents Option10 As System.Windows.Forms.RadioButton
Public WithEvents Option9 As System.Windows.Forms.RadioButton
Public WithEvents Option8 As System.Windows.Forms.RadioButton
Public WithEvents Option7 As System.Windows.Forms.RadioButton
Public WithEvents Option6 As System.Windows.Forms.RadioButton
Public WithEvents Option5 As System.Windows.Forms.RadioButton
Public WithEvents Option4 As System.Windows.Forms.RadioButton
Public WithEvents Label12 As System.Windows.Forms.Label
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container
Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components)
Me.txtSolution = New System.Windows.Forms.TextBox
Me.CalButton = New System.Windows.Forms.Button
Me.txtDisplay = New System.Windows.Forms.TextBox
Me.FrmSelect = New System.Windows.Forms.GroupBox
Me.Label12 = New System.Windows.Forms.Label
Me.Option3 = New System.Windows.Forms.RadioButton
Me.Option12 = New System.Windows.Forms.RadioButton
Me.Option11 = New System.Windows.Forms.RadioButton
Me.Option10 = New System.Windows.Forms.RadioButton
Me.Option9 = New System.Windows.Forms.RadioButton
Me.Option8 = New System.Windows.Forms.RadioButton
Me.Option7 = New System.Windows.Forms.RadioButton
Me.Option6 = New System.Windows.Forms.RadioButton
Me.Option5 = New System.Windows.Forms.RadioButton
Me.Option4 = New System.Windows.Forms.RadioButton
Me.Option2 = New System.Windows.Forms.RadioButton
Me.Option1 = New System.Windows.Forms.RadioButton
Me.Label11 = New System.Windows.Forms.Label
Me.Label10 = New System.Windows.Forms.Label
Me.Label9 = New System.Windows.Forms.Label
Me.Label8 = New System.Windows.Forms.Label
Me.Label7 = New System.Windows.Forms.Label
Me.Label6 = New System.Windows.Forms.Label
Me.Label5 = New System.Windows.Forms.Label
Me.Label4 = New System.Windows.Forms.Label
Me.Label3 = New System.Windows.Forms.Label
Me.Label2 = New System.Windows.Forms.Label
Me.Label1 = New System.Windows.Forms.Label
Me.FrmSelect.SuspendLayout()
Me.SuspendLayout()
'
'txtSolution
'
Me.txtSolution.AcceptsReturn = True
Me.txtSolution.BackColor = System.Drawing.SystemColors.Window
Me.txtSolution.Cursor = System.Windows.Forms.Cursors.IBeam
Me.txtSolution.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.txtSolution.ForeColor = System.Drawing.SystemColors.WindowText
Me.txtSolution.Location = New System.Drawing.Point(8, 336)
Me.txtSolution.MaxLength = 0
Me.txtSolution.Multiline = True
Me.txtSolution.Name = "txtSolution"
Me.txtSolution.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.txtSolution.ScrollBars = System.Windows.Forms.ScrollBars.Both
Me.txtSolution.Size = New System.Drawing.Size(393, 120)
Me.txtSolution.TabIndex = 8
Me.txtSolution.WordWrap = False
'
'CalButton
'
Me.CalButton.BackColor = System.Drawing.SystemColors.Control
Me.CalButton.Cursor = System.Windows.Forms.Cursors.Default
Me.CalButton.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.CalButton.ForeColor = System.Drawing.SystemColors.ControlText
Me.CalButton.Location = New System.Drawing.Point(416, 360)
Me.CalButton.Name = "CalButton"
Me.CalButton.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.CalButton.Size = New System.Drawing.Size(89, 73)
Me.CalButton.TabIndex = 1
Me.CalButton.Text = "Hitung"
Me.CalButton.UseVisualStyleBackColor = False
'
'txtDisplay
'
Me.txtDisplay.AcceptsReturn = True
Me.txtDisplay.BackColor = System.Drawing.SystemColors.Window
Me.txtDisplay.Cursor = System.Windows.Forms.Cursors.IBeam
Me.txtDisplay.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.txtDisplay.ForeColor = System.Drawing.SystemColors.WindowText
Me.txtDisplay.Location = New System.Drawing.Point(8, 8)
Me.txtDisplay.MaxLength = 0
Me.txtDisplay.Multiline = True
Me.txtDisplay.Name = "txtDisplay"
Me.txtDisplay.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.txtDisplay.ScrollBars = System.Windows.Forms.ScrollBars.Both
Me.txtDisplay.Size = New System.Drawing.Size(393, 328)
Me.txtDisplay.TabIndex = 10
Me.txtDisplay.WordWrap = False
'
'FrmSelect
'
Me.FrmSelect.BackColor = System.Drawing.SystemColors.Control
Me.FrmSelect.Controls.Add(Me.Label12)
Me.FrmSelect.Controls.Add(Me.Option3)
Me.FrmSelect.Controls.Add(Me.Option12)
Me.FrmSelect.Controls.Add(Me.Option11)
Me.FrmSelect.Controls.Add(Me.Option10)
Me.FrmSelect.Controls.Add(Me.Option9)
Me.FrmSelect.Controls.Add(Me.Option8)
Me.FrmSelect.Controls.Add(Me.Option7)
Me.FrmSelect.Controls.Add(Me.Option6)
Me.FrmSelect.Controls.Add(Me.Option5)
Me.FrmSelect.Controls.Add(Me.Option4)
Me.FrmSelect.Controls.Add(Me.Option2)
Me.FrmSelect.Controls.Add(Me.Option1)
Me.FrmSelect.Controls.Add(Me.Label11)
Me.FrmSelect.Controls.Add(Me.Label10)
Me.FrmSelect.Controls.Add(Me.Label9)
Me.FrmSelect.Controls.Add(Me.Label8)
Me.FrmSelect.Controls.Add(Me.Label7)
Me.FrmSelect.Controls.Add(Me.Label6)
Me.FrmSelect.Controls.Add(Me.Label5)
Me.FrmSelect.Controls.Add(Me.Label4)
Me.FrmSelect.Controls.Add(Me.Label3)
Me.FrmSelect.Controls.Add(Me.Label2)
Me.FrmSelect.Controls.Add(Me.Label1)
Me.FrmSelect.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.FrmSelect.ForeColor = System.Drawing.SystemColors.ControlText
Me.FrmSelect.Location = New System.Drawing.Point(408, 0)
Me.FrmSelect.Name = "FrmSelect"
Me.FrmSelect.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.FrmSelect.Size = New System.Drawing.Size(105, 456)
Me.FrmSelect.TabIndex = 1
Me.FrmSelect.TabStop = False
'
'Label12
'
Me.Label12.BackColor = System.Drawing.SystemColors.Control
Me.Label12.Cursor = System.Windows.Forms.Cursors.Default
Me.Label12.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label12.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label12.Location = New System.Drawing.Point(24, 80)
Me.Label12.Name = "Label12"
Me.Label12.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label12.Size = New System.Drawing.Size(56, 25)
Me.Label12.TabIndex = 37
Me.Label12.Text = " A x B"
'
'Option3
'
Me.Option3.BackColor = System.Drawing.SystemColors.Control
Me.Option3.Cursor = System.Windows.Forms.Cursors.Default
Me.Option3.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Option3.ForeColor = System.Drawing.SystemColors.ControlText
Me.Option3.Location = New System.Drawing.Point(8, 80)
Me.Option3.Name = "Option3"
Me.Option3.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Option3.Size = New System.Drawing.Size(17, 17)
Me.Option3.TabIndex = 36
Me.Option3.Text = "Option1"
Me.Option3.UseVisualStyleBackColor = False
'
'Option12
'
Me.Option12.BackColor = System.Drawing.SystemColors.Control
Me.Option12.Cursor = System.Windows.Forms.Cursors.Default
Me.Option12.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Option12.ForeColor = System.Drawing.SystemColors.ControlText
Me.Option12.Location = New System.Drawing.Point(8, 296)
Me.Option12.Name = "Option12"
Me.Option12.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Option12.Size = New System.Drawing.Size(17, 17)
Me.Option12.TabIndex = 35
Me.Option12.Text = "Option1"
Me.Option12.UseVisualStyleBackColor = False
'
'Option11
'
Me.Option11.BackColor = System.Drawing.SystemColors.Control
Me.Option11.Cursor = System.Windows.Forms.Cursors.Default
Me.Option11.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Option11.ForeColor = System.Drawing.SystemColors.ControlText
Me.Option11.Location = New System.Drawing.Point(8, 272)
Me.Option11.Name = "Option11"
Me.Option11.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Option11.Size = New System.Drawing.Size(17, 17)
Me.Option11.TabIndex = 34
Me.Option11.Text = "Option1"
Me.Option11.UseVisualStyleBackColor = False
'
'Option10
'
Me.Option10.BackColor = System.Drawing.SystemColors.Control
Me.Option10.Cursor = System.Windows.Forms.Cursors.Default
Me.Option10.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Option10.ForeColor = System.Drawing.SystemColors.ControlText
Me.Option10.Location = New System.Drawing.Point(8, 248)
Me.Option10.Name = "Option10"
Me.Option10.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Option10.Size = New System.Drawing.Size(17, 17)
Me.Option10.TabIndex = 33
Me.Option10.Text = "Option1"
Me.Option10.UseVisualStyleBackColor = False
'
'Option9
'
Me.Option9.BackColor = System.Drawing.SystemColors.Control
Me.Option9.Cursor = System.Windows.Forms.Cursors.Default
Me.Option9.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Option9.ForeColor = System.Drawing.SystemColors.ControlText
Me.Option9.Location = New System.Drawing.Point(8, 224)
Me.Option9.Name = "Option9"
Me.Option9.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Option9.Size = New System.Drawing.Size(17, 17)
Me.Option9.TabIndex = 32
Me.Option9.Text = "Option1"
Me.Option9.UseVisualStyleBackColor = False
'
'Option8
'
Me.Option8.BackColor = System.Drawing.SystemColors.Control
Me.Option8.Cursor = System.Windows.Forms.Cursors.Default
Me.Option8.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Option8.ForeColor = System.Drawing.SystemColors.ControlText
Me.Option8.Location = New System.Drawing.Point(8, 200)
Me.Option8.Name = "Option8"
Me.Option8.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Option8.Size = New System.Drawing.Size(17, 17)
Me.Option8.TabIndex = 31
Me.Option8.Text = "Option1"
Me.Option8.UseVisualStyleBackColor = False
'
'Option7
'
Me.Option7.BackColor = System.Drawing.SystemColors.Control
Me.Option7.Cursor = System.Windows.Forms.Cursors.Default
Me.Option7.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Option7.ForeColor = System.Drawing.SystemColors.ControlText
Me.Option7.Location = New System.Drawing.Point(8, 176)
Me.Option7.Name = "Option7"
Me.Option7.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Option7.Size = New System.Drawing.Size(17, 17)
Me.Option7.TabIndex = 30
Me.Option7.Text = "Option1"
Me.Option7.UseVisualStyleBackColor = False
'
'Option6
'
Me.Option6.BackColor = System.Drawing.SystemColors.Control
Me.Option6.Cursor = System.Windows.Forms.Cursors.Default
Me.Option6.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Option6.ForeColor = System.Drawing.SystemColors.ControlText
Me.Option6.Location = New System.Drawing.Point(8, 152)
Me.Option6.Name = "Option6"
Me.Option6.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Option6.Size = New System.Drawing.Size(17, 17)
Me.Option6.TabIndex = 29
Me.Option6.Text = "Option1"
Me.Option6.UseVisualStyleBackColor = False
'
'Option5
'
Me.Option5.BackColor = System.Drawing.SystemColors.Control
Me.Option5.Cursor = System.Windows.Forms.Cursors.Default
Me.Option5.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Option5.ForeColor = System.Drawing.SystemColors.ControlText
Me.Option5.Location = New System.Drawing.Point(8, 128)
Me.Option5.Name = "Option5"
Me.Option5.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Option5.Size = New System.Drawing.Size(17, 17)
Me.Option5.TabIndex = 28
Me.Option5.Text = "Option1"
Me.Option5.UseVisualStyleBackColor = False
'
'Option4
'
Me.Option4.BackColor = System.Drawing.SystemColors.Control
Me.Option4.Cursor = System.Windows.Forms.Cursors.Default
Me.Option4.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Option4.ForeColor = System.Drawing.SystemColors.ControlText
Me.Option4.Location = New System.Drawing.Point(8, 104)
Me.Option4.Name = "Option4"
Me.Option4.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Option4.Size = New System.Drawing.Size(17, 17)
Me.Option4.TabIndex = 27
Me.Option4.Text = "Option1"
Me.Option4.UseVisualStyleBackColor = False
'
'Option2
'
Me.Option2.BackColor = System.Drawing.SystemColors.Control
Me.Option2.Cursor = System.Windows.Forms.Cursors.Default
Me.Option2.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Option2.ForeColor = System.Drawing.SystemColors.ControlText
Me.Option2.Location = New System.Drawing.Point(8, 56)
Me.Option2.Name = "Option2"
Me.Option2.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Option2.Size = New System.Drawing.Size(17, 17)
Me.Option2.TabIndex = 26
Me.Option2.Text = "Option1"
Me.Option2.UseVisualStyleBackColor = False
'
'Option1
'
Me.Option1.BackColor = System.Drawing.SystemColors.Control
Me.Option1.Checked = True
Me.Option1.Cursor = System.Windows.Forms.Cursors.Default
Me.Option1.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Option1.ForeColor = System.Drawing.SystemColors.ControlText
Me.Option1.Location = New System.Drawing.Point(8, 32)
Me.Option1.Name = "Option1"
Me.Option1.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Option1.Size = New System.Drawing.Size(17, 17)
Me.Option1.TabIndex = 25
Me.Option1.TabStop = True
Me.Option1.Text = "Option1"
Me.Option1.UseVisualStyleBackColor = False
'
'Label11
'
Me.Label11.BackColor = System.Drawing.SystemColors.Control
Me.Label11.Cursor = System.Windows.Forms.Cursors.Default
Me.Label11.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label11.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label11.Location = New System.Drawing.Point(24, 104)
Me.Label11.Name = "Label11"
Me.Label11.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label11.Size = New System.Drawing.Size(56, 25)
Me.Label11.TabIndex = 24
Me.Label11.Text = " Det (A)"
'
'Label10
'
Me.Label10.BackColor = System.Drawing.SystemColors.Control
Me.Label10.Cursor = System.Windows.Forms.Cursors.Default
Me.Label10.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label10.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label10.Location = New System.Drawing.Point(24, 296)
Me.Label10.Name = "Label10"
Me.Label10.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label10.Size = New System.Drawing.Size(57, 25)
Me.Label10.TabIndex = 23
Me.Label10.Text = " A x Tr (B) + Inv(A)"
'
'Label9
'
Me.Label9.BackColor = System.Drawing.SystemColors.Control
Me.Label9.Cursor = System.Windows.Forms.Cursors.Default
Me.Label9.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label9.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label9.Location = New System.Drawing.Point(24, 272)
Me.Label9.Name = "Label9"
Me.Label9.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label9.Size = New System.Drawing.Size(64, 25)
Me.Label9.TabIndex = 22
Me.Label9.Text = " B x Inv (B)"
'
'Label8
'
Me.Label8.BackColor = System.Drawing.SystemColors.Control
Me.Label8.Cursor = System.Windows.Forms.Cursors.Default
Me.Label8.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label8.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label8.Location = New System.Drawing.Point(24, 248)
Me.Label8.Name = "Label8"
Me.Label8.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label8.Size = New System.Drawing.Size(57, 25)
Me.Label8.TabIndex = 21
Me.Label8.Text = " V2 / 3 "
'
'Label7
'
Me.Label7.BackColor = System.Drawing.SystemColors.Control
Me.Label7.Cursor = System.Windows.Forms.Cursors.Default
Me.Label7.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label7.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label7.Location = New System.Drawing.Point(24, 224)
Me.Label7.Name = "Label7"
Me.Label7.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label7.Size = New System.Drawing.Size(57, 25)
Me.Label7.TabIndex = 20
Me.Label7.Text = " 5 A"
'
'Label6
'
Me.Label6.BackColor = System.Drawing.SystemColors.Control
Me.Label6.Cursor = System.Windows.Forms.Cursors.Default
Me.Label6.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label6.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label6.Location = New System.Drawing.Point(24, 200)
Me.Label6.Name = "Label6"
Me.Label6.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label6.Size = New System.Drawing.Size(57, 25)
Me.Label6.TabIndex = 19
Me.Label6.Text = " | V1 |"
'
'Label5
'
Me.Label5.BackColor = System.Drawing.SystemColors.Control
Me.Label5.Cursor = System.Windows.Forms.Cursors.Default
Me.Label5.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label5.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label5.Location = New System.Drawing.Point(24, 176)
Me.Label5.Name = "Label5"
Me.Label5.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label5.Size = New System.Drawing.Size(57, 25)
Me.Label5.TabIndex = 18
Me.Label5.Text = " V1 x V2"
'
'Label4
'
Me.Label4.BackColor = System.Drawing.SystemColors.Control
Me.Label4.Cursor = System.Windows.Forms.Cursors.Default
Me.Label4.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label4.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label4.Location = New System.Drawing.Point(24, 152)
Me.Label4.Name = "Label4"
Me.Label4.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label4.Size = New System.Drawing.Size(72, 25)
Me.Label4.TabIndex = 17
Me.Label4.Text = "Transpose(B)"
'
'Label3
'
Me.Label3.BackColor = System.Drawing.SystemColors.Control
Me.Label3.Cursor = System.Windows.Forms.Cursors.Default
Me.Label3.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label3.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label3.Location = New System.Drawing.Point(24, 128)
Me.Label3.Name = "Label3"
Me.Label3.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label3.Size = New System.Drawing.Size(57, 25)
Me.Label3.TabIndex = 16
Me.Label3.Text = "Inverse(A)"
'
'Label2
'
Me.Label2.BackColor = System.Drawing.SystemColors.Control
Me.Label2.Cursor = System.Windows.Forms.Cursors.Default
Me.Label2.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label2.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label2.Location = New System.Drawing.Point(24, 56)
Me.Label2.Name = "Label2"
Me.Label2.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label2.Size = New System.Drawing.Size(33, 25)
Me.Label2.TabIndex = 15
Me.Label2.Text = " A - B"
'
'Label1
'
Me.Label1.BackColor = System.Drawing.SystemColors.Control
Me.Label1.Cursor = System.Windows.Forms.Cursors.Default
Me.Label1.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label1.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label1.Location = New System.Drawing.Point(24, 32)
Me.Label1.Name = "Label1"
Me.Label1.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label1.Size = New System.Drawing.Size(40, 25)
Me.Label1.TabIndex = 14
Me.Label1.Text = " A + B"
'
'mnFrm
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(520, 456)
Me.Controls.Add(Me.txtSolution)
Me.Controls.Add(Me.CalButton)
Me.Controls.Add(Me.txtDisplay)
Me.Controls.Add(Me.FrmSelect)
Me.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Location = New System.Drawing.Point(4, 25)
Me.Name = "mnFrm"
Me.FrmSelect.ResumeLayout(False)
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
#End Region
#Region "Upgrade Support "
Private Shared m_vb6FormDefInstance As mnFrm
Private Shared m_InitializingDefInstance As Boolean
Public Shared Property DefInstance() As mnFrm
Get
If m_vb6FormDefInstance Is Nothing OrElse m_vb6FormDefInstance.IsDisposed Then
m_InitializingDefInstance = True
m_vb6FormDefInstance = New mnFrm()
m_InitializingDefInstance = False
End If
DefInstance = m_vb6FormDefInstance
End Get
Set
m_vb6FormDefInstance = Value
End Set
End Property
#End Region
Dim A(3, 3) As Double 'defines a matrix A with dimensions (4x4)
Dim B(3, 3) As Double 'defines a matrix B with dimensions (4x4)
Dim V1(2, 0) As Double 'define a vector V1
Dim V2(2, 0) As Double 'define a vector V2
Private Sub CalButton_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles CalButton.Click
'Assign a dynamic matrix C
Dim C(,) As Double
Dim Determinant As Double
Dim Magnitude As Double
If Option1.Checked = True Then
'Addition Case
C = MatLib.Add(A, B) 'C = Addition of A and B
txtSolution.Text = "Answer A + B = " & vbCrLf & vbCrLf
txtSolution.Text = txtSolution.Text & MatLib.PrintMat(C) 'Print C
ElseIf Option2.Checked = True Then
'Subtraction Case
C = MatLib.Subtract(A, B) 'C = Subtration of A from B
'Print C
txtSolution.Text = "Answer A - B = " & vbCrLf & vbCrLf
txtSolution.Text = txtSolution.Text & MatLib.PrintMat(C) 'Print C
ElseIf Option3.Checked = True Then
'Multiplication Case
C = MatLib.Multiply(A, B) 'C = Multiple of A and B
'Print C
txtSolution.Text = "Answer A x B = " & vbCrLf & vbCrLf
txtSolution.Text = txtSolution.Text & MatLib.PrintMat(C) 'Print C
ElseIf Option4.Checked = True Then
'Determinant Case of Matrix A
Determinant = MatLib.Det(A)
txtSolution.Text = "Answer Determinant of A = " & vbCrLf & vbCrLf
txtSolution.Text = txtSolution.Text & Determinant
ElseIf Option5.Checked = True Then
'Inverse Case of Matrix B
C = MatLib.Inv(A)
txtSolution.Text = "Answer Inverse of A = " & vbCrLf & vbCrLf
txtSolution.Text = txtSolution.Text & MatLib.PrintMat(C)
ElseIf Option6.Checked = True Then
'Transpose Case of Matrix B
C = MatLib.Transpose(B)
txtSolution.Text = "Answer Transpose of B = " & vbCrLf & vbCrLf
txtSolution.Text = txtSolution.Text & MatLib.PrintMat(C)
ElseIf Option7.Checked = True Then
'Mutiply Vectors V1 and V2 Case
C = MatLib.MultiplyVectors(V1, V2)
txtSolution.Text = "Answer V1 x V2 = " & vbCrLf & vbCrLf
txtSolution.Text = txtSolution.Text & MatLib.PrintMat(C)
ElseIf Option8.Checked = True Then
'Magnitude of Vector V1 Case
Magnitude = MatLib.VectorMagnitude(V1)
txtSolution.Text = "Answer |V1| = " & vbCrLf & vbCrLf
txtSolution.Text = txtSolution.Text & Magnitude
ElseIf Option9.Checked = True Then
'Scalar Multiply 5*A Case
C = MatLib.ScalarMultiply(5, A)
txtSolution.Text = "Answer 5A = " & vbCrLf & vbCrLf
txtSolution.Text = txtSolution.Text & MatLib.PrintMat(C)
ElseIf Option10.Checked = True Then
'Scalar Divide V2/3 Case
C = MatLib.ScalarDivide(3, V2)
txtSolution.Text = "Answer V2 / 3 = " & vbCrLf & vbCrLf
txtSolution.Text = txtSolution.Text & MatLib.PrintMat(C)
ElseIf Option11.Checked = True Then
'Case Bxinv(B)
C = MatLib.Multiply(A, MatLib.Inv(A))
txtSolution.Text = "Answer B x Inverse(B) = " & vbCrLf & vbCrLf
txtSolution.Text = txtSolution.Text & MatLib.PrintMat(C)
ElseIf Option12.Checked = True Then
'Case AxTranspose(B)+inv(A)
C = MatLib.Add(MatLib.Multiply(A, MatLib.Transpose(B)), MatLib.Inv(A))
txtSolution.Text = "Answer A x Transpose(B)+Inverse(A) = " & vbCrLf & vbCrLf
txtSolution.Text = txtSolution.Text & MatLib.PrintMat(C)
End If
End Sub
Private Sub mnFrm_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
Dim i, j As Short
'Assign some values to matrix A and B
A(0, 0) = 1 : A(0, 1) = 2 : A(0, 2) = 3 : A(0, 3) = 4
A(1, 0) = 5 : A(1, 1) = 6 : A(1, 2) = 7 : A(1, 3) = 8
A(2, 0) = 9 : A(2, 1) = 10 : A(2, 2) = 1 : A(2, 3) = 12
A(3, 0) = 13 : A(3, 1) = -14 : A(3, 2) = 15 : A(3, 3) = 16
For i = 0 To 3
For j = 0 To 3
B(i, j) = 2 * Rnd(1)
Next j
Next i
'Assign some values to vectors V1 and V2
V1(0, 0) = 1 : V1(1, 0) = 2 : V1(2, 0) = 3
V2(0, 0) = 4 : V2(1, 0) = 5 : V2(2, 0) = 6
'Print Matrices And Vectors
txtDisplay.Text = "Matix A = " & vbCrLf
txtDisplay.Text = txtDisplay.Text & MatLib.PrintMat(A) & vbCrLf & vbCrLf
txtDisplay.Text = txtDisplay.Text & "Matix B = " & vbCrLf
txtDisplay.Text = txtDisplay.Text & MatLib.PrintMat(B) & vbCrLf & vbCrLf
txtDisplay.Text = txtDisplay.Text & "Vector V1 = " & vbCrLf
txtDisplay.Text = txtDisplay.Text & MatLib.PrintMat(V1) & vbCrLf & vbCrLf
txtDisplay.Text = txtDisplay.Text & "Vector V2 = " & vbCrLf
txtDisplay.Text = txtDisplay.Text & MatLib.PrintMat(V2)
End Sub
Private Sub FrmSelect_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FrmSelect.Enter
End Sub
End Class
Tidak ada komentar:
Posting Komentar