-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Complex number support for C++ extension (#209)
std::complex support for C++ extension. f64, f32, f16, q31, q15 supported
- Loading branch information
1 parent
fd9ec53
commit 03c78a9
Showing
71 changed files
with
10,859 additions
and
689 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Complex numbers {#dsppp_complex} | ||
|
||
Complex numbers are supported. They benefit from vector instructions only with Helium. When only DSP extensions are available, a scalar version of the algorithm is used. | ||
|
||
To use them, you just need to use the `std::complex` datatype. | ||
|
||
For instance, you can use: | ||
|
||
```C | ||
std::complex<float32_t> | ||
std::complex<float16_t> | ||
std::complex<Q31> | ||
std::complex<Q15> | ||
``` | ||
|
||
`Q7` complex numbers have not been implemented because there is no equivalent function in the C CMSIS-DSP to compare with. | ||
|
||
With `std::complex`, you can declare a vector with: | ||
|
||
```C | ||
Vector<std::complex<Q31>,10> a | ||
``` | ||
|
||
Operator `conjugate` is available. | ||
|
||
If you want an hermitian product, you can just write: | ||
|
||
```C | ||
auto result = dot(a,conjugate(b)); | ||
``` | ||
|
||
Mixed complex / real arithmetic is supported but may not yet be very efficient. In some cases, it may be faster to convert the real object to complex before doing the computation. | ||
|
||
It is a temporary limitation. | ||
|
||
Note that there is not yet any function to get the real or imaginary part of a vector or matrix. You'll need to loop on the elements and use the `std::complex` functions. As consequence, those operations cannot yet participate into the fusion mechanism. | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.