Skip to content

fix: complex dot_product formulation #1017

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jalvesz
Copy link
Contributor

@jalvesz jalvesz commented Jul 17, 2025

addresses #1016

cc: @loiseaujc

@jalvesz jalvesz requested a review from Copilot July 19, 2025 12:32
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes the complex dot product formulation in the stdlib intrinsics implementation to ensure compliance with the mathematical standard. The fix addresses issue #1016 by correcting the conjugation logic in complex number multiplication.

  • Modifies the complex dot product implementation to conjugate the first vector instead of the second
  • Updates both the standard and Kahan summation variants of the dot product functions
  • Adds comprehensive test coverage to verify conformance with the compiler intrinsic behavior

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/stdlib_intrinsics_dot_product.fypp Corrects conjugation order in complex dot product calculations for both standard and Kahan variants
test/intrinsics/test_intrinsics.fypp Adds test case comparing stdlib implementations against compiler intrinsic to ensure standard conformance

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.

stdlib_dot_product and stdlib_dot_product_kahan return erroneous results for complex vectors
1 participant