MCPcopy Create free account
hub / github.com/numpy/numpy / cholesky

Function cholesky

numpy/array_api/linalg.py:45–61  ·  view source on GitHub ↗

Array API compatible wrapper for :py:func:`np.linalg.cholesky `. See its docstring for more information.

(x: Array, /, *, upper: bool = False)

Source from the content-addressed store, hash-verified

43# Note: the inclusion of the upper keyword is different from
44# np.linalg.cholesky, which does not have it.
45def cholesky(x: Array, /, *, upper: bool = False) -> Array:
46 """
47 Array API compatible wrapper for :py:func:`np.linalg.cholesky <numpy.linalg.cholesky>`.
48
49 See its docstring for more information.
50 """
51 # Note: the restriction to floating-point dtypes only is different from
52 # np.linalg.cholesky.
53 if x.dtype not in _floating_dtypes:
54 raise TypeError('Only floating-point dtypes are allowed in cholesky')
55 L = np.linalg.cholesky(x._array)
56 if upper:
57 U = Array._new(L).mT
58 if U.dtype in [complex64, complex128]:
59 U = conj(U)
60 return U
61 return Array._new(L)
62
63# Note: cross is the numpy top-level namespace, not np.linalg
64def cross(x1: Array, x2: Array, /, *, axis: int = -1) -> Array:

Callers

nothing calls this directly

Calls 2

conjFunction · 0.85
_newMethod · 0.80

Tested by

no test coverage detected