Re: [eigen] cwise / array |

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

*To*: eigen@xxxxxxxxxxxxxxxxxxx*Subject*: Re: [eigen] cwise / array*From*: "Gael Guennebaud" <gael.guennebaud@xxxxxxxxx>*Date*: Thu, 3 Jul 2008 11:04:55 +0200*Dkim-signature*: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=VIU25eyRt66rgV9J1AL5C6Oa6BwWdwe9pX+dSvjB9gs=; b=A6rl8jNvqNFg24kcZG7ZqJw0+ydWp2T119ACRdmAaUkVqO62sxOacVRAf1uYXIOGiF XRdoV6Hqq6rNmcfH27dX86EXq77SxFsBUj4+tsfQsHW2RkLgwzC9q8uvI3X5FqDqIqcx X55Dz3BLLVh23awmUHaExr4IxkGdEPn7TvZxE=*Domainkey-signature*: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=x4LixUyHMJd1785loW+UzSy0DLau6wrN05Y8/81D55CPbuL9FjBk2sVO7YqZRENWvm DA2uUG3y5Vu56iU0oPS8Xlc6HdpilQfQgab6tX94Xc69oOVpZ5wyF1kfkRd8PPh67IY7 tkwN47L1L7MAed2mW1i7xi6/0z9bzJi2AQcMk=

Hi, On Thu, Jul 3, 2008 at 9:06 AM, Benoît Jacob <jacob@xxxxxxxxxxxxxxx> wrote: > Hi, > > I'd like to harmonize a bit the API for coefficient-wise operations. Currently good idea. > I propose to do: > * rename cwise(functor) to fromUnary(functor) and fromBinary(functor) hm... I don't really like the "from" which could likely be interpreted as a "set from". What about apply*() or maybe just unary(), binary() ? or even unaryExpr(), binaryExpr() ?? (I like the latter ones with "Expr") > * rename create(functor) to fromNullary(functor) this one a static member. BTW, what about naming static members with a upper case for the first letter: MyMatrix::Random(), MyMatrix::Zero(), etc. My point is that currently you can write: Matrix3f a, b; b = a.zero(); this would work but it not clear what you're really doing especially with: b = a.fromNullary(functor); With an upper case: b = a.Zero(); it is immedialtely clear that you're doing something insane. I know this is a quite common coding rule though Qt does not use it (don't known about KDE). Moreover it works pretty well here because then you would write Matrix3f::Zero() which might give you the feeling that Matrix3f::Zero is a nested struct, that is wrong, but pretty close to what actually does Zero(), i.e., creating a "zero" expression. about fromNullary(functor), again it could be simply ::nullary(), ::Nullary(), ::nullaryExpr() or ::NullaryExpr() .... > * rename array() to cwise() why not. > * move all the cwiseSomeMethod() to cwise() so that instead of doing > matrixbase.cwiseSomeMethod() one always does matrixbase.cwise().someMethod() ok > * move the Cwise (formerly Array) proxy class to the Core module, but leave > most of the methods in Array module -- just like the MatrixBase class is in > Core but has methods in other modules. yes, the previous point implies this one > * it then becomes possible to use more operator notation e.g. > matrixbase.cwiseProduct(other) becomes matrixbase.cwise() * other. nice. > I also plan to add square() and cube() functors. square() is the same as abs2 > () in the real case but has a nicer name when it's what's really meant (like > in mandelbrot) and is different in the complex case. cube() is useful at > least in the VDW example so it wouldn't be needed anymore to write a 12-th > power functor, one could just do: > m.cwise().square() > .cwise().square() > .cwise().cube() excellent, I have to say that writing .abs2() sounded a bit strange to me while what I wanted is really a cwise square ! cheers, gael.

**Follow-Ups**:**Re: [eigen] cwise / array***From:*Benoît Jacob

**References**:**[eigen] cwise / array***From:*Benoît Jacob

**Messages sorted by:**[ date | thread ]- Prev by Date:
**Re: [eigen] vectorization and ABI** - Next by Date:
**Re: [eigen] vectorization and ABI** - Previous by thread:
**[eigen] cwise / array** - Next by thread:
**Re: [eigen] cwise / array**

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