Re: [eigen] Malloc-free dynamic matrices

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


On 3 March 2010 15:44, leon zadorin <leonleon77@xxxxxxxxx> wrote:

> well... pseudo-code wise we already could have something like the
> following with a very small change(s) to API as per Benoit's post:
>
> double * reserved(aligned_alloc(8192));
>
> // 3x3
> Map<double> m(reserved, 3, 3);
>
> // 10x10 -- resize w/o reallocation -- equivalent to NeverRealloc w/o
> much repatching(?)
> m.remap(reserved, 10, 10);
>
> 3 lines of code -- looks convenient-enough to me.

Well, first you made me think I had completely lost it when I
programmed that -- your solution is indeed short and elegant. But then
I remembered why I needed it:

Matrix<float, Dynamic, Dynamic, NoRealloc> A, B, C;

A.reserve(16); A.resize(4,4);
B.reserve(25); B.resize(5,5);
C.reserve(81); C.resize(9,9);

B=A; //this should work and resize B to 4x4
B=C; //this should raise an assertion failure

To achieve this behaviour, we do need a dedicated class -- or an
option, such as in the patch.

Marton



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/