-
Notifications
You must be signed in to change notification settings - Fork 173
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
linalg: vector norms #871
linalg: vector norms #871
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-authored-by: Jeremie Vandenplas <[email protected]>
Co-authored-by: Jeremie Vandenplas <[email protected]>
Co-authored-by: Jeremie Vandenplas <[email protected]>
Co-authored-by: Jeremie Vandenplas <[email protected]>
@jvdp1 @jalvesz in 437b96e I've introduced the intrinsic
So, should we introduce the BLAS backend at least for the 1D case evaluation? |
I believe the BLAS API should allow also strided access to array elements, which would support |
- add nonstandard-named `complex` norms to `nrm2` interface - test sliced and reshaped 2-norm
The compiler will create a temporary array passing from So, in the interest of safety, I suggest to avoid inferring strides and rather create the temporary ourselves, i.e. preprocessing it with a |
Co-authored-by: jalvesz <[email protected]>
Co-authored-by: jalvesz <[email protected]>
Co-authored-by: jalvesz <[email protected]>
Co-authored-by: jalvesz <[email protected]>
Co-authored-by: jalvesz <[email protected]>
Co-authored-by: jalvesz <[email protected]>
Co-authored-by: jalvesz <[email protected]>
Co-authored-by: jalvesz <[email protected]>
|
LGTM @perazz! On my end I have no further comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @perazz . This sounds ready to be merged! Nice addition.
Thank you @jvdp1, I'd wait a few more days and then merge in absence of comments, so we can pave the way for the matrix norms. |
Address #820 in joint effort with @jalvesz.$A$ , real or complex, has general rank
Compute several vector norms. Array
n>=1
.Proposed implementation
x = norm(a, order=2 [, dim=dim] [, err=err])
: (pure) function interfacecall get_norm(a, nrm=x, order=2 [, dim=dim] [, err=err])
: pure subroutine interfaceKey facts
The following implementations are provided:
1, '1'
: 1-norm,2, '2', 'Euclidean'
: 2-norm,>=3
: p-norm,'inf', huge(0)
:'-inf', -huge(0)
: minimum norm,order
can either be an integer (1, 2, ..., n, -huge(0), huge(0)
) or a character input ('1', '2', '10', 'inf', '-inf', 'euclidean', ...
)The implementation currently only uses Fortran intrinsics that handle all
dim
cases by default: would be hard to unroll all them to enable calls toBLAS
backends for all ranks 1:15.Progress
pure subroutine
interfaces,pure function
interfaces if no error flag is requested.Prior art
linalg.norm(x, ord=None, axis=None, keepdims=False)
norm(a, ord=None, axis=None, keepdims=False, check_finite=True)
cc: @jvdp1 @jalvesz @loiseaujc