From 71630b2160a0d654a19fa53e340e12ecb9e1ac66 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Sun, 17 Jan 2010 20:04:49 +0100 Subject: [PATCH] fix MatrixBaseAddons example --- doc/I00_CustomizingEigen.dox | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/doc/I00_CustomizingEigen.dox b/doc/I00_CustomizingEigen.dox index 2c8bb455e..7e6d16de6 100644 --- a/doc/I00_CustomizingEigen.dox +++ b/doc/I00_CustomizingEigen.dox @@ -47,22 +47,24 @@ inline RealScalar distanceTo(const MatrixBase& other) const inline void scaleTo(RealScalar l) { RealScalar vl = norm(); if (vl>1e-9) derived() *= (l/vl); } -inline Transpose transposed() {return transpose();} -inline const Transpose transposed() const {return transpose();} +inline Transpose transposed() {return this->transpose();} +inline const Transpose transposed() const {return this->transpose();} -inline uint minComponentId(void) const { int i; minCoeff(&i); return i; } -inline uint maxComponentId(void) const { int i; maxCoeff(&i); return i; } +inline uint minComponentId(void) const { int i; this->minCoeff(&i); return i; } +inline uint maxComponentId(void) const { int i; this->maxCoeff(&i); return i; } template -void makeFloor(const MatrixBase& other) { derived() = derived().cwise().min(other.derived()); } +void makeFloor(const MatrixBase& other) { derived() = derived().cwiseMin(other.derived()); } template -void makeCeil(const MatrixBase& other) { derived() = derived().cwise().max(other.derived()); } +void makeCeil(const MatrixBase& other) { derived() = derived().cwiseMax(other.derived()); } -const typename Cwise::ScalarAddReturnType -operator+(const Scalar& scalar) const { return cwise() + scalar } +const CwiseUnaryOp, Derived> +operator+(const Scalar& scalar) const +{ return CwiseUnaryOp, Derived>(derived(), ei_scalar_add_op(scalar)); } -friend const typename Cwise::ScalarAddReturnType -operator+(const Scalar& scalar, const MatrixBase& mat) { return mat + scalar; } +friend const CwiseUnaryOp, Derived> +operator+(const Scalar& scalar, const MatrixBase& mat) +{ return CwiseUnaryOp, Derived>(mat.derived(), ei_scalar_add_op(scalar)); } \endcode Then one can the following declaration in the config.h or whatever prerequisites header file of his project: