Finish and build the complex Level-1 routines (C8 part 1)#17
Merged
Conversation
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>
561bbd7 to
968d0ce
Compare
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 complex routines the README lists as Implemented for
cwere broken or stubs and weren't in the build. Now implemented, built, and tested.scasum— was a stub (return 0+ undefinedSB_FLOAT32_ZERO). Now sum of|Re|+|Im|.scnrm2— was broken (referencedX, appliedf32ops tocomplex32_t). Now a scaled sum of squares over the 2N real components.ccopy— declaredix/iybut usediX/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. Newcvec()helper +test_complex.ccover each with hand-computed values (caxpy4+6i, cdotc11-2i, scasum10, scnrm25, 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) andsdsdot/hsdotare still broken/unbuilt — they need Givens-rotation work and are a separate effort.🤖 Generated with Claude Code