Skip to content

Finish rot/rotg/rotm to the BLAS reference (C8 part 2)#19

Merged
sigilante merged 1 commit into
masterfrom
fix/finish-rot
May 30, 2026
Merged

Finish rot/rotg/rotm to the BLAS reference (C8 part 2)#19
sigilante merged 1 commit into
masterfrom
fix/finish-rot

Conversation

@sigilante
Copy link
Copy Markdown
Collaborator

The rotation routines existed but didn't compile or build. Rewritten faithfully to the Netlib SROT/SROTG/SROTM reference and wired into the Makefile.

  • srot — used a struct-vs-int comparison and a uint32_t signature. Now a clean strided plane rotation.
  • srotg — was WIP with the wrong sign factor (|roe| instead of sign(roe)) and assigned to local pointer copies. Now matches the reference (Givens generation, r, z).
  • srotm — had a paren-less if f32_eq(...). Now applies the flag-selected modified-Givens H.

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; and 3,4 → r=5), srotm (flag=0). 155/155.

Remaining C8: rotmg (whose rescale constant gamsq=2²⁴ overflows float16) and sdsdot/hsdot.

🤖 Generated with Claude Code

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>
@sigilante sigilante merged commit 0e14bac into master May 30, 2026
1 check passed
@sigilante sigilante deleted the fix/finish-rot branch May 30, 2026 17:29
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