Skip to content

Commit 67a065c

Browse files
committed
Change the implementation of rotate! to avoid unary minus
1 parent c33045c commit 67a065c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/generic.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1726,7 +1726,7 @@ end
17261726
"""
17271727
rotate!(x, y, c, s)
17281728
1729-
Overwrite `x` with `c*x + s*y` and `y` with `-conj(s)*x + c*y`.
1729+
Overwrite `x` with `s*y + c*x` and `y` with `c*y - conj(s)*x`.
17301730
Returns `x` and `y`.
17311731
17321732
!!! compat "Julia 1.5"
@@ -1741,8 +1741,8 @@ function rotate!(x::AbstractVector, y::AbstractVector, c, s)
17411741
for i in eachindex(x,y)
17421742
@inbounds begin
17431743
xi, yi = x[i], y[i]
1744-
x[i] = c *xi + s*yi
1745-
y[i] = -conj(s)*xi + c*yi
1744+
x[i] = s*yi + c *xi
1745+
y[i] = c*yi - conj(s)*xi
17461746
end
17471747
end
17481748
return x, y

0 commit comments

Comments
 (0)