--- title: Matrix description: "Learn how to build custom functionality when working with the React Spreadsheet by Kendo UI with the help of the Matrix." api_reference: true type: inner_api slug: api_spreadsheet_matrix --- # Matrix The "matrix" type which can be used in the custom JavaScript functions (primitives) in formulas.
Name Type Default Description
#### height number Indicate the height of the matrix.
#### width number Indicate the width of the matrix.
## Constructors ### Matrix (context: [Context]({% slug api_spreadsheet_context %})) #### Parameters ##### context [Context]({% slug api_spreadsheet_context %}) ## Methods
#### clone
Returns a new matrix with the same data.
Returns
[Matrix]({% slug api_spreadsheet_matrix %})
#### determinant
Returns the determinant of this matrix. The matrix should contain only numbers and be square. Note that there are no checks for this.
Returns
number
#### each
Iterates through elements of the matrix and calling the `func` for each element (first columns, then rows).
Parameters
func (value: any, row: number, column: number) => void The function which will be called for each element.
includeEmpty boolean If `true`, it will call the function for empty (`null`) elements as well. Otherwise, it only calls it where a value exists.
#### get
Returns the element at a given location.
Parameters
row number
col number
Returns
any
#### inverse
Returns the inverse of this matrix. The matrix should contain only numbers and be square. Note that there are no checks for this. If the inverse does not exist, the determinant is zero, then it returns `null`.
Returns
"null" | [Matrix]({% slug api_spreadsheet_matrix %})
#### map
Similar to `each`, but produces a new matrix of the same shape as the original one with the values returned by the function.
Parameters
func (value: any, row: number, column: number) => void The function which will be called for each element.
includeEmpty boolean If `true`, it will call the function for empty (`null`) elements as well. Otherwise, it only calls it where a value exists.
Returns
[Matrix]({% slug api_spreadsheet_matrix %})
#### multiply
Multiplies the current matrix by the given matrix, and returns a new matrix as the result.
Parameters
m [Matrix]({% slug api_spreadsheet_matrix %})
Returns
[Matrix]({% slug api_spreadsheet_matrix %})
#### set
Sets the element at a given location.
Parameters
row number
col number
value any
#### transpose
Returns the transposed matrix. The rows of the original matrix become columns of the transposed one.
Returns
[Matrix]({% slug api_spreadsheet_matrix %})
#### unit
Returns the unit square matrix of size `n`.
Parameters
n number
Returns
[Matrix]({% slug api_spreadsheet_matrix %})