Computes the lp norm of a batch of vectors u.
(u, p=2, nx=None)
| 23 | |
| 24 | |
| 25 | def norm_batch(u, p=2, nx=None): |
| 26 | """Computes the lp norm of a batch of vectors u.""" |
| 27 | if nx is None: |
| 28 | nx = get_backend(u) |
| 29 | return nx.sum(u**p, axis=1) ** (1 / p) |
| 30 | |
| 31 | |
| 32 | def bmv(A, b, nx): |
no test coverage detected