Finish rot/rotg/rotm to the BLAS reference (C8 part 2)#19
Merged
Conversation
The rotation routines existed but did not compile or build: srot used a struct-vs-int comparison and a uint32_t signature; srotg was WIP with the wrong sign factor (|roe| instead of sign(roe)) and assigned to local pointer copies; srotm had a parenless `if f32_eq(...)`. All were absent from the Makefile. Rewrite srot/srotg/srotm faithfully to the Netlib SROT/SROTG/SROTM reference using SoftFloat ops (loading operands into locals first, since the abs/compare macros don't parenthesize their argument), with NaN canonicalization on the outputs. Generate the float64 and float16 variants and add all nine to the Makefile. test_rot.c covers srot (c=0,s=1 -> (y,-x)), srotg (a=1,b=0; and 3,4 -> r=5), and srotm (flag=0 modified Givens). 155/155 tests pass. (rotmg and sdsdot/hsdot remain; rotmg's rescaling constant gamsq=2^24 overflows float16 and needs handling.) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
The rotation routines existed but didn't compile or build. Rewritten faithfully to the Netlib
SROT/SROTG/SROTMreference and wired into the Makefile.uint32_tsignature. Now a clean strided plane rotation.|roe|instead ofsign(roe)) and assigned to local pointer copies. Now matches the reference (Givens generation,r,z).if f32_eq(...). Now applies the flag-selected modified-GivensH.Operands are loaded into locals first (the SoftFloat abs/compare macros don't parenthesize their argument), and outputs are NaN-canonicalized. float64/float16 variants generated; all nine added to the Makefile.
test_rot.c: srot (c=0,s=1 → (y,−x)), srotg (a=1,b=0; and3,4 → r=5), srotm (flag=0). 155/155.Remaining C8:
rotmg(whose rescale constantgamsq=2²⁴overflows float16) andsdsdot/hsdot.🤖 Generated with Claude Code