matrixMultiply: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 13: Line 13:
____________________________________________________________________________________________
____________________________________________________________________________________________


| Resulting matrix of matrix multiplication{{wip}} |Description=
| Resulting matrix of matrix multiplication.<br>First matrix must be of size N✕K, while the second must be of size K✕M.<br> If the shapes do not match, [] will be it returned.|Description=
____________________________________________________________________________________________
____________________________________________________________________________________________


Line 26: Line 26:


|x1= <code>[[2],[2]] [[matrixMultiply]] [ [3] ]//Returns [[6],[6]]</code> |Example 1=
|x1= <code>[[2],[2]] [[matrixMultiply]] [ [3] ]//Returns [[6],[6]]</code> |Example 1=
|x2= <code>[[-1,0,0], [0,-1,0], [0,0,-1]] [[matrixMultiply]] [[1,2,3], [3,1,2], [2,3,1]] //Returns [[-1,-2,-3], [-3,-1,-2], [-2,-3,-1]]</code> |Example 2=
____________________________________________________________________________________________
____________________________________________________________________________________________


Line 35: Line 36:
<dl class="command_description">
<dl class="command_description">
<!-- BEGIN Note Section -->
<!-- BEGIN Note Section -->
<!-- For example:
<dd class="notedate">Posted on 30 Jun, 2019
<dd class="notedate">Posted on Month Day, Year - Time (UTC)</dd>
<dt class="note">'''[[User:oOKexOo| oOKexOo]]'''<dd class="note">
<dt class="note">'''[[User:User Name|User Name]]'''</dt>
Note that this command won't transform a row vector automatically into a column vector
<dd class="note">This is an example note. It is true and verifiable, and contains a little code snippet.
<code>
<code>[[if]] ([[_this]] == anExample) [[then]] { [[hint]] "Leave it here for others to read"; };</code></dd>
[[-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]] &#91;[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]]
</code>
<!-- END Note Section -->
<!-- END Note Section -->
</dl>
</dl>

Revision as of 02:53, 30 June 2019

Hover & click on the images for description

Description

Description:
Resulting matrix of matrix multiplication.
First matrix must be of size N✕K, while the second must be of size K✕M.
If the shapes do not match, [] will be it returned.
Multiplayer:
-
Groups:
Uncategorised

Syntax

Syntax:
matrix1 matrixMultiply matrix2
Parameters:
matrix1: Array
matrix2: Array
Return Value:
Array

Examples

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

Additional Information

See also:
See also needed

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 row vector 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]]

Bottom Section