-
Notifications
You must be signed in to change notification settings - Fork 150
Description
I would expect the function NonLocalECPComponent::randomize_grid to randomize the grid origin across the entire sphere.
But it does not - it's missing some coverage around the "poles". See the attached graph.
The root cause is the initialization of cth from a random number. It is currently cth = myRNG() - 0.5. I think it should be cth = 1.0 - 2*myRNG().
I'm not sure this issue has a practical impact, since the rotation is only meant to change the origin of the spherical integration grid and not cover the sphere by itself. If the grid is sufficiently dense, the other points will cover the missing regions from the origin. (But I didn't actually check this)
There is another minor annoyance in that when initializing the current code with all zeros for the rng values, the result is not the identity rotation. With the corrected initialization, using zeros does result in the identity rotation.
I tried to find the origin of the formula in randomize_grid. Nothing online seemed to match, and I couldn't recreate it through multiplying 2x2 rotation matrices (though that search was not exhaustive).
Plot of random rotations applied an input vector (0,0, 1)

The script used to generate the plot