[SciPy-user] filling array without loop...

fred fredmfp@gmail....
Sun Apr 22 15:01:46 CDT 2007


Anne Archibald a écrit :
> On 22/04/07, fred <fredmfp@gmail.com> wrote:
>
>   
>> Each array cell is a convolution that I wrote as a scalar product
>> between KW, a weights filter vector, and input_data,
>> the "raw" data (3D); output_data is the filtered response given by the
>> filter.
>>     
>
> First: it is almost certainly possible to write this without a loop.
> But the algorithm will still be O(n**3*m**3). You can rewrite
> convolutions using the Fourier transform to get an algorithm that is
> O((n+m)**3*log(n+m)**3), which will be much faster. Doing it for a
> three-dimensional matrix will be a bit messy.
>   
Ok.

Forget that is a convolution (because in fact, it is really not),
simply a scalar product (inner product says scipy) in each cells of an 
array, as I wrote in my example.

Does it changes something ?

In this case, I don't see the interest to use a FFT (maybe I'm wrong).

Is it _slow_ because it is in n**3*m**3 or because of loops in python 
(maybe silly question) ?


Cheers,

-- 
http://scipy.org/FredericPetit



More information about the SciPy-user mailing list