Matrix
Manipulate matrices efficiently for linear transformations.
Matrix functions are essential for handling multidimensional data structures and linear transformations. Calcul.io includes functions for matrix addition, multiplication, inversion, determinant calculation, and eigenvalue computation. These functions are fundamental in fields like physics, computer graphics, and data analysis.
Our matrix functions provide robust tools for manipulating matrices of various sizes and types. Whether you are solving systems of linear equations, performing image transformations, or conducting numerical simulations, Calcul.io offers the matrix operations necessary to achieve accurate and efficient results in your matrix-related computations.
column | Return a column from a matrix or array. |
concat | Concatenate matrices. By default, the matrices are concatenated by the last dimension. The dimension on which to concatenate can be provided as last argument. |
count | Count the number of elements of a matrix, array or string. |
cross | Calculate the cross product for two vectors in three dimensional space. |
ctranspose | Complex Conjugate and Transpose a matrix |
det | Calculate the determinant of a matrix |
diag | Create a diagonal matrix or retrieve the diagonal of a matrix. When x is a vector, a matrix with the vector values on the diagonal will be returned. When x is a matrix, a vector with the diagonal values of the matrix is returned. When k is provided, the k-th diagonal will be filled in or retrieved, if k is positive, the values are placed on the super diagonal. When k is negative, the values are placed on the sub diagonal. |
diff | Create a new matrix or array with the difference of the passed matrix or array. Dim parameter is optional and used to indicant the dimension of the array/matrix to apply the difference If no dimension parameter is passed it is assumed as dimension 0 Dimension is zero-based in javascript and one-based in the parser Arrays must be 'rectangular' meaning arrays like [1, 2] If something is passed as a matrix it will be returned as a matrix but other than that all matrices are converted to arrays |
dot | Calculate the dot product of two vectors. The dot product of A = [a1, a2, a3, ..., an] and B = [b1, b2, b3, ..., bn] is defined as dot(A, B) = a1 * b1 + a2 * b2 + a3 * b3 + ... + an * bn |
eigs | Calculate the eigenvalues and optionally eigenvectors of a square matrix |
fft | Calculate N-dimensional fourier transform |
filter | Filter items in a matrix. |
flatten | Flatten a multi dimensional matrix into a single dimensional matrix. |
forEach | Iterates over all elements of a matrix/array, and executes the given callback function. |
getMatrixDataType | Find the data type of all elements in a matrix or array, for example "number" if all items are a number and "Complex" if all values are complex numbers. If a matrix contains more than one data type, it will return "mixed". |
identity | Returns the identity matrix with size m-by-n. The matrix has ones on the diagonal and zeros elsewhere. |
ifft | Calculate N-dimensional inverse fourier transform |
inv | Calculate the inverse of a matrix |
kron | Calculates the kronecker product of 2 matrices or vectors. |
map | Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array. |
matrixFromColumns | Create a dense matrix from vectors as individual columns. |
matrixFromFunction | Create a matrix by evaluating a generating function at each index. |
matrixFromRows | Create a dense matrix from vectors as individual rows. |
ones | Create a matrix containing ones. |
partitionSelect | Partition-based selection of an array or 1D matrix. Will find the kth smallest value, and mutates the input array. Uses Quickselect. |
pinv | Calculate the Moore–Penrose inverse of a matrix |
reshape | Reshape a multi dimensional array to fit the specified dimensions. |
resize | Resize a matrix. |
rotate | Returns a 2-D rotation matrix (2x2) for a given angle (in radians). Returns a 2-D rotation matrix (3x3) of a given angle (in radians) around given axis. |
rotationMatrix | Returns a 2-D rotation matrix (2x2) for a given angle (in radians). Returns a 2-D rotation matrix (3x3) of a given angle (in radians) around given axis. |
row | Return a row from a matrix or array. |
size | Calculate the size of a matrix. |
sort | Sort the items in a matrix. Compare can be a string "asc", "desc", "natural", or a custom sort function. |
squeeze | Remove inner and outer singleton dimensions from a matrix. |
subset | Get or set a subset of the entries of a matrix or characters of a string. Indexes are one-based. There should be one index specification for each dimension of the target. Each specification can be a single index, a list of indices, or a range in colon notation `l:u`. In a range, both the lower bound l and upper bound u are included; and if a bound is omitted it defaults to the most extreme valid value. The cartesian product of the indices specified in each dimension determines the target of the operation. |
trace | Calculate the trace of a matrix: the sum of the elements on the main diagonal of a square matrix. |
transpose | Transpose a matrix |
zeros | Create a matrix containing zeros. |