|Re: [eigen] Qt's container support|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Qt's container support
- From: Alex Stapleton <alex.stapleton@xxxxxxxxxxxxx>
- Date: Tue, 20 Jan 2009 11:46:04 +0000
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to :content-type:content-transfer-encoding; bh=JEBMb4+CyiIgxRaS/Sfkq8UGrzsea386M3Ja4ZDU1ps=; b=IlxWmnIGaaiuEZvEtVAij1GtPQv4g5jcF+T0PthpAceYjOB4IDHeefGADnGzQOy3rS TfQcqtfBmpYF1P7rI79XNRrLMgaFYhSXbfreoTJvNuQafDThxbl8pARu22eAcawk/vwD mP21UoBCM9NC/0XystR20MksP5MZ3srUre3B0=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; b=eHzjtV3Cdqx4k0UHcr5tbqfjb5dvTCfT2m3YxzfJbO08kx9bQMaCKQc43gEMrdE66/ NajL4cYUh5cxMcq054imnvtEVtfWcpWm08mmRUxQlMmkRm6SHfMGNkVb/iBOuRY+yQxB KM7YdtrcTlxQqFI8NNnZJwzYKdVQNnwCrJC1w=
2009/1/20 Gael Guennebaud <gael.guennebaud@xxxxxxxxx>:
> Hi all,
> I think that being able to store Eigen's matrices in Qt's containers
> is very important (especially QVector<>), and just like std::vector,
> there are a couple of issues:
> Issue 2:
> the second problem is to enforce QVector to allocate aligned memory
> buffers. Fortunately, Qt's developers had the good idea to define
> wrapper functions around malloc/free/realloc called qMalloc, qFree
> So the workaround is simply to redefine these functions to call
> ei_align_malloc. I added a Eigen/QtAlignedMalloc header which exactly
> does that (I'll commit it once the next issue will be solved).
> => PROBLEM SOLVED
I am not a Qt person in general so please correct me if I am wrong but
wont this will result in *all* QVectors using aligned allocation?
> The last issue I found is with QVector::fill(const T&,size_t) which is
> the equivalent of std::vector<T>::resize(size_t,T). Here the argument
> is passed by reference so no alignment issue. The problem is the use
> of the default ctor and operator= to initialize/copy the new elements
> while our operator= does not allow to set an uninitialized matrix.
> a) allow operator= to set/resize an uninitialized matrix
> b) specialize QVector for Eigen's matrix type using a similar trick
> than for std::vector such that we only have to redefine the fill()
> method to use Matrix::set()
> c) do nothing and enforce the user to use .resize() followed by a for
> loop instead of fill().
> I vote for solution b)
> any opinion ?
I vote for (b) too (and echo the "not a trick" sentiments from
Cyrille, but then I am biased :) Can probably farm some of the boiler
plate out into a macro aswell I think.