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

Function diagonal

numpy/array_api/linalg.py:95–103  ·  view source on GitHub ↗

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

(x: Array, /, *, offset: int = 0)

Source from the content-addressed store, hash-verified

93
94# Note: diagonal is the numpy top-level namespace, not np.linalg
95def diagonal(x: Array, /, *, offset: int = 0) -> Array:
96 """
97 Array API compatible wrapper for :py:func:`np.diagonal <numpy.diagonal>`.
98
99 See its docstring for more information.
100 """
101 # Note: diagonal always operates on the last two axes, whereas np.diagonal
102 # operates on the first two axes by default
103 return Array._new(np.diagonal(x._array, offset=offset, axis1=-2, axis2=-1))
104
105
106def eigh(x: Array, /) -> EighResult:

Callers

nothing calls this directly

Calls 1

_newMethod · 0.80

Tested by

no test coverage detected