slaruv/dlaruv: fix seed advancement on rejected uniform deviate#1288
Open
jschueller wants to merge 1 commit into
Open
slaruv/dlaruv: fix seed advancement on rejected uniform deviate#1288jschueller wants to merge 1 commit into
jschueller wants to merge 1 commit into
Conversation
When the computed random value rounds to exactly 1.0 (once every
~2^24 single-precision calls), both SLARAN and SLARUV reject it and
recompute — but they advanced the seed differently:
SLARAN: ISEED(1:4) = IT1..IT4 (correct — carry forward the
multiplier-transformed state)
SLARUV: I1 = I1 + 2 (wrong — ad-hoc skip in seed
space)
SLARUV's +2 produces a different subsequent random sequence than
SLARAN would for the same initial seed. Fix by using the same
seed advancement in both: set I1..I4 = IT1..IT4, matching SLARAN.
Applies to DLARUV as well.
Closes Reference-LAPACK#1108
martin-frbg
approved these changes
Jun 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the computed random value rounds to exactly 1.0 (once every ~2^24 single-precision calls), both SLARAN and SLARUV reject it and recompute — but they advanced the seed differently:
SLARAN: ISEED(1:4) = IT1..IT4 (correct — carry forward the
multiplier-transformed state)
SLARUV: I1 = I1 + 2 (wrong — ad-hoc skip in seed
space)
SLARUV's +2 produces a different subsequent random sequence than SLARAN would for the same initial seed. Fix by using the same seed advancement in both: set I1..I4 = IT1..IT4, matching SLARAN.
Applies to DLARUV as well.
Closes #1108