Path: csiph.com!news.mixmin.net!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Sat, 05 Aug 2023 06:09:44 -0700
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <86o7jlfxev.fsf@linuxsc.com>
References: <878rbaqch6.fsf@nosuchdomain.example.com> <87351foebi.fsf@bsb.me.uk> <86tttts1g2.fsf@linuxsc.com> <87351dm210.fsf@nosuchdomain.example.com> <789db599-e078-485f-bf16-32865c1eb970n@googlegroups.com> <878rb1gmur.fsf@bsb.me.uk> <86msz7gtnj.fsf@linuxsc.com> <20230804111508.781@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="943f511331d2b471aa1b6ebff38979e9"; logging-data="1848195"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18ijyutjP99/fUwJC4wA1e+XTSYtMRN5xk="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:xskIM64gImAWOLpA7ZsFOupBQo0= sha1:prdbevA2yLIibCoK9dvRUbdefBo=
Xref: csiph.com comp.lang.c:171683
Kaz Kylheku <864-117-4973@kylheku.com> writes:
> On 2023-08-04, Tim Rentsch wrote:
>
>> typedef unsigned long Index;
>>
>> void
>> convolve(
>> float *out, const float *in, Index N, const float *filter, Index Nf
>> ){
>> Index i, j;
>>
>> for( i = 0; i < N; i++ ){
>> float t = 0;
>> for( j = 0; j < Nf; j++ ){
>> Index k = i + j - Nf/2;
>> if( k >= N ) continue;
>> t += in[k] * filter[j];
>> }
>> out[i] = t;
>> }
>> }
>
> This looks like a (cross-)correlation, [...]
The key property is that it performs the same computation
as what seemed to be the intent of the original code.