Methods

(static) bitset(value, position, bit) → {Array.<Array.<number>>}

Set bit at specific location

Parameters:
NameTypeDescription
valueArray.<number>

Input value, specified as an scalar.

positionnumber

Bit position, specified as an integer.

bit0 | 1

Bit value, specified as a integer.

Returns:

'value' with 'position' bit set to the value of 'bit'.

Type: 
Array.<Array.<number>>

(static) det(array) → {number}

Matrix determinant

Parameters:
NameTypeDescription
arrayArray.<Array.<number>>

Input matrix, specified as a square numeric matrix.

Returns:

the determinant of square matrix.

Type: 
number

(static) diag(values) → {Array.<Array.<number>>}

Create diagonal matrix or get diagonal elements of matrix

Parameters:
NameTypeDescription
valuesArray.<Array.<number>>

Diagonal elements, specified as a vector.

Returns:

a square diagonal matrix with the elements of vector v on the main diagonal.

Type: 
Array.<Array.<number>>

(static) find(array) → {Array.<number>}

Find indices and values of nonzero elements

Parameters:
NameTypeDescription
arrayArray.<any>

Input array, specified as a scalar, vector, matrix, or multidimensional array.

Returns:

a vector containing the linear indices of each nonzero element in array X.

Type: 
Array.<number>

(static) flip(array, n) → {Array.<any>}

Flip order of elements CAUTION: This function modifies the original array.

Parameters:
NameTypeDescription
arrayArray.<any>

Input array, specified as a vector, matrix, or multidimensional array.

nnumber

Dimension to operate along, specified as a positive integer scalar.

Returns:

array with the same size as input, but with the order of the elements at n-th dimension reversed.

Type: 
Array.<any>

(static) inv(matrix) → {Array.<Array.<number>>}

Matrix inverse

Parameters:
NameTypeDescription
matrixArray.<Array.<number>>

Input matrix, specified as a square matrix.

Returns:

inverse of input matrix.

Type: 
Array.<Array.<number>>

(static) isequal(array1, array2) → {boolean}

Determine array equality

Parameters:
NameTypeDescription
array1Array.<any>

Input to be compared

array2Array.<any>

Input to be compared

Returns:

true if array1 and array2 are equivalent; otherwise, it returns false.

Type: 
boolean

(static) isnumeric(value) → {boolean}

Determine whether input is numeric array

Parameters:
NameTypeDescription
valueany | Array.<any>

Input array or value

Returns:

true if A is an array of numeric data type. Otherwise, it returns false.

Type: 
boolean

(static) ndims(array) → {Array.<number>}

Number of array dimensions

Parameters:
NameTypeDescription
arrayArray.<any>

Input array, specified as a scalar, a vector, a matrix, or a multidimensional array.

Returns:

the number of dimensions in the input array. The number of dimensions is always greater than or equal to 2.

Type: 
Array.<number>

(static) permute(array, order) → {Array.<any>}

Permute array dimentions

Parameters:
NameTypeDescription
arrayArray.<any>

Input array, specified as a vector, matrix, or multidimensional array.

orderArray.<number>

Dimension order, specified as a row vector with unique, positive integer elements that represent the dimensions of the input array.

Returns:

Input array with the dimensions rearranged in the order specified by the vector dimorder. For example, permute(A,[1,0]) switches the row and column dimensions of a matrix A. In general, the ith dimension of the output array is the dimension dimorder(i) from the input array.

Type: 
Array.<any>

(static) prod(array) → {number}

Product of array elements

Parameters:
NameTypeDescription
arrayArray.<number>

Input array, specified as a one dimensional array.

Returns:

product of the array elements of input.

Type: 
number

(static) reshape(array, sizes) → {Array.<Object>}

Reshape array by rearranging existing elements

Parameters:
NameTypeDescription
arrayArray.<any>

Input array, specified as a vector, matrix, or multidimensional array.

sizesArray.<number>

Output size, specified as a row vector of integers. Each element of sizes indicates the size of the corresponding dimension in output. You must specify the size so that the number of elements in input array and output array are the same. That is, prod(sizes) must be the same as number_of_elements(input).

Throws:

If number of elements changes after changing the transition.

Type
Error
Returns:

Reshaped array, returned as a vector, matrix, multidimensional array. The data type and number of elements in output are the same as the data type and number of elements in input.

Type: 
Array.<Object>

(static) size(array) → {Array.<number>}

Array size

Parameters:
NameTypeDescription
arrayArray.<any>

Input array, specified as a scalar, a vector, a matrix, or a multidimensional array.

Returns:

a row vector whose elements are the lengths of the corresponding dimensions of input.

Type: 
Array.<number>

(static) sub2ind(sizes, …subs) → {number}

Convert subscripts to linear indices

Parameters:
NameTypeAttributesDescription
sizesArray.<number>

Size of array, specified as a vector of positive integers. Each element of this vector indicates the size of the corresponding dimension.

subsnumber<repeatable>

Multidimensional subscripts, specified in scalars.

Throws:

If number of subscripts does not match number of dimensions or subscript is out of bounds.

Type
Error
Returns:

Linear index, returned as a scalar

Type: 
number

(static) transpose(arr) → {Array.<Array.<any>>}

Transpose vector or matrix

Parameters:
NameTypeDescription
arrArray.<Array.<any>>

Input array, specified as a vector or matrix.

Returns:

the nonconjugate transpose of input array, that is, interchanges the row and column index for each element.

Type: 
Array.<Array.<any>>

(static) unique(array) → {Array.<any>}

Given an array, return an array that does not contain any duplicates Only tested with single dimensional array

Parameters:
NameTypeDescription
arrayArray.<any>

Input array

Returns:

Array with the same data as in A, but with no repetitions.

Type: 
Array.<any>