MIT App Inventor Matrix Blocks

create a matrix

Creates a 2x2 matrix initialized with cell values of 0. Dimensions and cell values can be mutated.

create multidimensional matrix

Creates a multidimensional matrix initialized with cell values of 0. Dimensions and cell values can be mutated.

get matrix cell

Returns the cell value at the specified dimensions in the given matrix.

set matrix cell

Changes the cell value at the specified dimensions in the given matrix. The previous cell value at that position is removed.

get matrix row

Returns the row of the given row index in the given matrix.

get matrix column

Returns the column of the given column index in the given matrix.

get matrix dimensions

Returns the dimensions of the given matrix as a list. The length of the list is equal to the number of dimensions in the matrix, and each element in the list is equal to the size of that dimension.

matrix +

Returns the result of adding two matrices together. The two matrices must have equal dimensions.

matrix -

Returns the result of subtracting one matrix from another matrix. The two matrices must have equal dimensions.

matrix *

Returns the result of multiplying either two matrices together or a matrix with a scalar. In the case of two matrices, they must have matching inner dimensions (e.g. the column of the first matrix must equal the row of the second matrix).

matrix ^

Returns the result of raising a matrix to the power of a scalar. The matrix must be a square matrix and the scalar must be nonnegative.

matrix inverse

Returns the inverse of the given matrix.

matrix transpose

Returns the transpose of the given matrix.

matrix rotate left

Returns the left rotation of the matrix (90 degrees counterclockwise).

matrix rotate right

Returns the right rotation of the matrix (90 degrees clockwise).

is a matrix?

Returns true if the given input is a matrix, and false otherwise.