Matrix Operations

Calculator supports Matrix and Range types and allows this methods on matrices: clone, concat, det, diag, eye, inv, ones, size, squeeze, transpose, zeros.



  • matrix(a) - Create a matrix.
  • clone(A) - Clone a variable. Creates a copy of primitive variables,and a deep copy of matrices
  • concat(a,b,...[,dim]) - Concatenate matrices. By default, the matrices are concatenated by the first dimension. The dimension on which to concatenate can be provided as last argument.
  • det(A) - Calculate the determinant of a matrix
  • diag(A) - 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.
  • eye(m,n) - Returns the identity matrix with size m-by-n. The matrix has ones on the diagonal and zeros elsewhere.
  • inv(A) - Calculate the inverse of a matrix
  • ones(n,m) - Create a matrix containing ones.
  • range(n,m[,step]) or n:m - Create a range. Lower bound of the range is included, upper bound is excluded.
  • size(A) - Calculate the size of a matrix.
  • squeeze(A) - Remove singleton dimensions from a matrix.
  • subset(A,index[,replacement]) - Get or set a subset of a matrix or string. Indexes are one-based. Both the ranges lower-bound and upper-bound are included.
  • transpose(A) or A' - Transpose a matrix
  • zeros(m,n) - Create a matrix containing zeros.