-
Notifications
You must be signed in to change notification settings - Fork 329
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
Complex number operations #2423
base: master
Are you sure you want to change the base?
Complex number operations #2423
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
||
Take `j` to be the even values of `i`. | ||
|
||
* <code>V **CplxConj**(V v)</code>: returns the complex conjugate of the vector, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a strong opinion here, but we might consider spelling out Complex for better legibility. (We have SaturatedAdd instead of SatAdd).
* <code>V **MaskedMulCplxConjAddOrZero**(M mask, V a, V b, V c)</code>: returns | ||
`(a[j] + i.a[j + 1])(b[j] - i.b[j + 1]) + (c[j] + i.c[j + 1])` or `0` if | ||
`mask[i]` is false. | ||
* <code>V **MaskedMulCplxConjOrZero**(M mask, V a, V b)</code>: returns |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As in other PRs, let's remove the OrZero suffix, use Masked prefix as the _z case and Masked..Or(V no, ..) for the _m case. For MaskedMulCplxOr the c argument is currently last, so let's move it first for consistency and rename to no
.
@@ -886,6 +886,32 @@ not a concern, these are equivalent to, and potentially more efficient than, | |||
<code>V **MaskedSatSubOr**(V no, M m, V a, V b)</code>: returns `a[i] + | |||
b[i]` saturated to the minimum/maximum representable value, or `no[i]` if | |||
`m[i]` is false. | |||
#### Complex number operations | |||
|
|||
Complex types are represented as complex value pairs of real and imaginary |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we intend to support (and have a use-case for) integer types? If not, let's mark all of these ops as float-only, with a prefix like *
V:
f \
(see other examples in this file).
const auto x = DupEven(b); | ||
const auto y = DupOdd(b); | ||
|
||
return OddEven(Add(Mul(u, y), Mul(v, x)), Sub(Mul(u, x), Mul(v, y))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we fuse one of the Add+Mul into MulAdd? (also below)
Introduces basic complex arithmetic for float and integer types. Some masked operations for complex numbers are also included.
A single complex value is formed of a real part which is stored in an even lane, and the imaginary part which is stored in the following odd lane.
All complex operations are written for
arm_sve-inl.h
andgeneric_ops-inl.h
and a new set of tests is introduced for all the new complex operations.