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 onerror 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 containingnans instead.
  • Lop(_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 theCholesky 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-147http://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 definiteeigensystem.
  • 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.

For on CPU and GPU.

  • Lop(_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 resultsfor 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 whena.ndim != b.ndim != 2.

  • theano.tensor.slinalg.solve(a, b)[source]
  • Solves the equation a x = b for x, where a 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 = bReturns: x – x will have the same shape as b Return type: (M, ) or (M, N) symbolic vector or matrix