Implementation of matrix norm for order greater than 2
See original GitHub issueWhen using numpy.linalg.norm
with ord
different from 2, for example 3, then I expected the norm to be computed according to the documentation, i.e. as sum(abs(x)**ord)**(1./ord)
But instead I got:
ValueError Traceback (most recent call last)
<ipython-input-784-3344f4d8d663> in <module>()
----> 1 nnorm((distpdfs_diverg['BC']/n_samples) - np.eye(n_bundles), 3)
/usr/lib/python3.5/site-packages/numpy/linalg/linalg.py in norm(x, ord, axis, keepdims)
2247 ret = _multi_svd_norm(x, row_axis, col_axis, sum)
2248 else:
-> 2249 raise ValueError("Invalid norm order for matrices.")
2250 if keepdims:
2251 ret_shape = list(x.shape)
ValueError: Invalid norm order for matrices.
Looking at the source code (numpy 1.13, numpy 1.14, and current) it seems it is simply the norm is simply not implemented for ord
greater than 2 contrarily to what the doc says. Would that be something difficult to do?
Issue Analytics
- State:
- Created 6 years ago
- Comments:14 (8 by maintainers)
Top Results From Across the Web
Chapter 4: Matrix Norms
Since the 2-norm used in the majority of applications, we will adopt it as our default. In what follows, an "un-designated" norm A...
Read more >NumPy Norm: Understanding np.linalg.norm()
A norm is a measure of the size of a matrix or vector and you can ... ord=2) does not compute the L2...
Read more >Matrix Norm - an overview | ScienceDirect Topics
Matrix Norm. Matrix norms can be defined based on a set of axioms or properties. From: Digital Control Engineering (Second Edition), 2013 ...
Read more >Chapter 4 Vector Norms and Matrix Norms - UPenn CIS
In order to define how close two vectors or two matrices are, and in order to ... Example 4.1. ... More generally, we...
Read more >Matrix norm - Wikipedia
In mathematics, a matrix norm is a vector norm in a vector space whose elements (vectors) are matrices (of given dimensions).
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yes,
ord=(p, q)
could also be possible. The implementation is in principle one-liner.This is as documented:
Note the column for matrices is blank