Linear algebra (xorbits.numpy.linalg)#
The following table lists both implemented and not implemented methods. If you have need of an operation that is listed as not implemented, feel free to open an issue on the GitHub repository, or give a thumbs up to already created issues. Contributions are also welcome!
The following table is structured as follows: The first column contains the method name.
The second column contains link to a description of corresponding numpy method.
The third column is a flag for whether or not there is an implementation in Xorbits
for the method in the left column. Y stands for yes, N stands for no, P standsfor partial
(meaning some parameters may not be supported yet), and D stands for default to numpy.
The NumPy linear algebra functions rely on BLAS and LAPACK to provide efficient low level implementations of standard linear algebra algorithms. Those libraries may be provided by NumPy itself using C versions of a subset of their reference implementations but, when possible, highly optimized libraries that take advantage of specialized processor functionality are preferred. Examples of such libraries are OpenBLAS, MKL (TM), and ATLAS. Because those libraries are multithreaded and processor dependent, environmental variables and external packages such as threadpoolctl may be needed to control the number of threads or specify the processor architecture.
The SciPy library also contains a ~scipy.linalg submodule, and there is overlap in the functionality provided by the SciPy and NumPy submodules. SciPy contains functions not found in xorbits.numpy.linalg, such as functions related to LU decomposition and the Schur decomposition, multiple ways of calculating the pseudoinverse, and matrix transcendentals such as the matrix logarithm. Some functions that exist in both have augmented functionality in scipy.linalg. For example, scipy.linalg.eig can take a second matrix argument for solving generalized eigenvalue problems. Some functions in NumPy, however, have more flexible broadcasting options. For example, xorbits.numpy.linalg.solve can handle “stacked” arrays, while scipy.linalg.solve accepts only a single square array as its first argument.
Note
The term matrix as it is used on this page indicates a 2d xorbits.numpy.array object, and not a xorbits.numpy.matrix object. The latter is no longer recommended, even for linear algebra. See the matrix object documentation for more information.
The @ operator#
Introduced in NumPy 1.10.0, the @ operator is preferable to
other methods when computing the matrix product between 2d arrays. The
xorbits.numpy.matmul() function implements the @ operator.
Matrix and vector products#
|
|
Implemented? (Y/N/P/D) |
Notes for Current implementation |
|
Y |
||
|
Y |
||
|
Y |
||
|
Y |
||
|
Y |
||
|
Y |
||
|
Y |
||
|
Y |
||
|
Y |
||
|
Y |
||
|
Y |
Decompositions#
|
|
Implemented? (Y/N/P/D) |
Notes for Current implementation |
|
Y |
||
|
Y |
||
|
Y |
Matrix eigenvalues#
|
|
Implemented? (Y/N/P/D) |
Notes for Current implementation |
|
Y |
||
|
Y |
||
|
Y |
||
|
Y |
Norms and other numbers#
|
|
Implemented? (Y/N/P/D) |
Notes for Current implementation |
|
Y |
||
|
Y |
||
|
Y |
||
|
Y |
||
|
Y |
||
|
Y |
Solving equations and inverting matrices#
|
|
Implemented? (Y/N/P/D) |
Notes for Current implementation |
|
Y |
||
|
Y |
||
|
Y |
||
|
Y |
||
|
Y |
||
|
Y |
Exceptions#
|
|
Implemented? (Y/N/P/D) |
Notes for Current implementation |
|
Y |
Linear algebra on several matrices at once#
Added in version 1.8.0.
Several of the linear algebra routines listed above are able to compute results for several matrices at once, if they are stacked into the same array.
This is indicated in the documentation via input parameter
specifications such as a : (..., M, M) array_like. This means that
if for instance given an input array a.shape == (N, M, M), it is
interpreted as a “stack” of N matrices, each of size M-by-M. Similar
specification applies to return values, for instance the determinant
has det : (...) and will in this case return an array of shape
det(a).shape == (N,). This generalizes to linear algebra
operations on higher-dimensional arrays: the last 1 or 2 dimensions of
a multidimensional array are interpreted as vectors or matrices, as
appropriate for each operation.