Re: arrays of floating point numbers / linear algebra operations into the DB

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Enrico Sirola <enrico(dot)sirola(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: arrays of floating point numbers / linear algebra operations into the DB
Date: 2008-02-01 14:53:42
Message-ID: 20080201145342.GC14265@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Feb 01, 2008 at 11:31:37AM +0100, Enrico Sirola wrote:
> Hello,
> I'd like to perform linear algebra operations on float4/8 arrays.
> These tasks are tipically carried on using ad hoc optimized libraries
> (e.g. BLAS). In order to do this, I studied a bit how arrays are
> stored internally by the DB: from what I understood, arrays are
> basically a vector of Datum, and floating point numbers are stored by
> reference into Datums.

Well, arrays are not vectors of Datum, they are a vector of the objects
they contain. When passed to a function floats, arrays and other by-ref
types as passed by reference, but the array object itself does not
contain references, it contains the actual objects.

That doesn't necessarily make it the same as a C array though, the
alignment considerations may be different. But at first glance
certainly seems like an array would be in the right format for what
you're doing.

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Those who make peaceful revolution impossible will make violent revolution inevitable.
> -- John F Kennedy

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Enrico Sirola 2008-02-01 15:01:10 Re: arrays of floating point numbers / linear algebra operations into the DB
Previous Message Stefan Schwarzer 2008-02-01 14:40:41 pg_restore fails for postgis data dump