Skip to content

Manipulations

Matrix and vector manipulations

These are methods for basic matrix operations: filling, copying, getting a part of a matrix, transposing, splitting and sorting.

There are also several methods for operations with matrix rows and columns.

FunctionAction
HasNanReturn the number of NaN values in a matrix/vector
TransposeReverse or permute the axes of a matrix; returns the modified matrix
TransposeConjugateTransposing a complex matrix with conjugation. Reverse or permute the axes of a matrix by changing a sign of an imaginary part of a complex number, return the modified matrix
TriLReturn a copy of a matrix with elements above the k-th diagonal zeroed. Lower triangular matrix
TriUReturn a copy of a matrix with elements below the k-th diagonal zeroed. Upper triangular matrix
DiagExtract a diagonal or construct a diagonal matrix
RowReturn a row vector. Write a vector to the specified row
ColReturn a column vector. Write a vector to the specified column
CopyReturn a copy of the given matrix/vector
ConcatConcatenate 2 submatrices to one matrix. Concatenate 2 vectors to one vector
CompareCompare the elements of two matrices/vectors with the specified precision
CompareByDigitsCompare the elements of two matrices/vectors up to significant digits
CompareEqualPerform an absolute comparison of two matrices by unfolding successive rows into one-dimensional vectors
FlatAllows addressing a matrix element through one index instead of two
ClipLimit the elements of a matrix/vector to a specified range of valid values
ReshapeChange the shape of a matrix without changing its data
ResizeReturn a new matrix with a changed shape and size
SwapRowsSwap rows in a matrix
SwapColsSwap columns in a matrix
SplitSplit a matrix into multiple submatrices
HsplitSplit a matrix horizontally into multiple submatrices. Same as Split with axis=0
VsplitSplit a matrix vertically into multiple submatrices. Same as Split with axis=1
ArgSortIndirectly sort a matrix or vector.
SortSort a matrix or vector in place.
Last updated on