matrixMultiply: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\|(arg|eff|serverExec|mp|seealso)= " to "")
m (Text replacement - "\[https?\:\/\/en\.wikipedia\.org\/wiki\/([^ ]+) (.+)\]" to "{{Wikipedia|$1|$2}}")
Line 8: Line 8:
|gr2= Math - Vectors
|gr2= Math - Vectors


| Returns resulting matrix from the [https://en.wikipedia.org/wiki/Matrix_multiplication multiplication] of two matrices. First matrix must be of the size n ✕ '''k''', while the second must be of the size '''k''' ✕ m, i.e <tt>columns</tt> matrix1 <nowiki>==</nowiki> <tt>rows</tt> matrix2. The resulting matrix will be of the size n ✕ m. If the shapes do not match, empty array [] will be returned.<br><br>
| Returns resulting matrix from the {{Wikipedia|Matrix_multiplication|multiplication}} of two matrices. First matrix must be of the size n ✕ '''k''', while the second must be of the size '''k''' ✕ m, i.e <tt>columns</tt> matrix1 <nowiki>==</nowiki> <tt>rows</tt> matrix2. The resulting matrix will be of the size n ✕ m. If the shapes do not match, empty array [] will be returned.<br><br>
[[Image:matrixMultiply.jpg|600px]]
[[Image:matrixMultiply.jpg|600px]]



Revision as of 16:55, 30 May 2021

Hover & click on the images for description

Description

Description:
Description needed
Groups:
MathMath - Vectors

Syntax

Syntax:
Syntax needed
Parameters:
matrix1: Array - matrix of the size n(rows)k(columns)
matrix2: Array - matrix of the size k(rows)m(columns)
Return Value:
Return value needed

Examples

Example 1:
[ [2], [2] ] matrixMultiply [ [3] ] /* returns [ [6], [6] ] */
Example 2:
[ [-1,0,0], [0,-1,0] ] matrixMultiply [ [1,2], [3,1], [2,3] ] /* returns [ [-1,-2], [-3,-1] ] */

Additional Information

See also:
matrixTransposevectorAddvectorMagnitudevectorNormalizedvectorMultiplyvectorDotProductvectorCrossProductvectorDistancevectorLinearConversionvectorCosvectorFromTovectorModelToWorldvectorWorldToModelBIS_fnc_transformVectorDirAndUp

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
Posted on 30 Jun, 2019
oOKexOo
Note that this command won't transform a 1D array automatically into a column vector [[-1,0,0],[0,-1,0],[0,0,-1]] matrixMultiply [1,2,3] // wrong, syntax error [[-1,0,0],[0,-1,0],[0,0,-1]] matrixMultiply [[1,2,3]] // wrong, will return [] [[-1,0,0],[0,-1,0],[0,0,-1]] matrixMultiply [[1], [2], [3]] // correct, will return [[-1], [-2], [-3]]