tensor.slinalg
– Linear Algebra Ops Using Scipy¶
Note
This module is not imported by default. You need to import it to use it.
API¶
-
class
theano.tensor.slinalg.
Cholesky
(lower=True, on_error='raise')[source]¶ Return a triangular matrix square root of positive semi-definite x.
L = cholesky(X, lower=True) implies dot(L, L.T) == X.
Parameters: - lower (bool, default=True) – Whether to return the lower or upper cholesky factor
- on_error (['raise', 'nan']) – If on_error is set to ‘raise’, this Op will raise a scipy.linalg.LinAlgError if the matrix is not positive definite. If on_error is set to ‘nan’, it will return a matrix containing nans instead.
-
L_op
(inputs, outputs, gradients)[source]¶ Cholesky decomposition reverse-mode gradient update.
Symbolic expression for reverse-mode Cholesky gradient taken from [1]
References
[1] I. Murray, “Differentiation of the Cholesky decomposition”, http://arxiv.org/abs/1602.07527
-
class
theano.tensor.slinalg.
CholeskyGrad
(lower=True)[source]¶ -
perform
(node, inputs, outputs)[source]¶ Implements the “reverse-mode” gradient [2] for the Cholesky factorization of a positive-definite matrix.
References
[2] S. P. Smith. “Differentiation of the Cholesky Algorithm”. Journal of Computational and Graphical Statistics, Vol. 4, No. 2 (Jun.,1995), pp. 134-147 http://www.jstor.org/stable/1390762
-
-
class
theano.tensor.slinalg.
Eigvalsh
(lower=True)[source]¶ Generalized eigenvalues of a Hermitian positive definite eigensystem.
-
class
theano.tensor.slinalg.
EigvalshGrad
(lower=True)[source]¶ Gradient of generalized eigenvalues of a Hermitian positive definite eigensystem.
-
class
theano.tensor.slinalg.
Solve
(A_structure='general', lower=False, overwrite_A=False, overwrite_b=False)[source]¶ Solve a system of linear equations.
For on CPU and GPU.
-
L_op
(inputs, outputs, output_gradients)[source]¶ Reverse-mode gradient updates for matrix solve operation c = A \ b.
Symbolic expression for updates taken from [3].
References
[3] M. B. Giles, “An extended collection of matrix derivative results for forward and reverse mode automatic differentiation”, http://eprints.maths.ox.ac.uk/1079/
-
-
theano.tensor.slinalg.
kron
(a, b)[source]¶ Kronecker product.
Same as scipy.linalg.kron(a, b).
Parameters: - a (array_like) –
- b (array_like) –
Returns: Return type: array_like with a.ndim + b.ndim - 2 dimensions
Notes
numpy.kron(a, b) != scipy.linalg.kron(a, b)! They don’t have the same shape and order when a.ndim != b.ndim != 2.
-
theano.tensor.slinalg.
solve_symmetric
= Solve{('symmetric', False, False, False)}[source]¶ Optimized implementation of
theano.tensor.slinalg.solve()
when A is symmetric.
-
theano.tensor.slinalg.
solve
(a, b)[source]¶ Solves the equation
a x = b
for x, wherea
is a matrix andb
can be either a vector or a matrix.Note
Parameters: - a ((M, M) symbolix matrix) – A square matrix
- b ((M,) or (M, N) symbolic vector or matrix) – Right hand side matrix in
a x = b
Returns: x – x will have the same shape as b
Return type: (M, ) or (M, N) symbolic vector or matrix
-
theano.tensor.slinalg.
solve_lower_triangular
(a, b)[source]¶ Optimized implementation of
theano.tensor.slinalg.solve()
when A is lower triangular.
-
theano.tensor.slinalg.
solve_upper_triangular
(a, b)[source]¶ Optimized implementation of
theano.tensor.slinalg.solve()
when A is upper triangular.