Boost logo

Boost :

Subject: Re: [boost] Preliminary submission: generic linear algebra algorithms library Boost LA
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2009-10-23 14:14:00


On Thu, Oct 22, 2009 at 11:13 PM, Jeffrey Hellrung <jhellrung_at_[hidden]> wrote:
> Emil Dotchevski wrote:
>>
>> For determinants, I wanted to have at least the 2x2 3x3 and 4x4
>> versions done efficiently because those are used in 2D and 3D
>> graphics. The formula is certainly not efficient, but (perhaps a bit
>> naively?) I relied on compiler optimizations: the generated functions
>> pull all scalars in local variables, which should untie the optimizer
>> to figure out which series of multiplication/addition operations are
>> identical and can be computed only once.
>
> FWIW, I read somewhere (can try to dig up reference if desired) that 4x4
> (and 5x5) determinants are most efficiently calculated via dynamic
> programming, so you might consider explicitly implementing that rather than
> relying on the compiler.
>
> Also, signed volumes of small matrices might be useful, and I believe they
> can be implemented more efficiently than simply taking the determinant of a
> matrix adjoined with 1's.
>
>> I'm not sure why we're talking about 3D arrays, those can't possibly
>> represent vectors or matrices.
>
> I just have to take issue with the strong "can't" here ;)  It is certainly
> imaginable that a 3D array could represent a linear operator from 2D arrays
> to 1D arrays, or from 1D arrays to 2D arrays.  Using multidimensional arrays
> as your vectors might be more convenient than flattening them for a given
> application.

Oh from this point of view yes, the library does allow you to get a
vector out of a given column or row of a matrix, you just go m|col<2>
and you get a vector type (without actually creating a temporary.)

Emil Dotchevski
Reverge Studios, Inc.
http://www.revergestudios.com/reblog/index.php?n=ReCode


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk