Note
This module is not imported by default. You need to import it to use it.
Allocates a square matrix with the given vector as its diagonal.
Matrix determinant Input should be a square matrix
Compute the eigenvalues and right eigenvectors of a square array.
Return the eigenvalues and eigenvectors of a Hermitian or symmetric matrix.
The gradient function should return
where [,
] corresponds to g_outputs,
to inputs, and
.
Analytic formulae for eigensystem gradients are well-known in perturbation theory:
Gradient of an eigensystem of a Hermitian matrix.
Implements the “reverse-mode” gradient for the eigensystem of a square matrix.
Return the diagonal of a matrix.
Note: | work on the GPU. |
---|
For some reason numpy.diag(x) is really slow, so we implemented our own.
Computes the inverse of a matrix .
Given a square matrix , matrix_inverse returns a square
matrix
such that the dot product
and
equals the identity matrix
.
Note: | When possible, the call to this op will be optimized to the call of solve. |
---|
The gradient function should return
where corresponds to g_outputs and
to
inputs. Using the matrix cookbook,
once can deduce that the relation corresponds to
The gradient function should return
where corresponds to g_outputs and
to
inputs. Using the matrix cookbook,
once can deduce that the relation corresponds to
Computes the pseudo-inverse of a matrix .
The pseudo-inverse of a matrix A, denoted , is
defined as: “the matrix that ‘solves’ [the least-squares problem]
,” i.e., if
is said solution, then
is that matrix such that
.
Note that , so
is close to the identity matrix.
This method is not faster then matrix_inverse. Its strength comes from
that it works for non-square matrices.
If you have a square matrix though, matrix_inverse can be both more
exact and faster to compute. Also this op does not get optimized into a
solve op.
Full QR Decomposition. Computes the QR decomposition of a matrix. Factor the matrix a as qr, where q is orthonormal and r is upper-triangular.
Incomplete QR Decomposition. Computes the QR decomposition of a matrix. Factor the matrix a as qr and return a single matrix.
Numpy-compatibility method If x is a matrix, return its diagonal. If x is a vector return a matrix with it as its diagonal.
Shorthand for product between several dots
Given matrices
, matrix_dot will
generate the matrix product between all in the given order, namely
.
Computes the QR decomposition of a matrix. Factor the matrix a as qr, where q is orthonormal and r is upper-triangular.
Parameters: |
|
||
---|---|---|---|
Rtype q: | matrix of float or complex, optional |
||
Return q: | A matrix with orthonormal columns. When mode = ‘complete’ the result is an orthogonal/unitary matrix depending on whether or not a is real/complex. The determinant may be either +/- 1 in that case. |
||
Rtype r: | matrix of float or complex, optional |
||
Return r: | The upper-triangular matrix. |
This function performs the SVD on CPU.
Parameters: |
|
---|---|
Returns: | U, V and D matrices. |
Returns the sum of diagonal elements of matrix X.
Note: | work on GPU since 0.6rc4. |
---|