Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undeprecate normfro #7990

Closed
wants to merge 1 commit into from
Closed

Undeprecate normfro #7990

wants to merge 1 commit into from

Conversation

andreasnoack
Copy link
Member

Cf. Alan's comment, #6057 (comment), to which I agree. See also the list.

@StefanKarpinski
Copy link
Member

I appreciate that this is both a vector norm and a matrix norm but I don't see the pressing need to export another function from Base that has a strict subset of the functionality of another function that's already exported. If we're going to have this it needs to offer something that isn't just as easy to do with vecnorm, IMO.

@andreasnoack
Copy link
Member Author

My conjecture is that in most cases where you use vecnorm, you use it for calculating the Forbenius norm. The functionality of vecnorm is more general, but the name is misleading for the general use case.

@jiahao
Copy link
Member

jiahao commented Aug 17, 2014

The name vecnorm bothers me too. The name is clearly a contraction of "vector norm" and carries the presumption that this is the unique generalization of vector norms beyond rank 1. However, it is not. Two of the most common generalizations to rank 2 are

  1. the induced norm/operator norm computed by norm(A), and
  2. the norm currently computed by vecnorm, which doesn't really have a standardized name. Sometimes it is called the elementwise norm because it is nominally defined as some explicit summation over matrix elements. A better way to think about it IMO is that it is the norm you get by slicing A recursively until each slice is of rank 1 and then computes some vector norm over it, building back up vectors of the rank-1 norms and recomputing norms of the resulting vector, and so on. The Frobenius norm is then simply the special case of computing the 2-norm at each reduction step.

A simple example:

julia> A=[1 2; 3 4]; norm([norm(A[:,i], 2) for i in 1:size(A,2)], 2)==vecnorm(A)==sqrt(30)
true

(the latter norm generalizes naturally:

  • the elementwise Lp,q norm which is what you'd get by replacing the 2s in the code to other numbers. (Frobenius is p=q=2; Wikipedia suggests that L21 shows up in compressed sensing applications.)
  • to arbitrary rank by specifying a different p-norm at each rank reduction step)

vecnorm should be renamed. Perhaps normfro is a better name, but it may not immediately clear that the Frobenius norm (or its p-generalization) is the correct solution to one of the problems brought up in the original thread leading to #6057 about computing norms of 1xN matrices by interpreting them as row vectors .

@StefanKarpinski
Copy link
Member

I think it's called that because vecnorm(a) = norm(vec(a)).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants