Re: [eigen] Malloc-free dynamic matrices |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Malloc-free dynamic matrices
- From: Márton Danóczy <marton78@xxxxxxxxx>
- Date: Wed, 3 Mar 2010 17:29:01 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:content-type; bh=MQSIRGGJuiy4lPgJ5ZO9OvRQ23fY3dYcdjAei3ZY2Bc=; b=Sj/ULPYfYQVSIYPGg2/+7Zo4Lcsi+cjSYYvpmcPYwFqFqJ9aaF+A4aG1mTaychUmaU XZ5UzCXBpaSujqp4hJgTqvFsK/8jXa+WjQBQq9QVvlAI959vtWdsLyalw0U/xS4jQZiM cePxDW6jf3J5fHeYrCe31O+FLBvJVhtxC92FQ=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=xA/JDe3ztVAaBPpjmk6BT+KOC1eXc+Pie1+WN9jwBrEYUiAfMT2rYeWAdhz/5l32Tx 37mkTU69iJUe4NVV+HeXo1ty0ytBfvAjzKHvME9a7XqM3N4m7t/cDxb6eIoiZ7OJXYpu 0DgOZ3c0mQWiWWaDs03c/VqVK3P4iwhWtaHVQ=
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