Page tree
Skip to end of metadata
Go to start of metadata




Introduced in

Version:2.11

Description

Description:

Multiplies two matrices. A multiplication is only possible, if the number of columns in the first matrix equals the number of rows in the second matrix.

Syntax

Syntax:[matrix1, matrix2] call fn_vbs_matrixMultiply
Parameters:
  • matrix1: Array - Array with n*m elements
  • matrix2: Array - Array with m*p elements
Return Value:Array - Array is empty, if invalid inputs (array has zero dimensions or dimensions do not match).

Warning

When using functions in VBS versions older than 3.4, certain limitations and requirements should be kept in mind - the main ones being that capitalization of the function name is crucial, and that #include "\vbs2\headers\function_library.hpp" has to be included in every script that utilizes it. More Category VBS Scripting Functions.

Examples

Examples:
Matrix1 (1 row, 3 columns) is multiplied by matrix2 (3 rows, 1 column each). The result is [[32]]: 
_return=[ [[1,2,3]], [[4],[5],[6]] ] call fn_vbs_matrixMultiply
Matrix1 (3 rows, 1 column each) is multiplied by matrix2 (1 row, 3 columns). The result is [[4,8,12],[5,10,15],[6,12,18]]: 
_return=[ [[4],[5],[6]], [[1,2,3]] ] call fn_vbs_matrixMultiply

Additional Information

See also: fn vbs rotationMatrix
Multiplayer: 
Problems: 

Notes