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

Level 1 BLAS functions (except for dot) dont handle inputs with negetive stride correctly #884

Closed
N5N3 opened this issue Nov 5, 2021 · 3 comments

Comments

@N5N3
Copy link
Member

N5N3 commented Nov 5, 2021

Similar to JuliaLang/julia#30765.
An eazy example:

julia> a = collect(1.0:5.0)
5-element Vector{Float64}:
 1.0
 2.0
 3.0
 4.0
 5.0

julia> v = view(a, 3:-1:1)
3-element view(::Vector{Float64}, 3:-1:1) with eltype Float64:
 3.0
 2.0
 1.0

julia> BLAS.nrm2(v)
7.0710678118654755

julia> BLAS.nrm2(collect(v))
3.7416573867739413
@oscardssmith
Copy link
Member

is it worth keeping level one blas around? I don't think it's faster than regular broadcasting...

@N5N3
Copy link
Member Author

N5N3 commented Nov 5, 2021

At present, norm(::StridedVector, 1) and norm(::StridedVector, 2) call BLAS.asum and BLAS.nrm2 for long enough inputs (and return wrong result for negetive stride).
So we'd better to ensure correctness?

On the other hand, we have JuliaLang/julia#41513 for gemv, and JuliaLang/julia#39751 for dot.
There seems no reason we dont add negative stride support to other functions, (if they return correct results)

@N5N3 N5N3 changed the title Level 1 BLAS functions dont handle inputs with negetive stride correctly Level 1 BLAS functions (except for dot) dont handle inputs with negetive stride correctly Nov 5, 2021
@sostock
Copy link
Contributor

sostock commented Nov 5, 2021

Duplicate of #813.

@sostock sostock closed this as completed Nov 5, 2021
@KristofferC KristofferC transferred this issue from JuliaLang/julia Nov 26, 2024
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

No branches or pull requests

3 participants