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

Function matrix_norm

numpy/array_api/linalg.py:170–181  ·  view source on GitHub ↗

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

(x: Array, /, *, keepdims: bool = False, ord: Optional[Union[int, float, Literal['fro', 'nuc']]] = 'fro')

Source from the content-addressed store, hash-verified

168# -np.inf, 'fro', 'nuc']]], but Literal does not support floating-point
169# literals.
170def matrix_norm(x: Array, /, *, keepdims: bool = False, ord: Optional[Union[int, float, Literal['fro', 'nuc']]] = 'fro') -> Array:
171 """
172 Array API compatible wrapper for :py:func:`np.linalg.norm <numpy.linalg.norm>`.
173
174 See its docstring for more information.
175 """
176 # Note: the restriction to floating-point dtypes only is different from
177 # np.linalg.norm.
178 if x.dtype not in _floating_dtypes:
179 raise TypeError('Only floating-point dtypes are allowed in matrix_norm')
180
181 return Array._new(np.linalg.norm(x._array, axis=(-2, -1), keepdims=keepdims, ord=ord))
182
183
184def matrix_power(x: Array, n: int, /) -> Array:

Callers

nothing calls this directly

Calls 1

_newMethod · 0.80

Tested by

no test coverage detected