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: leon zadorin <leonleon77@xxxxxxxxx>
- Date: Wed, 3 Mar 2010 01:27:10 +1100
- 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 :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=w8PmsSUw80ue4mJARYVQXnc3d70E3v+4H6Ta5Qd+Vuw=; b=J7QywDNI3QiZ/iOGWtgEQWCjpIb875RgGlIpQDCbs+i7iYGauufekBh7DpxfJMw0cP 6pIx7fKRHGu3Jqy80OJ7gaJUBRweskpcc4ygDp1jYdANxx7sLgae0fvWsBss2qL4KgN9 +bUpY064xo3wcsHHEu7Qew8kG+wN/8gis5h0E=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=Z1ZzdRif85XQlpDDWXBe2JQ0VL3djIuCnlr2RdGm1mzEb2W9ns8kA0EkRp/ExftvDm DycERfVvN2QGnJKQR7WYv+9FOnF+HVMe0i5EC3QHuZrwEPhRlGrbA/rm4+SVbAu5k5nD 5ShRwkHjCPdtDomG5nkS7t6OQV8aKRP7taxOw=
On 3/3/10, Benoit Jacob <jacob.benoit.1@xxxxxxxxx> wrote:
> 2010/3/2 Márton Danóczy <marton78@xxxxxxxxx>:
[...]
>> The only API changes are a new option NeverRealloc (the name is maybe
>> not the best) and a method reserve(int size) that allocates the
>> memory. Then, a Matrix<Scalar, Dynamic, Dynamic, NeverRealloc> keeps
>> track of its allocated size via the member variable m_size and each
>> mat.resize(rows, cols) only changes two ints instead of actually
>> allocating memory. If rows*cols < m_size, an assertion error is
>> raised.
[...]
> approach... my main concern right now is that it's touching and
> complexifying a few very central places in Eigen, whereas the use case
> is very special. For that reason I wonder if this should rather be
> implemented as a new separate variant of the Matrix class itself...
And if it is a special/rare case usage, would it not be possible to
already achieve this behavior with a custom pre-allocated block of
memory and then instead of using matrix type simply using the
object(s) of Map<> type?
The "mapped" matricies would not need explicit resizing in the first
place... and reserving of the max size is simply done at allocation of
the very original memory slab -- as per current API and it's
capabilities?
I suppose an adapter pattern may be deployed to create custom class --
but it's internals would/could still rely on the Map<> semantics...
Kind regards
Leon.