Re: Arrays and FFTW - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Arrays and FFTW
Date
Msg-id 15230.1027111955@sss.pgh.pa.us
Whole thread Raw
In response to Arrays and FFTW  (Alessandro Baretta <alex@baretta.com>)
List pgsql-hackers
Alessandro Baretta <alex@baretta.com> writes:
> If I have to write the code myself, I would need to create a
> database function calling code from a C module. Such code
> would have to operate on real and complex float arrays. I
> understand how I could use a pl/pgsql function to create a
> new table where each signal is stored as a (signal_id,
> double array) tuple, but how am I supposed to pass such
> arrays to a C function? How are postgres arrays actually
> implemented in memory? In short, I need someone to get me
> started on writing an FFTW binding for pgsql, in none is
> already available.

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.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Alessandro Baretta
Date:
Subject: Arrays and FFTW
Next
From: nconway@klamath.dyndns.org (Neil Conway)
Date:
Subject: Re: preserving statistics settings