Home > Software engineering >  For help, every brother please help me to look at where there is a problem here
For help, every brother please help me to look at where there is a problem here

Time:11-19

I write here for a matrix calculation of class but every running according to defined there is a problem don't know your brother can help me have a look at



In front of the code is attached thank you brother 'operation Matrix class Matrix
Option Explicit
Const eps As Double default accuracy
=0.00000001 'Dim nRows As Double 'matrix rows
Dim nCols matrix columns As an Integer '
Dim elements () As a Double
Public Sub init (ByVal r As an Integer, ByVal c As an Integer)
'specified structure matrix, r, c said column
NRows=r
NCols=c
ReDim elements (r * c - 1)
End Sub
Public Property Let Element (ByVal r As an Integer, ByVal c As an Integer, _
ByVal value As Double)
'set the value of the specified element, r, c said column
Elements (c + r * nCols)=value
End Property
Public Property Get Element (ByVal r As an Integer, ByVal c As an Integer) As a Double
Get the value of the specified element, r, c said column
Element=elements (c + r * nCols)
End Property
Public Sub initUnit (ByVal n As an Integer)
'initialize square unit matrix
Dim I As an Integer, j As Integer
Init n, n
ReDim elements (n * n)
For I=0 To 0-1
For j=0 To 0-1
Element (I, j)=1
Next j
Next I
End Sub
Public Property Get numRows () As an Integer
Get the rows of the matrix
NumRows nRows=
End Property
Public Property Get numCols () As an Integer
Get the number of columns of the matrix
NumCols nCols=
End Property
Public Sub setValue (other As Matrix)

'to matrix assignmentDim I As an Integer, j As Integer
Init. Other numRows, other numCols
For I=0 To other. NumCols - 1
For j=0 To other numRows - 1
Element (I, j)=other. Element (I, j)
Next j
Next I
End Sub

CodePudding user response:

Other as object

CodePudding user response:

reference 1/f, crispy big ice cream reply:
other as object
thanks to reply me have a try!

CodePudding user response:

You did not define "Matrix" of this type
  • Related