View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rowan Drummond[_3_] Rowan Drummond[_3_] is offline
external usenet poster
 
Posts: 414
Default Matrix Operations in VBA

For the MInverse try:

Dim vMtxA As Range, vMtxB As Variant
Set vMtxA = Range("B4:E7")
vMtxB = Application.WorksheetFunction.MInverse(vMtxA)
MsgBox vMtxB(1, 1)

Hope this helps
Rowan

wrote:
I would like to take the inverse of a matrix within my VBA code as part
of a sequence of operations. Something like the following:

Dim vMtxA As Variant, vMtxB As Variant, vMtxC() As Variant

vMtxA = Range("B4:E7")
vMtxB = Application.MInverse(vMtxA)

OR

ReDim vMtxC(4,4)

vMtxC = Application.MInverse(vMtxA)


I have not been able to find a way to do this. I would then multiply
the inverse by a RHS vector to get a solution vector that would be used
in subsequent calculations using MMult, etc. Also I have not figgured
out how to add two variant arrays??

vMtxD = vMtxA + vMtxB