WIP. Norm cleanup.#5545
Conversation
|
I actually like having p-norms that are not true vector norms. There are actually genuine use cases for |
|
@jiahao +1 We all know that these are no "true" norms but in the CS field they are used a lot. This is programming. Every true mathematician has serious problems with statements like |
|
No problem. I had to introduce some promotion for handling negative I have updated the pull request with the changes. |
There was a problem hiding this comment.
This should be BLAS.asum(n, x, stride(x, 1)). As it now accepts strided vector, the stride may not always be 1.
This alsp applies to BLAS.nrm2 below.
There was a problem hiding this comment.
A test case should be added to ensure it works for sub(x, 1:2:n).
There was a problem hiding this comment.
@lindahua Thanks. I forgot the BLAS allows that.
I'll add some tests for the norms. Actually there are no specific tests for norm at all. Much testing is still needed for SubArrays in the BLAS and LAPACK code as the stride is not always calculated correct. I guess it hasn't been a problem because sub has been so slow, but this will probably change when people start to use fast views.
|
Please ignore the QR commits. They have their own PR. I had to rebase on that branch to get the new promotion rules I made there. I have added tests for the norm function and it revealed that the 1 norm was not a norm for |
|
This one is ready for review. @StefanKarpinski I have tried to measure the cost of using |
|
So |
|
No |
|
So they would differ for a vector |
|
Everything else looks good. |
|
looks ready to merge. |
|
Code review on an empty stomach is clearly not my specialty. |
Devectorize norm calculation and avoid code dublication. Remove negative infinity norm because it violates the triangle inequality.