Repository navigation
Fix conjugation of A in complex GEADD - #6309
Open
proffitteoy wants to merge 2 commits into
Open
proffitteoy wants to merge 2 commits into
proffitteoy wants to merge 2 commits into
Conversation
proffitteoy
marked this pull request as ready for review
December 4, 2026 11:56
This branch has not been deployed
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.
cblas_cgeaddandcblas_zgeaddrecognizeCblasConjNoTransandCblasConjTrans, but the interface discards the conjugation flag before calling the kernel. As a result,ConjNoTransbehaves likeNoTrans, andConjTransbehaves likeTrans.The kernel currently receives only a transpose flag. This patch preserves transpose and conjugation independently using two bits in the existing internal argument. The ordinary AXPBY path is unchanged for non-conjugating operations; conjugating operations use a separate complex arithmetic path, including the existing zero-alpha and zero-beta behavior.
For a minimal counterexample, take
A = [i], initialize a separateC = [i], and setalpha = beta = 1/2,transA = ConjTransandtransC = NoTrans. This computes the self-adjoint part(A + A*)/2, which should be zero, but the original implementation returns[i].The Fortran interface also needs a mapping for conjugation without transposition. I used
R/rfor this operation, following the convention in OMATCOPY, whileC/cperforms conjugate transposition. GEADD did not previously document theR/rmode, so I'd appreciate feedback on this convention before removing the draft status.I added independent regression tests to both existing cgeadd and zgeadd test files. They cover row- and column-major CBLAS calls, rectangular matrices with padded leading dimensions, both conjugating modes, complex coefficients, zero coefficients with NaN inputs, and the Fortran ABI entry points. The tests also check that A remains unchanged.