xtensor.linalg – Linear algebra operations#

pytensor.xtensor.linalg.cholesky(x, lower=True, *, check_finite=True, dims)[source]#

Compute the Cholesky decomposition of an XTensorVariable.

Parameters:
  • x (XTensorVariable) – The input variable to decompose.

  • lower (bool, optional) – Whether to return the lower triangular matrix. Default is True.

  • check_finite (bool) – Unused by PyTensor. PyTensor will return nan if the operation fails.

  • dims (Sequence[str]) – The two core dimensions of the input variable, over which the Cholesky decomposition is computed.

pytensor.xtensor.linalg.solve(a, b, dims, assume_a='gen', lower=False, check_finite=True)[source]#

Solve a system of linear equations using XTensorVariables.

Parameters:
  • a (XTensorVariable) – The left hand-side xtensor.

  • b (XTensorVariable) – The right-hand side xtensor.

  • dims (Sequence[str]) – The core dimensions over which to solve the linear equations. If length is 2, we are solving a matrix-vector equation, and the two dimensions should be present in a, but only one in b. If length is 3, we are solving a matrix-matrix equation, and two dimensions should be present in a, two in b, and only one should be shared. In both cases the shared dimension will not appear in the output.

  • assume_a (str, optional) – The type of matrix a is assumed to be. Default is ‘gen’ (general). Options are [“gen”, “sym”, “her”, “pos”, “tridiagonal”, “banded”]. Long form options can also be used [“general”, “symmetric”, “hermitian”, “positive_definite”].

  • lower (bool, optional) – Whether a is lower triangular. Default is False. Only relevant if assume_a is “sym”, “her”, or “pos”.

  • check_finite (bool) – Unused by PyTensor. PyTensor will return nan if the operation fails.