Skip to content

Finish and build the complex Level-1 routines (C8 part 1)#17

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

Finish and build the complex Level-1 routines (C8 part 1)#17
sigilante merged 1 commit into
masterfrom
fix/finish-complex

Conversation

@sigilante
Copy link
Copy Markdown
Collaborator

The complex routines the README lists as Implemented for c were broken or stubs and weren't in the build. Now implemented, built, and tested.

  • scasum — was a stub (return 0 + undefined SB_FLOAT32_ZERO). Now sum of |Re|+|Im|.
  • scnrm2 — was broken (referenced X, applied f32 ops to complex32_t). Now a scaled sum of squares over the 2N real components.
  • ccopy — declared ix/iy but used iX/iY (didn't compile). Fixed.
  • caxpy / cdotc / csrot — compiled but weren't built or tested.

All six canonicalize their NaN output (nan_unify_c/nan_unify_s), consistent with the real routines, and are added to the Makefile. New cvec() helper + test_complex.c cover each with hand-computed values (caxpy 4+6i, cdotc 11-2i, scasum 10, scnrm2 5, ccopy, csrot swap).

157/157. The README's c "Implemented" claims are now honest.

Remaining C8: the real rotation family (srot/drot/hrot, rotg/rotm/rotmg) and sdsdot/hsdot are still broken/unbuilt — they need Givens-rotation work and are a separate effort.

🤖 Generated with Claude Code

The complex routines the README lists as Implemented for `c` were either
broken or stubs and were not in the build:

- scasum: was a stub (`return 0`, plus an undefined SB_FLOAT32_ZERO).
  Implemented as sum of |Re|+|Im|.
- scnrm2: was broken (referenced `X`, applied f32 ops to complex32_t).
  Implemented as a scaled sum of squares over the 2N real components.
- ccopy: declared ix/iy but used iX/iY (didn't compile). Fixed.
- caxpy / cdotc / csrot: compiled but weren't built or tested.

All six now canonicalize their NaN output (nan_unify_c / nan_unify_s),
consistent with the real routines, and are added to the Makefile.

New cvec() test helper builds complex32_t arrays from interleaved (re,im)
floats; test_complex.c covers each routine with hand-computed values
(caxpy 4+6i, cdotc 11-2i, scasum 10, scnrm2 5, ccopy, csrot swap).

157/157 tests pass. (The real rotation family -- srot/drot/hrot,
rotg/rotm/rotmg -- and sdsdot/hsdot remain broken/unbuilt; tracked
separately as they need Givens-rotation work.)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@sigilante sigilante force-pushed the fix/finish-complex branch from 561bbd7 to 968d0ce Compare May 30, 2026 17:18
@sigilante sigilante merged commit ce8d688 into master May 30, 2026
1 check passed
@sigilante sigilante deleted the fix/finish-complex branch May 30, 2026 17:19
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