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)[source]

Return a triangular matrix square root of positive semi-definite x.

L = cholesky(X, lower=True) implies dot(L, L.T) == X.

grad(inputs, gradients)[source]

Cholesky decomposition reverse-mode gradient update.

Symbolic expression for reverse-mode Cholesky gradient taken from [0]

References

[0]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 [1] for the Cholesky factorization of a positive-definite matrix.

References

[1](1, 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.Expm[source]

Compute the matrix exponential of a square array.

class theano.tensor.slinalg.ExpmGrad[source]

Gradient of the matrix exponential of a square array.

class theano.tensor.slinalg.Solve(A_structure='general', lower=False, overwrite_A=False, overwrite_b=False)[source]

Solve a system of linear equations.

grad(inputs, output_gradients)[source]

Reverse-mode gradient updates for matrix solve operation c = A b.

Symbolic expression for updates taken from [1].

References

..[1] 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(a, b)[source]

Solves the equation a x = b for x, where a is a matrix and b 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.