Matrix library (numpy.matlib)

This module contains all functions in the numpy namespace, with the following replacement functions that return matricesopen in new window instead of ndarraysopen in new window.

Functions that are also in the numpy namespace and return matrices

methoddescription
matopen in new window(data[, dtype])Interpret the input as a matrixopen in new window.
matrixopen in new window(data[, dtype, copy])Note: It is no longer recommended to use this class, even for linear
asmatrixopen in new window(data[, dtype])Interpret the input as a matrix.
bmatopen in new window(obj[, ldict, gdict])Build a matrix object from a string, nested sequence, or array.

Replacement functions in matlib

methoddescription
emptyopen in new window(shape[, dtype, order])Return a new matrix of given shape and type, without initializing entries.
zerosopen in new window(shape[, dtype, order])Return a matrix of given shape and type, filled with zeros.
onesopen in new window(shape[, dtype, order])Matrix of ones.
eyeopen in new window(n[, M, k, dtype, order])Return a matrix with ones on the diagonal and zeros elsewhere.
identityopen in new window(n[, dtype])Returns the square identity matrix of given size.
repmatopen in new window(a, m, n)Repeat a 0-D to 2-D array or matrix MxN times.
randopen in new window(*args)Return a matrix of random values with given shape.
randnopen in new window(*args)Return a random matrix with data from the “standard normal” distribution.