Re: [eigen] How to resize a partially fixed matrix |

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

*To*: eigen@xxxxxxxxxxxxxxxxxxx*Subject*: Re: [eigen] How to resize a partially fixed matrix*From*: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>*Date*: Thu, 25 Jun 2009 03:32:01 +0200*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=PznMQkQH9ou+kvnimnvvskITq+qansDfzXTApHUeQDw=; b=LfQCFPRyWyWdkWA9zShRnkamf6Zvj2jSjJISlA6soFsN6ovcBwOjrnzaA03ZRGfn4K WGyeOBCKQ3KfRIHObDiuE7XBfCD2POs2+TDCvX0fPSueDLy34H0NsDpJXwVdpwc5OJLu ifmstw/pKPi+K//lpVkWXb+CI0XrjmF+7fhJY=*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=HlJ0vjayoZst1p0xGRLhfgZ+dQoH00gdqSMSZk5di/A63ZjwUXAs0s8rJyiB4TA1V5 sfJEZvA/n3+MOxJ/4bHRFKOM/RFNaWxWVcbQy2iO2RYIjBSIPHALJvuuP8qTzMD90Mfv bcUWtzPTjDMozRCzQDaUNv/5WAyBwEaMb9bms=

Thanks, patch applied. The anonymous namespace solution gave me: /home/bjacob/eigen2/Eigen/src/Core/util/Constants.h:246: warning: ‘Eigen::<unnamed>::NoChange’ defined but not used I put a EIGEN_UNUSED before, which for GCC expands to __attribute__((unused)), this solves the problem for GCC but this is only a good solution if for every compiler that will issue such a warning, there is an equivalent of GCC's __attribute__((unused)). If we hit a dead end, we can always revert to named enums. Benoit 2009/6/25 Patrick Mihelich <patrick.mihelich@xxxxxxxxx>: > The syntax is inherited from C; it just looks weird because the brackets are > empty. But I was being too clever earlier. We don't need static > initialization here since it's just the type we care about. Here's a more > sensible version: > > struct NoChange_t {}; > namespace { > NoChange_t NoChange; > } > > The anonymous namespace avoids multiple definition troubles. > > Cheers, > Patrick > > On Wed, Jun 24, 2009 at 3:52 PM, Benoit Jacob <jacob.benoit.1@xxxxxxxxx> > wrote: >> >> 2009/6/24 Patrick Mihelich <patrick.mihelich@xxxxxxxxx>: >> > I like the NoChange API, but I get a little leery seeing overloads >> > disambiguated on integral types (even though it seems OK here). A safe >> > approach in general is to use a statically initialized tag object, that >> > is >> > change >> > >> > enum NoChange_t { NoChange }; >> > >> > to >> > >> > struct NoChange_t {} NoChange = {}; >> >> Hehe, that's why I initially proposed an approach with a struct >> NoChange... but I retracted it because I was afraid of "multiply >> defined object" issues as this is in a header file. I'll be honest: I >> didn't know about the C++ syntax that you propose here. Do you confirm >> it's standard c++98, and takes care of the "multiply defined object" >> issue? If yes i'm all for your solution. >> >> Cheers, >> Benoit >> >> > >> > Cheers, >> > Patrick >> > >> > On Wed, Jun 24, 2009 at 1:37 PM, Markus <grey_earl@xxxxxx> wrote: >> >> >> >> Am Mittwoch, 24. Juni 2009 schrieb Benoit Jacob: >> >> > First of all the variant proposed: >> >> > >> So I'm strongly for your code change, but changing the assertion >> >> > >> to >> >> > >> EIGEN_STATIC_ASSERT_EXACTLY_ONE_DYNAMIC_DIM(Matrix) >> >> > >> >> > doesn't make me comfortable, again because a method that works for >> >> > (partially)dynamic matrices should also work on fixed-size matrices >> >> > of >> >> > the same size, I am very reluctant here. >> >> > >> >> > So here's what I did (changeset b030f9866bae): >> >> > * add resize(int, NoChange) and resize(NoChange, int) >> >> > * add missing assert in resize(int) >> >> > * add examples for all resize variants >> >> > * expand docs (part of which is from Tim Hutt's e-mail) >> >> > >> >> > Now if you want we can add another name (or completely rename) the >> >> > new >> >> > resize(int, NoChange) and resize(NoChange, int). >> >> > But perhaps it's good enough like this? i don't have a strong >> >> > opinion. >> >> > resizeHoriz(size) and colwise().resize(size) look nice but they >> >> > aren't >> >> > much shorter to type than resize(NoChange,size); >> >> > >> >> > Cheers, >> >> > Benoit >> >> > >> >> >> >> Does this also work for fully dynamic matrices now? >> >> >> >> So if I have >> >> >> >> Matrix<double, Dynamic, Dynamic> mat; >> >> mat.resize(3,3); >> >> mat.resize(NoChange, 5); >> >> >> >> does this work? If yes, everything fine with me. >> >> >> >> Markus >> >> >> >> >> > >> > >> >> > >

**References**:**Re: [eigen] How to resize a partially fixed matrix***From:*Markus Fröb

**Re: [eigen] How to resize a partially fixed matrix***From:*Tim Hutt

**Re: [eigen] How to resize a partially fixed matrix***From:*Benoit Jacob

**Re: [eigen] How to resize a partially fixed matrix***From:*Markus

**Re: [eigen] How to resize a partially fixed matrix***From:*Patrick Mihelich

**Re: [eigen] How to resize a partially fixed matrix***From:*Benoit Jacob

**Re: [eigen] How to resize a partially fixed matrix***From:*Patrick Mihelich

**Messages sorted by:**[ date | thread ]- Prev by Date:
**Re: [eigen] How to resize a partially fixed matrix** - Next by Date:
**[eigen] Std Vector again** - Previous by thread:
**Re: [eigen] How to resize a partially fixed matrix** - Next by thread:
**Re: [eigen] How to resize a partially fixed matrix**

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