Jump to content

Matrix multiplication: Difference between revisions

m
Line 669:
===Using Objects===
<lang AutoHotkey>Multiply_Matrix(A,B){
if (A[1].MaxIndexCount() <> B.MaxIndexCount())
return ["Dimension Error"]
RColsR := A[1].MaxIndex()>B[1].MaxIndex()?, RRows := A[1].MaxIndexCount(), RCols:B= b[1].MaxIndexCount()
RRows := A.MaxIndex()>B.MaxIndex()?A.MaxIndex():B.MaxIndex(), R := []
Loop, % RRows {
RRow:=A_Index
loop, % RCols {
RCol:=A_Index, v := 0
loop % A[1].MaxIndexCount()
col := A_Index, v += A[RRow, col] * B[col, RCol]
R[RRow,RCol] := v
}
299

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.