Matrix multiplication of more than 73 X 73 entities in VBA
Here would be the basic approach. You can add more error checking:
Function MyMMULT(rngA As Range, rngB As Range)
Dim ArrC() As Double
If rngA.Rows.Count < rngB.Columns.Count Then
MyMMULT = CVErr(xlErrRef)
Exit Function
End If
ReDim ArrC(1 To rngA.Rows.Count, 1 To rngB.Columns.Count)
For i = 1 To rngA.Rows.Count
For j = 1 To rngB.Columns.Count
For k = 1 To rngA.Columns.Count
ArrC(i, j) = ArrC(i, j) + rngA(i, k) * rngB(k, j)
Next k
Next j
Next i
MyMMULT = ArrC
End Function
--
Regards,
Tom Ogilvy
"Thulasiram" wrote in message
oups.com...
Hello all,
I interpret that Excel can handle matrix multiplication of "maximum" 73
x 73 entities in one sheet with 73 x 73 entities in another sheet. Is
this correct?
If yes, what could be the VBA code to perform matrix multiplication of
on M x N entities in one sheet with N x P entites in another matrix?
(where M, N and P are greater than 73)
Please help.
Thanks,
Thulasiram.
|