Skip to content
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

Choice of conjugation in complex inner product #616

Closed
lezcano opened this issue Mar 30, 2023 · 4 comments
Closed

Choice of conjugation in complex inner product #616

lezcano opened this issue Mar 30, 2023 · 4 comments
Labels
topic: Complex Data Types Complex number data types. topic: Linear Algebra Linear algebra.
Milestone

Comments

@lezcano
Copy link
Contributor

lezcano commented Mar 30, 2023

vecdot is defined for complex vectors as $\langle x, y \rangle = \sum_i x_i \overline{y_i}$. This can be written as $\langle x, y \rangle = y^H x$ (note how the order of the parameters is swapped).

In PyTorch we define it as $\langle x, y \rangle = x^H y$. This notation is more common in physics, while the previous notation is more common in complex geometry. For a short discussion see this wikipedia page.

I would argue that numerical libraries are more targeted to physics people than to pure math people, so perhaps it'd be better to stick with the physics notation?

@asmeurer asmeurer transferred this issue from data-apis/array-api-compat Apr 3, 2023
@asmeurer
Copy link
Member

asmeurer commented Apr 3, 2023

I've transferred this issue to the array-api repo.

@kgryte
Copy link
Contributor

kgryte commented Apr 4, 2023

What is the ask here? Is this just a question about updating the docs or something else?

@lezcano
Copy link
Contributor Author

lezcano commented Apr 4, 2023

It's a question about the definition of vecdot for complex inputs in the array API (should it conjugate the first or the second input?)

@kgryte
Copy link
Contributor

kgryte commented Dec 18, 2023

This issue has been closed by #723. During the workgroup meeting on 30 Nov, we discussed this issue and consensus was to align the definition of the complex inner product with PyTorch and NumPy, as described in the OP. The definition previously in the spec was an oversight, and the changes have been backported to the 2022 revision of the API standard.

@kgryte kgryte closed this as completed Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: Complex Data Types Complex number data types. topic: Linear Algebra Linear algebra.
Projects
None yet
Development

No branches or pull requests

4 participants