Re: [eigen] unpleasant surprise mit math functions |

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

*To*: eigen@xxxxxxxxxxxxxxxxxxx*Subject*: Re: [eigen] unpleasant surprise mit math functions*From*: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>*Date*: Wed, 26 Sep 2012 22:58:56 +0200*Dkim-signature*: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=pS29vIxdbcKlZXbSDFo+QeJ01a8hWV6C7bOEMBV4DkM=; b=CJAqXFxmfoFwPk+aA7iAIyt7v5pyvOCttfzl/+hMxL2F7G8qahJdcdXtgKDizaYa5R v4Ff7vCvtNhNhkq/qM9kshBmRsnBUglVGR1LlsIoO/MaN37krEwaGdwM+FTkDHk+XS9y Gwk92k22PYOKZeDSZ28ofluxJ2REnd+fANrV4yXzRhTAzEx5+0iozAlb+RhD+fQb5HHy u71XXVpX/qnXfftyPUbPGFYE5r90KJnrDAesU0s9ID2u8fk7G3xJNKvTsnwXtEb4g/7J O5Q7TLFOwfWAPRGwZi7LrTH6FuqXJD2NADqiyIT4BT8CClLv+RZsRyHpWHRyeladj4RL eU4w==

On Mon, Sep 24, 2012 at 11:19 AM, Christoph Hertzberg <chtz@xxxxxxxxxxxxxxxxxxxxxxxx> wrote: > On 23.09.2012 15:24, Gael Guennebaud wrote: >> >> thank you Christoph and Karli, that makes perfect sense. So I thought >> the solution would simply to put the "internal" base classes into >> their own namespace. That worked for some expressions, but not for > > > How about putting the math-functions into their own namespace? yes I thought about that option, however I remember seeing some user code relying on them explicitly. I know that's bad and that they should not do so, but if we can find an easy solution that don't break existing code I'd feel better, and in case we would go to take the risk to break anything, I'd rather go for your second point: > And why are they required at all? and remove them. Jitse already raised the same remark a couple of months ago in some related bug report, and I'm also starting to think they should be removed. gael > I remember once users were required to specify ei_sin, etc if they had > custom scalar types and this changed to internal::sin (no pun intended) in > Eigen 3. However, I think it would make much more sense to make them declare > that in the namespace of their class (or in std:: or global, if they prefer) > and this seems to be sufficient at the moment. > Or is it to prevent users from calling sin on integer arrays? I would say > this goes into the category "shot yourself in the foot" and does not > necessarily need to be prohibited by Eigen. Btw: what should happen if I > call sin for a rational number class? > > If you can't/don't want to remove the internal::sin function then you could > provide a function Eigen::sin(const Eigen::EigenBase<Derived>&); which > statically asserts that Derived is an Array-Expression. In general, hoping > that a namespace is hidden does not seem a good way to prohibit function > calls. After all, the user should always be allowed to declare using > Eigen::internal; without producing illegal code. > > >> all. Typically if a template class Expr<Func> defined in namespace A >> is instantiated with a class defined in internal then, all the generic >> functions of internal become readily available for the class Expr. >> >> [...] >> >> >> Did anyone be aware of such a rule? It does not make sense to me, and >> looks rather dangerous. > > > Well, the biggest problem with ADL is that hardly anyone really knows > completely what it does ... > As said above, I would never rely on functions in other namespaces not being > visible. > > > Christoph > > > > -- > ---------------------------------------------- > Dipl.-Inf. Christoph Hertzberg > Cartesium 0.049 > Universität Bremen > Enrique-Schmidt-Straße 5 > 28359 Bremen > > Tel: +49 (421) 218-64252 > ---------------------------------------------- > >

**Follow-Ups**:**Re: [eigen] unpleasant surprise mit math functions***From:*Hauke Heibel

**References**:**[eigen] unpleasant surprise mit math functions***From:*Helmut Jarausch

**Re: [eigen] unpleasant surprise mit math functions***From:*Christoph Hertzberg

**Re: [eigen] unpleasant surprise mit math functions***From:*Gael Guennebaud

**Re: [eigen] unpleasant surprise mit math functions***From:*Helmut Jarausch

**Re: [eigen] unpleasant surprise mit math functions***From:*Gael Guennebaud

**Re: [eigen] unpleasant surprise mit math functions***From:*Christoph Hertzberg

**Messages sorted by:**[ date | thread ]- Prev by Date:
**Re: [eigen] Defining a SparseMatrix with RowMajor** - Next by Date:
**Re: [eigen] unpleasant surprise mit math functions** - Previous by thread:
**Re: [eigen] unpleasant surprise mit math functions** - Next by thread:
**Re: [eigen] unpleasant surprise mit math functions**

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