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

Improvements for drawing random numbers #42

Merged
merged 10 commits into from
Feb 18, 2022

Conversation

sethaxen
Copy link
Collaborator

This PR adds an optional AbstractRNG parameter to quatrand and nquatrand.

It also implements the necessary overloads to call methods like Base.rand(Quaternion{Float64}, 10) and Base.randn(Quaternion{Float64}, 10). These behave differently from quatrand, instead following the pattern set in base by Base.rand(<:Complex). Namely, rand draws each of the four real numbers from the interval [0,1]. randn draws from the proper Quaternion normal distribution, which requires a scaling by 1/sqrt(4) (as opposed to Complex which uses a scaling of 1/sqrt(2)).

@hyrodium hyrodium mentioned this pull request Oct 30, 2021
@sethaxen
Copy link
Collaborator Author

@KristofferC can you review this or recommend someone who can?

@codecov
Copy link

codecov bot commented Feb 18, 2022

Codecov Report

Merging #42 (3223d7b) into master (fd991e3) will increase coverage by 4.60%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #42      +/-   ##
==========================================
+ Coverage   39.18%   43.78%   +4.60%     
==========================================
  Files           3        3              
  Lines         342      354      +12     
==========================================
+ Hits          134      155      +21     
+ Misses        208      199       -9     
Impacted Files Coverage Δ
src/DualQuaternion.jl 4.12% <100.00%> (+4.12%) ⬆️
src/Octonion.jl 10.00% <100.00%> (+10.00%) ⬆️
src/Quaternion.jl 80.79% <100.00%> (+3.33%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fd991e3...3223d7b. Read the comment docs.

@sethaxen sethaxen changed the title Improvements for drawing random quaternions Improvements for drawing random numbers Feb 18, 2022
@sethaxen
Copy link
Collaborator Author

The PR now adds also rand methods for Octonion and DualQuaternion, as well as a randn for Octonion.

@sethaxen sethaxen merged commit 5a2bb75 into JuliaGeometry:master Feb 18, 2022
@sethaxen sethaxen deleted the randquat branch February 18, 2022 23:04
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

Successfully merging this pull request may close these issues.

1 participant