MCPcopy
hub / github.com/numpy/numpy / _multi_svd_norm

Function _multi_svd_norm

numpy/linalg/_linalg.py:2566–2591  ·  view source on GitHub ↗

Compute a function of the singular values of the 2-D matrices in `x`. This is a private utility function used by `numpy.linalg.norm()`. Parameters ---------- x : ndarray row_axis, col_axis : int The axes of `x` that hold the 2-D matrices. op : callable This

(x, row_axis, col_axis, op, initial=None)

Source from the content-addressed store, hash-verified

2564
2565
2566def _multi_svd_norm(x, row_axis, col_axis, op, initial=None):
2567 """Compute a function of the singular values of the 2-D matrices in `x`.
2568
2569 This is a private utility function used by `numpy.linalg.norm()`.
2570
2571 Parameters
2572 ----------
2573 x : ndarray
2574 row_axis, col_axis : int
2575 The axes of `x` that hold the 2-D matrices.
2576 op : callable
2577 This should be either numpy.amin or `numpy.amax` or `numpy.sum`.
2578
2579 Returns
2580 -------
2581 result : float or ndarray
2582 If `x` is 2-D, the return values is a float.
2583 Otherwise, it is an array with ``x.ndim - 2`` dimensions.
2584 The return values are either the minimum or maximum or sum of the
2585 singular values of the matrices, depending on whether `op`
2586 is `numpy.amin` or `numpy.amax` or `numpy.sum`.
2587
2588 """
2589 y = moveaxis(x, (row_axis, col_axis), (-2, -1))
2590 result = op(svd(y, compute_uv=False), axis=-1, initial=initial)
2591 return result
2592
2593
2594def _norm_dispatcher(x, ord=None, axis=None, keepdims=None):

Callers 1

normFunction · 0.85

Calls 2

moveaxisFunction · 0.90
svdFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…