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

Add complex number support to matmul #557

Merged
merged 2 commits into from
Dec 14, 2022
Merged

Add complex number support to matmul #557

merged 2 commits into from
Dec 14, 2022

Conversation

kgryte
Copy link
Contributor

@kgryte kgryte commented Dec 12, 2022

This PR

  • adds complex number support to matmul.
  • requires that input arrays not be transposed or conjugated when arguments have complex floating-point data types. If matmul were to automatically compute the conjugate transpose of the second argument, this would allow returning the complex dot product for the 1D case. However, following NumPy et, this PR pushes conjugate-transposition to userland by requiring conjugation and/or transposition be explicitly performed prior to computing to the matrix product.
  • updates the input and output array data types to be any numeric data type, not just real-valued data types.

@kgryte kgryte added API change Changes to existing functions or objects in the API. topic: Complex Data Types Complex number data types. topic: Linear Algebra Linear algebra. labels Dec 12, 2022
@kgryte kgryte added this to the v2022 milestone Dec 12, 2022
Copy link
Member

@rgommers rgommers left a comment

Choose a reason for hiding this comment

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

That note looks correct; vdot (not in the array API standard), is the matrix multiplication with conjugation. In it goes, thanks @kgryte

@rgommers rgommers merged commit 031987d into main Dec 14, 2022
@rgommers rgommers deleted the cmplx-matmul branch December 14, 2022 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API change Changes to existing functions or objects in the API. topic: Complex Data Types Complex number data types. topic: Linear Algebra Linear algebra.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants