-
Notifications
You must be signed in to change notification settings - Fork 87
reflect change in rotate!
from LinearAlgebra.jl
#603
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
base: master
Are you sure you want to change the base?
Conversation
Your PR requires formatting changes to meet the project's style guidelines. Click here to view the suggested changes.diff --git a/src/host/linalg.jl b/src/host/linalg.jl
index 4933839..a21d694 100644
--- a/src/host/linalg.jl
+++ b/src/host/linalg.jl
@@ -687,8 +687,8 @@ function LinearAlgebra.rotate!(x::AbstractGPUArray, y::AbstractGPUArray, c::Numb
i = @index(Global, Linear)
@inbounds xi = x[i]
@inbounds yi = y[i]
- @inbounds x[i] = s*yi + c *xi
- @inbounds y[i] = c*yi - conj(s)*xi
+ @inbounds x[i] = s * yi + c * xi
+ @inbounds y[i] = c * yi - conj(s) * xi
end
rotate_kernel!(get_backend(x))(x, y, c, s; ndrange = size(x))
return x, y
diff --git a/test/testsuite/linalg.jl b/test/testsuite/linalg.jl
index 433f762..3660dca 100644
--- a/test/testsuite/linalg.jl
+++ b/test/testsuite/linalg.jl
@@ -303,7 +303,7 @@
@testset "rotate!" for T in eltypes
@test compare(rotate!, AT, rand(T,5), rand(T,5), Ref(rand(real(T))), Ref(rand(T)))
- if isfloattype(T) && false # skip because the LinAlg.jl change is not released
+ if isfloattype(T) && false # skip because the LinAlg.jl change is not released
@test compare(rotate!, AT, fill(T(NaN), 5), fill(T(NaN), 5), Ref(false), Ref(false))
end
end
@@ -345,7 +345,7 @@ end
@test compare(mul!, AT, y, f(A), x)
@test compare(mul!, AT, y, f(A), x, Ref(T(4)), Ref(T(5)))
#TODO: generic_matvecmul! (from LinearAlgebra.jl) does not respect the "strong zero" for Float16
- if isfloattype(T) && !(T==Float16) && !(T == ComplexF16)
+ if isfloattype(T) && !(T == Float16) && !(T == ComplexF16)
y_NaN, A_NaN, x_NaN = fill(T(NaN), 4), fill(T(NaN), 4, 4), fill(T(NaN), 4)
@test compare(mul!, AT, y_NaN, f(A_NaN), x_NaN, Ref(false), Ref(false))
end |
Thanks! Mind adding those examples as a test? |
Not sure if this is the right approach. Should we also compare "strong zero"/NaN behaviour against LinearAlgebra.jl or should this be guaranteed only by GPUArrays.jl ? In other words: should the tests use For consistency I added similar tests for Essentially this now tests whether the multiplication with |
Ideally we test compatibility against Array/stdlibs, but if that behavior is clearly buggy it's fine to include |
This reflects a change in LinearAlgebra.jl (JuliaLang/LinearAlgebra.jl#1323). The previous implementation of
rotate!
did not respectfalse
as a strong zero. For consistency, the implementation in GPUArrays.jl should also be adapted.Essentially, this covers the edge case:
NaN
/false
behaviour be tested against?