Re: Arrays and FFTW - Mailing list pgsql-hackers

From Alessandro Baretta
Subject Re: Arrays and FFTW
Date
Msg-id 3D38894B.70206@baretta.com
Whole thread Raw
In response to Arrays and FFTW  (Alessandro Baretta <alex@baretta.com>)
List pgsql-hackers
Tom Lane wrote:>
> You're intending to store each complete signal as a big array in one
> row?  That could get a bit ugly if the signals are very large (many
> megabytes).  But if you want to do it that way, I think the coding
> would be pretty straightforward.  See src/backend/utils/adt/float.c
> for some examples of C functions that process arrays of floats ---
> the "FLOAT AGGREGATE OPERATORS" section is relevant.
> src/include/utils/array.h is relevant reading as well.

Ok. I'll take a look at them.

What is going to be ugly, exactly? To be precise, my 
application requires storing samples obtained at random 
intervals, and resampling them a 1Hz. My pgsql installation 
is already managing 3 months worth of data (1.8 Mrows), 
imported from MS/Excel x-( . But power spectra are only 
intersting for a moving window about 8-12 hours long (9.1h 
yields an array of 2**15 samples, whose FFT can be computed 
in about 2ms on an Athlon 1200).

My problem is that I need to know how the arrays are 
represented in memory, and how they are passed to my 
function. Also, I'll need to define an abstract type for the 
execution plan of the dft alorithm--yes, fftw uses execution 
plans just like PostgreSQL :-) --and I will need to store 
them in the database. This seems a little tricky to me. As I 
stated earlier, I have already learned SQL and PL/pgSQL 
functions, but I still have to learn how to create a C 
function. Anyway, I'm working on it, and I hope to be able 
to share my code with you guys, for possible inclusion in 
the distribution.

Alex



pgsql-hackers by date:

Previous
From: reina@nsi.edu (Tony Reina)
Date:
Subject: Inheritance a burden?
Next
From: Tom Lane
Date:
Subject: Re: preserving statistics settings