Re: [eigen] Why doesn't DenseBase have a .cast member function? |

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

*To*: eigen <eigen@xxxxxxxxxxxxxxxxxxx>*Subject*: Re: [eigen] Why doesn't DenseBase have a .cast member function?*From*: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>*Date*: Tue, 10 Jan 2017 17:26:26 +0100*Dkim-signature*: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=/0scVHWrQq5t0nB73zawfPVIGpNuXegXgP7hhAbAUF4=; b=F4ixfAZbq4J5MFY21hzW5DrEV97uudtE/2ONHfL+0EDF6ZtsRA4lLurTNWkU73WkJf LiW0jhI0PWwPwjj5oFNy8kNlrBT4HIQVyH2+ZuDNnshBvS15tqOOTT1wYtsm6pNrPbap 6x7Rew0iiPbHR0QAJZRjriRVFKnHNWJxyqpJbJbBNlwI7mL1scxVIJsPQpJ+kV+aZ9SY rJGas6YEIcqW0Qgk9qpaYXbdSd+BOO1wLDEVFB5yUlkD1WobzZkDTkORp3XaVwPrzYj+ mJuoIJ6RZlxVZilVgkmRzr0PVU6Ov9s/QGHl6VtxPD/ghe9QNXDYkyZxVTALImb1dMV0 jOSw==

BTW, I forgot to keep this thread update, but in the devel branch I've moved all the common unary operator methods to DenseBase. So now DenseBase does have a .cast method.

Shall we backport it to 3.3? (seems harmless)

gael

On Fri, Dec 30, 2016 at 11:02 AM, Gael Guennebaud <gael.guennebaud@xxxxxxxxx> wrote:

Good point. I don't see any reason for not moving plugins/CommonCwiseUnaryOps.h from ArrayBase/MatrixBase to DenseBase. (the file CommonCwiseUnaryOps.h is where cast all all other common coefficient-wise unary methods are declared). I guess that it is currently included in ArrayBase/MatrixBase because of the symmetry with "plugins/CommonCwiseBinaryOps.h", this one cannot be moved to DenseBase because binary operators are only valid between expressions of the same kind (e.g., array+matrix is forbidden). Anyway, it is usually not recommended do directly deal with objects of type DenseBase<Derived>, better cast them to Derived first:template<typename Derived>void foo(const DenseBase<Derived> &_arg) {const Derived &arg(_arg.derived());...}gaelOn Fri, Dec 30, 2016 at 12:56 AM, Alec Jacobson <alecjacobson@xxxxxxxxx> wrote:ArrayBase and MatrixBase do. Does this have something to do with expressions?

**Messages sorted by:**[ date | thread ]- Prev by Date:
**[eigen] Re: Bug(s) report: SparseQR on tall-thin matrices** - Next by Date:
**[eigen] How to subtract a diagonal matrix from a matrix in one expression?** - Previous by thread:
**Re: [eigen] Bug(s) report: SparseQR on tall-thin matrices** - Next by thread:
**[eigen] How to subtract a diagonal matrix from a matrix in one expression?**

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