-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Add complex randn #21973
Add complex randn #21973
Changes from 1 commit
d891aef
2da70cc
e21065f
f3c46e2
672c01b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1196,9 +1196,6 @@ complex normal distribution. | |
end | ||
end | ||
|
||
Base.@irrational SQRT_HALF 0.7071067811865475244008 sqrt(big(0.5)) | ||
randn{T}(rng::AbstractRNG, ::Type{Complex{T}}) = Complex{T}(SQRT_HALF * randn(rng, T), SQRT_HALF*randn(rng, T)) | ||
|
||
# this unlikely branch is put in a separate function for better efficiency | ||
function randn_unlikely(rng, idx, rabs, x) | ||
@inbounds if idx == 0 | ||
|
@@ -1287,6 +1284,10 @@ let Floats = Union{Float16,Float32,Float64} | |
$randfun( dims::Integer... ) = $randfun(GLOBAL_RNG, Float64, dims...) | ||
end | ||
end | ||
|
||
# complex randn | ||
Base.@irrational SQRT_HALF 0.7071067811865475244008 sqrt(big(0.5)) | ||
randn(rng::AbstractRNG, ::Type{Complex{T}}) where {T <: Floats} = Complex{T}(SQRT_HALF * randn(rng, T), SQRT_HALF*randn(rng, T)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if we want There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done, also added a statement to the NEWS |
||
end | ||
|
||
## random UUID generation | ||
|
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.
blank line inserted?
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.
oops, not sure how that got there..