Muliply vector by vector?
jcupitt at gmail.com
jcupitt at gmail.com
Mon Apr 15 09:02:33 UTC 2024
Hello Martin! How are you, long time no see etc.
I used to use orc for this:
https://github.com/GStreamer/orc
Another possibility is the auto-vectorisation in gcc and clang at O3
and above. It'll vectorise loops like this pretty well:
float *restrict p1 = input array
float *restrict p2 = second input array
float *restrict q = output array
for (int i = 0; i < N; i++)
q[i] = p1[i] * p2[i];
gcc also supports fixed length vectors, though they are harder to use.
I've been using highway recently, it's pretty nice:
https://github.com/google/highway
It's C++, but you can pretend it's C.
John
On Mon, 15 Apr 2024 at 04:52, Martin Guy <martinwguy at gmail.com> wrote:
>
> If often have to multiply one array of floats each element with the
> corresponding one in another array of floats and store the result in a
> third array, mostly to apply window functions to audio fragments. Can
> liboil help? The closest things I see in the Liboil Reference Manual
> that seems close multiply an array by a constant and put the result in
> another array. Am I missing something? Might this be a good candidate
> for inclusion in liboil?
>
>
> Thanks
>
>
> M
>
More information about the Liboil
mailing list