xtensor.linalg
– Linear algebra operations#
- pytensor.xtensor.linalg.cholesky(x, lower=True, *, check_finite=False, on_error='raise', 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, optional) – Whether to check that the input is finite. Default is False.
on_error ({'raise', 'nan'}, optional) – What to do if the input is not positive definite. If ‘raise’, an error is raised. If ‘nan’, the output will contain NaNs. Default is ‘raise’.
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=False)[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 inb
. If length is 3, we are solving a matrix-matrix equation, and two dimensions should be present ina
, two inb
, 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 ifassume_a
is “sym”, “her”, or “pos”.check_finite (bool, optional) – Whether to check that the input is finite. Default is False.