diff options
author | Gael Guennebaud <g.gael@free.fr> | 2012-06-28 02:08:59 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2012-06-28 02:08:59 +0200 |
commit | a2ace4b79ad7a496ca22221ecad48f1c2748f261 (patch) | |
tree | 5e657b48e936b5c50a88acda5ba61d058aae9c2c /Eigen/src | |
parent | cc964b6cafab1a28ba0b5773c4a1bf7d037ff051 (diff) |
bug #482: pass scalar arguments by const references. This changeset only concerns the Core and Geometry modules
Diffstat (limited to 'Eigen/src')
-rw-r--r-- | Eigen/src/Core/CwiseNullaryOp.h | 10 | ||||
-rw-r--r-- | Eigen/src/Core/DenseBase.h | 14 | ||||
-rw-r--r-- | Eigen/src/Core/DiagonalMatrix.h | 2 | ||||
-rw-r--r-- | Eigen/src/Core/Dot.h | 4 | ||||
-rw-r--r-- | Eigen/src/Core/Fuzzy.h | 18 | ||||
-rw-r--r-- | Eigen/src/Core/MatrixBase.h | 14 | ||||
-rw-r--r-- | Eigen/src/Core/ProductBase.h | 4 | ||||
-rw-r--r-- | Eigen/src/Core/TriangularMatrix.h | 4 | ||||
-rw-r--r-- | Eigen/src/Geometry/AngleAxis.h | 4 | ||||
-rw-r--r-- | Eigen/src/Geometry/Hyperplane.h | 4 | ||||
-rw-r--r-- | Eigen/src/Geometry/ParametrizedLine.h | 4 | ||||
-rw-r--r-- | Eigen/src/Geometry/Quaternion.h | 4 | ||||
-rw-r--r-- | Eigen/src/Geometry/Rotation2D.h | 6 | ||||
-rw-r--r-- | Eigen/src/Geometry/Scaling.h | 6 | ||||
-rw-r--r-- | Eigen/src/Geometry/Transform.h | 18 |
15 files changed, 58 insertions, 58 deletions
diff --git a/Eigen/src/Core/CwiseNullaryOp.h b/Eigen/src/Core/CwiseNullaryOp.h index 60def3b59..a3a3238d2 100644 --- a/Eigen/src/Core/CwiseNullaryOp.h +++ b/Eigen/src/Core/CwiseNullaryOp.h @@ -310,7 +310,7 @@ DenseBase<Derived>::LinSpaced(const Scalar& low, const Scalar& high) /** \returns true if all coefficients in this matrix are approximately equal to \a value, to within precision \a prec */ template<typename Derived> bool DenseBase<Derived>::isApproxToConstant -(const Scalar& val, RealScalar prec) const +(const Scalar& val, const RealScalar& prec) const { for(Index j = 0; j < cols(); ++j) for(Index i = 0; i < rows(); ++i) @@ -324,7 +324,7 @@ bool DenseBase<Derived>::isApproxToConstant * \returns true if all coefficients in this matrix are approximately equal to \a value, to within precision \a prec */ template<typename Derived> bool DenseBase<Derived>::isConstant -(const Scalar& val, RealScalar prec) const +(const Scalar& val, const RealScalar& prec) const { return isApproxToConstant(val, prec); } @@ -494,7 +494,7 @@ DenseBase<Derived>::Zero() * \sa class CwiseNullaryOp, Zero() */ template<typename Derived> -bool DenseBase<Derived>::isZero(RealScalar prec) const +bool DenseBase<Derived>::isZero(const RealScalar& prec) const { for(Index j = 0; j < cols(); ++j) for(Index i = 0; i < rows(); ++i) @@ -624,7 +624,7 @@ DenseBase<Derived>::Ones() */ template<typename Derived> bool DenseBase<Derived>::isOnes -(RealScalar prec) const +(const RealScalar& prec) const { return isApproxToConstant(Scalar(1), prec); } @@ -729,7 +729,7 @@ MatrixBase<Derived>::Identity() */ template<typename Derived> bool MatrixBase<Derived>::isIdentity -(RealScalar prec) const +(const RealScalar& prec) const { for(Index j = 0; j < cols(); ++j) { diff --git a/Eigen/src/Core/DenseBase.h b/Eigen/src/Core/DenseBase.h index 4ff091770..2703f8138 100644 --- a/Eigen/src/Core/DenseBase.h +++ b/Eigen/src/Core/DenseBase.h @@ -363,17 +363,17 @@ template<typename Derived> class DenseBase template<typename OtherDerived> bool isApprox(const DenseBase<OtherDerived>& other, - RealScalar prec = NumTraits<Scalar>::dummy_precision()) const; + const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const; bool isMuchSmallerThan(const RealScalar& other, - RealScalar prec = NumTraits<Scalar>::dummy_precision()) const; + const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const; template<typename OtherDerived> bool isMuchSmallerThan(const DenseBase<OtherDerived>& other, - RealScalar prec = NumTraits<Scalar>::dummy_precision()) const; + const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const; - bool isApproxToConstant(const Scalar& value, RealScalar prec = NumTraits<Scalar>::dummy_precision()) const; - bool isConstant(const Scalar& value, RealScalar prec = NumTraits<Scalar>::dummy_precision()) const; - bool isZero(RealScalar prec = NumTraits<Scalar>::dummy_precision()) const; - bool isOnes(RealScalar prec = NumTraits<Scalar>::dummy_precision()) const; + bool isApproxToConstant(const Scalar& value, const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const; + bool isConstant(const Scalar& value, const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const; + bool isZero(const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const; + bool isOnes(const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const; inline Derived& operator*=(const Scalar& other); inline Derived& operator/=(const Scalar& other); diff --git a/Eigen/src/Core/DiagonalMatrix.h b/Eigen/src/Core/DiagonalMatrix.h index c4f758d54..81fb4d913 100644 --- a/Eigen/src/Core/DiagonalMatrix.h +++ b/Eigen/src/Core/DiagonalMatrix.h @@ -287,7 +287,7 @@ MatrixBase<Derived>::asDiagonal() const * \sa asDiagonal() */ template<typename Derived> -bool MatrixBase<Derived>::isDiagonal(RealScalar prec) const +bool MatrixBase<Derived>::isDiagonal(const RealScalar& prec) const { if(cols() != rows()) return false; RealScalar maxAbsOnDiagonal = static_cast<RealScalar>(-1); diff --git a/Eigen/src/Core/Dot.h b/Eigen/src/Core/Dot.h index 67dbbf8ba..1bebaa684 100644 --- a/Eigen/src/Core/Dot.h +++ b/Eigen/src/Core/Dot.h @@ -238,7 +238,7 @@ MatrixBase<Derived>::lpNorm() const template<typename Derived> template<typename OtherDerived> bool MatrixBase<Derived>::isOrthogonal -(const MatrixBase<OtherDerived>& other, RealScalar prec) const +(const MatrixBase<OtherDerived>& other, const RealScalar& prec) const { typename internal::nested<Derived,2>::type nested(derived()); typename internal::nested<OtherDerived,2>::type otherNested(other.derived()); @@ -257,7 +257,7 @@ bool MatrixBase<Derived>::isOrthogonal * Output: \verbinclude MatrixBase_isUnitary.out */ template<typename Derived> -bool MatrixBase<Derived>::isUnitary(RealScalar prec) const +bool MatrixBase<Derived>::isUnitary(const RealScalar& prec) const { typename Derived::Nested nested(derived()); for(Index i = 0; i < cols(); ++i) diff --git a/Eigen/src/Core/Fuzzy.h b/Eigen/src/Core/Fuzzy.h index 887641163..e0f93bf3d 100644 --- a/Eigen/src/Core/Fuzzy.h +++ b/Eigen/src/Core/Fuzzy.h @@ -34,7 +34,7 @@ namespace internal template<typename Derived, typename OtherDerived, bool is_integer = NumTraits<typename Derived::Scalar>::IsInteger> struct isApprox_selector { - static bool run(const Derived& x, const OtherDerived& y, typename Derived::RealScalar prec) + static bool run(const Derived& x, const OtherDerived& y, const typename Derived::RealScalar& prec) { using std::min; typename internal::nested<Derived,2>::type nested(x); @@ -46,7 +46,7 @@ struct isApprox_selector template<typename Derived, typename OtherDerived> struct isApprox_selector<Derived, OtherDerived, true> { - static bool run(const Derived& x, const OtherDerived& y, typename Derived::RealScalar) + static bool run(const Derived& x, const OtherDerived& y, const typename Derived::RealScalar&) { return x.matrix() == y.matrix(); } @@ -55,7 +55,7 @@ struct isApprox_selector<Derived, OtherDerived, true> template<typename Derived, typename OtherDerived, bool is_integer = NumTraits<typename Derived::Scalar>::IsInteger> struct isMuchSmallerThan_object_selector { - static bool run(const Derived& x, const OtherDerived& y, typename Derived::RealScalar prec) + static bool run(const Derived& x, const OtherDerived& y, const typename Derived::RealScalar& prec) { return x.cwiseAbs2().sum() <= abs2(prec) * y.cwiseAbs2().sum(); } @@ -64,7 +64,7 @@ struct isMuchSmallerThan_object_selector template<typename Derived, typename OtherDerived> struct isMuchSmallerThan_object_selector<Derived, OtherDerived, true> { - static bool run(const Derived& x, const OtherDerived&, typename Derived::RealScalar) + static bool run(const Derived& x, const OtherDerived&, const typename Derived::RealScalar&) { return x.matrix() == Derived::Zero(x.rows(), x.cols()).matrix(); } @@ -73,7 +73,7 @@ struct isMuchSmallerThan_object_selector<Derived, OtherDerived, true> template<typename Derived, bool is_integer = NumTraits<typename Derived::Scalar>::IsInteger> struct isMuchSmallerThan_scalar_selector { - static bool run(const Derived& x, const typename Derived::RealScalar& y, typename Derived::RealScalar prec) + static bool run(const Derived& x, const typename Derived::RealScalar& y, const typename Derived::RealScalar& prec) { return x.cwiseAbs2().sum() <= abs2(prec * y); } @@ -82,7 +82,7 @@ struct isMuchSmallerThan_scalar_selector template<typename Derived> struct isMuchSmallerThan_scalar_selector<Derived, true> { - static bool run(const Derived& x, const typename Derived::RealScalar&, typename Derived::RealScalar) + static bool run(const Derived& x, const typename Derived::RealScalar&, const typename Derived::RealScalar&) { return x.matrix() == Derived::Zero(x.rows(), x.cols()).matrix(); } @@ -112,7 +112,7 @@ template<typename Derived> template<typename OtherDerived> bool DenseBase<Derived>::isApprox( const DenseBase<OtherDerived>& other, - RealScalar prec + const RealScalar& prec ) const { return internal::isApprox_selector<Derived, OtherDerived>::run(derived(), other.derived(), prec); @@ -134,7 +134,7 @@ bool DenseBase<Derived>::isApprox( template<typename Derived> bool DenseBase<Derived>::isMuchSmallerThan( const typename NumTraits<Scalar>::Real& other, - RealScalar prec + const RealScalar& prec ) const { return internal::isMuchSmallerThan_scalar_selector<Derived>::run(derived(), other, prec); @@ -154,7 +154,7 @@ template<typename Derived> template<typename OtherDerived> bool DenseBase<Derived>::isMuchSmallerThan( const DenseBase<OtherDerived>& other, - RealScalar prec + const RealScalar& prec ) const { return internal::isMuchSmallerThan_object_selector<Derived, OtherDerived>::run(derived(), other.derived(), prec); diff --git a/Eigen/src/Core/MatrixBase.h b/Eigen/src/Core/MatrixBase.h index 5a744c5ec..cdaedb92f 100644 --- a/Eigen/src/Core/MatrixBase.h +++ b/Eigen/src/Core/MatrixBase.h @@ -270,7 +270,7 @@ template<typename Derived> class MatrixBase template<unsigned int UpLo> typename ConstSelfAdjointViewReturnType<UpLo>::Type selfadjointView() const; const SparseView<Derived> sparseView(const Scalar& m_reference = Scalar(0), - typename NumTraits<Scalar>::Real m_epsilon = NumTraits<Scalar>::dummy_precision()) const; + const typename NumTraits<Scalar>::Real& m_epsilon = NumTraits<Scalar>::dummy_precision()) const; static const IdentityReturnType Identity(); static const IdentityReturnType Identity(Index rows, Index cols); static const BasisReturnType Unit(Index size, Index i); @@ -286,16 +286,16 @@ template<typename Derived> class MatrixBase Derived& setIdentity(); Derived& setIdentity(Index rows, Index cols); - bool isIdentity(RealScalar prec = NumTraits<Scalar>::dummy_precision()) const; - bool isDiagonal(RealScalar prec = NumTraits<Scalar>::dummy_precision()) const; + bool isIdentity(const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const; + bool isDiagonal(const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const; - bool isUpperTriangular(RealScalar prec = NumTraits<Scalar>::dummy_precision()) const; - bool isLowerTriangular(RealScalar prec = NumTraits<Scalar>::dummy_precision()) const; + bool isUpperTriangular(const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const; + bool isLowerTriangular(const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const; template<typename OtherDerived> bool isOrthogonal(const MatrixBase<OtherDerived>& other, - RealScalar prec = NumTraits<Scalar>::dummy_precision()) const; - bool isUnitary(RealScalar prec = NumTraits<Scalar>::dummy_precision()) const; + const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const; + bool isUnitary(const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const; /** \returns true if each coefficients of \c *this and \a other are all exactly equal. * \warning When using floating point scalar values you probably should rather use a diff --git a/Eigen/src/Core/ProductBase.h b/Eigen/src/Core/ProductBase.h index ee00d9c97..8194354de 100644 --- a/Eigen/src/Core/ProductBase.h +++ b/Eigen/src/Core/ProductBase.h @@ -216,7 +216,7 @@ operator*(const ProductBase<Derived,Lhs,Rhs>& prod, typename Derived::Scalar x) template<typename Derived,typename Lhs,typename Rhs> typename internal::enable_if<!internal::is_same<typename Derived::Scalar,typename Derived::RealScalar>::value, const ScaledProduct<Derived> >::type -operator*(const ProductBase<Derived,Lhs,Rhs>& prod, typename Derived::RealScalar x) +operator*(const ProductBase<Derived,Lhs,Rhs>& prod, const typename Derived::RealScalar& x) { return ScaledProduct<Derived>(prod.derived(), x); } @@ -228,7 +228,7 @@ operator*(typename Derived::Scalar x,const ProductBase<Derived,Lhs,Rhs>& prod) template<typename Derived,typename Lhs,typename Rhs> typename internal::enable_if<!internal::is_same<typename Derived::Scalar,typename Derived::RealScalar>::value, const ScaledProduct<Derived> >::type -operator*(typename Derived::RealScalar x,const ProductBase<Derived,Lhs,Rhs>& prod) +operator*(const typename Derived::RealScalar& x,const ProductBase<Derived,Lhs,Rhs>& prod) { return ScaledProduct<Derived>(prod.derived(), x); } namespace internal { diff --git a/Eigen/src/Core/TriangularMatrix.h b/Eigen/src/Core/TriangularMatrix.h index 5e97e4052..8454e1f3d 100644 --- a/Eigen/src/Core/TriangularMatrix.h +++ b/Eigen/src/Core/TriangularMatrix.h @@ -793,7 +793,7 @@ MatrixBase<Derived>::triangularView() const * \sa isLowerTriangular() */ template<typename Derived> -bool MatrixBase<Derived>::isUpperTriangular(RealScalar prec) const +bool MatrixBase<Derived>::isUpperTriangular(const RealScalar& prec) const { RealScalar maxAbsOnUpperPart = static_cast<RealScalar>(-1); for(Index j = 0; j < cols(); ++j) @@ -818,7 +818,7 @@ bool MatrixBase<Derived>::isUpperTriangular(RealScalar prec) const * \sa isUpperTriangular() */ template<typename Derived> -bool MatrixBase<Derived>::isLowerTriangular(RealScalar prec) const +bool MatrixBase<Derived>::isLowerTriangular(const RealScalar& prec) const { RealScalar maxAbsOnLowerPart = static_cast<RealScalar>(-1); for(Index j = 0; j < cols(); ++j) diff --git a/Eigen/src/Geometry/AngleAxis.h b/Eigen/src/Geometry/AngleAxis.h index f0e3ff2b3..0631d6df9 100644 --- a/Eigen/src/Geometry/AngleAxis.h +++ b/Eigen/src/Geometry/AngleAxis.h @@ -91,7 +91,7 @@ public: * \warning If the \a axis vector is not normalized, then the angle-axis object * represents an invalid rotation. */ template<typename Derived> - inline AngleAxis(Scalar angle, const MatrixBase<Derived>& axis) : m_axis(axis), m_angle(angle) {} + inline AngleAxis(const Scalar& angle, const MatrixBase<Derived>& axis) : m_axis(axis), m_angle(angle) {} /** Constructs and initialize the angle-axis rotation from a quaternion \a q. */ template<typename QuatDerived> inline explicit AngleAxis(const QuaternionBase<QuatDerived>& q) { *this = q; } /** Constructs and initialize the angle-axis rotation from a 3x3 rotation matrix. */ @@ -152,7 +152,7 @@ public: * determined by \a prec. * * \sa MatrixBase::isApprox() */ - bool isApprox(const AngleAxis& other, typename NumTraits<Scalar>::Real prec = NumTraits<Scalar>::dummy_precision()) const + bool isApprox(const AngleAxis& other, const typename NumTraits<Scalar>::Real& prec = NumTraits<Scalar>::dummy_precision()) const { return m_axis.isApprox(other.m_axis, prec) && internal::isApprox(m_angle,other.m_angle, prec); } }; diff --git a/Eigen/src/Geometry/Hyperplane.h b/Eigen/src/Geometry/Hyperplane.h index 6abf1664d..108966d37 100644 --- a/Eigen/src/Geometry/Hyperplane.h +++ b/Eigen/src/Geometry/Hyperplane.h @@ -90,7 +90,7 @@ public: * such that the algebraic equation of the plane is \f$ n \cdot x + d = 0 \f$. * \warning the vector normal is assumed to be normalized. */ - inline Hyperplane(const VectorType& n, Scalar d) + inline Hyperplane(const VectorType& n, const Scalar& d) : m_coeffs(n.size()+1) { normal() = n; @@ -271,7 +271,7 @@ public: * * \sa MatrixBase::isApprox() */ template<int OtherOptions> - bool isApprox(const Hyperplane<Scalar,AmbientDimAtCompileTime,OtherOptions>& other, typename NumTraits<Scalar>::Real prec = NumTraits<Scalar>::dummy_precision()) const + bool isApprox(const Hyperplane<Scalar,AmbientDimAtCompileTime,OtherOptions>& other, const typename NumTraits<Scalar>::Real& prec = NumTraits<Scalar>::dummy_precision()) const { return m_coeffs.isApprox(other.m_coeffs, prec); } protected: diff --git a/Eigen/src/Geometry/ParametrizedLine.h b/Eigen/src/Geometry/ParametrizedLine.h index ddbda83dc..1a265b787 100644 --- a/Eigen/src/Geometry/ParametrizedLine.h +++ b/Eigen/src/Geometry/ParametrizedLine.h @@ -108,7 +108,7 @@ public: VectorType projection(const VectorType& p) const { return origin() + direction().dot(p-origin()) * direction(); } - VectorType pointAt( Scalar t ) const; + VectorType pointAt(const Scalar& t) const; template <int OtherOptions> Scalar intersectionParameter(const Hyperplane<_Scalar, _AmbientDim, OtherOptions>& hyperplane) const; @@ -169,7 +169,7 @@ inline ParametrizedLine<_Scalar, _AmbientDim,_Options>::ParametrizedLine(const H */ template <typename _Scalar, int _AmbientDim, int _Options> inline typename ParametrizedLine<_Scalar, _AmbientDim,_Options>::VectorType -ParametrizedLine<_Scalar, _AmbientDim,_Options>::pointAt( _Scalar t ) const +ParametrizedLine<_Scalar, _AmbientDim,_Options>::pointAt(const _Scalar& t) const { return origin() + (direction()*t); } diff --git a/Eigen/src/Geometry/Quaternion.h b/Eigen/src/Geometry/Quaternion.h index 75083363c..1ffef63a7 100644 --- a/Eigen/src/Geometry/Quaternion.h +++ b/Eigen/src/Geometry/Quaternion.h @@ -176,7 +176,7 @@ public: * * \sa MatrixBase::isApprox() */ template<class OtherDerived> - bool isApprox(const QuaternionBase<OtherDerived>& other, RealScalar prec = NumTraits<Scalar>::dummy_precision()) const + bool isApprox(const QuaternionBase<OtherDerived>& other, const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const { return coeffs().isApprox(other.coeffs(), prec); } /** return the result vector of \a v through the rotation*/ @@ -263,7 +263,7 @@ public: * while internally the coefficients are stored in the following order: * [\c x, \c y, \c z, \c w] */ - inline Quaternion(Scalar w, Scalar x, Scalar y, Scalar z) : m_coeffs(x, y, z, w){} + inline Quaternion(const Scalar& w, const Scalar& x, const Scalar& y, const Scalar& z) : m_coeffs(x, y, z, w){} /** Constructs and initialize a quaternion from the array data */ inline Quaternion(const Scalar* data) : m_coeffs(data) {} diff --git a/Eigen/src/Geometry/Rotation2D.h b/Eigen/src/Geometry/Rotation2D.h index 4339e0f0f..154c3d853 100644 --- a/Eigen/src/Geometry/Rotation2D.h +++ b/Eigen/src/Geometry/Rotation2D.h @@ -74,7 +74,7 @@ protected: public: /** Construct a 2D counter clock wise rotation from the angle \a a in radian. */ - inline Rotation2D(Scalar a) : m_angle(a) {} + inline Rotation2D(const Scalar& a) : m_angle(a) {} /** \returns the rotation angle */ inline Scalar angle() const { return m_angle; } @@ -104,7 +104,7 @@ public: /** \returns the spherical interpolation between \c *this and \a other using * parameter \a t. It is in fact equivalent to a linear interpolation. */ - inline Rotation2D slerp(Scalar t, const Rotation2D& other) const + inline Rotation2D slerp(const Scalar& t, const Rotation2D& other) const { return m_angle * (1-t) + other.angle() * t; } /** \returns \c *this with scalar type casted to \a NewScalarType @@ -129,7 +129,7 @@ public: * determined by \a prec. * * \sa MatrixBase::isApprox() */ - bool isApprox(const Rotation2D& other, typename NumTraits<Scalar>::Real prec = NumTraits<Scalar>::dummy_precision()) const + bool isApprox(const Rotation2D& other, const typename NumTraits<Scalar>::Real& prec = NumTraits<Scalar>::dummy_precision()) const { return internal::isApprox(m_angle,other.m_angle, prec); } }; diff --git a/Eigen/src/Geometry/Scaling.h b/Eigen/src/Geometry/Scaling.h index 080f33794..3d4b254ca 100644 --- a/Eigen/src/Geometry/Scaling.h +++ b/Eigen/src/Geometry/Scaling.h @@ -109,7 +109,7 @@ public: * determined by \a prec. * * \sa MatrixBase::isApprox() */ - bool isApprox(const UniformScaling& other, typename NumTraits<Scalar>::Real prec = NumTraits<Scalar>::dummy_precision()) const + bool isApprox(const UniformScaling& other, const typename NumTraits<Scalar>::Real& prec = NumTraits<Scalar>::dummy_precision()) const { return internal::isApprox(m_factor, other.factor(), prec); } }; @@ -132,11 +132,11 @@ static inline UniformScaling<std::complex<RealScalar> > Scaling(const std::compl /** Constructs a 2D axis aligned scaling */ template<typename Scalar> -static inline DiagonalMatrix<Scalar,2> Scaling(Scalar sx, Scalar sy) +static inline DiagonalMatrix<Scalar,2> Scaling(const Scalar& sx, const Scalar& sy) { return DiagonalMatrix<Scalar,2>(sx, sy); } /** Constructs a 3D axis aligned scaling */ template<typename Scalar> -static inline DiagonalMatrix<Scalar,3> Scaling(Scalar sx, Scalar sy, Scalar sz) +static inline DiagonalMatrix<Scalar,3> Scaling(const Scalar& sx, const Scalar& sy, const Scalar& sz) { return DiagonalMatrix<Scalar,3>(sx, sy, sz); } /** Constructs an axis aligned scaling expression from vector expression \a coeffs diff --git a/Eigen/src/Geometry/Transform.h b/Eigen/src/Geometry/Transform.h index e81305ccc..c4ebe00d2 100644 --- a/Eigen/src/Geometry/Transform.h +++ b/Eigen/src/Geometry/Transform.h @@ -521,8 +521,8 @@ public: template<typename OtherDerived> inline Transform& prescale(const MatrixBase<OtherDerived> &other); - inline Transform& scale(Scalar s); - inline Transform& prescale(Scalar s); + inline Transform& scale(const Scalar& s); + inline Transform& prescale(const Scalar& s); template<typename OtherDerived> inline Transform& translate(const MatrixBase<OtherDerived> &other); @@ -536,8 +536,8 @@ public: template<typename RotationType> inline Transform& prerotate(const RotationType& rotation); - Transform& shear(Scalar sx, Scalar sy); - Transform& preshear(Scalar sx, Scalar sy); + Transform& shear(const Scalar& sx, const Scalar& sy); + Transform& preshear(const Scalar& sx, const Scalar& sy); inline Transform& operator=(const TranslationType& t); inline Transform& operator*=(const TranslationType& t) { return translate(t.vector()); } @@ -594,7 +594,7 @@ public: * determined by \a prec. * * \sa MatrixBase::isApprox() */ - bool isApprox(const Transform& other, typename NumTraits<Scalar>::Real prec = NumTraits<Scalar>::dummy_precision()) const + bool isApprox(const Transform& other, const typename NumTraits<Scalar>::Real& prec = NumTraits<Scalar>::dummy_precision()) const { return m_matrix.isApprox(other.m_matrix, prec); } /** Sets the last row to [0 ... 0 1] @@ -804,7 +804,7 @@ Transform<Scalar,Dim,Mode,Options>::scale(const MatrixBase<OtherDerived> &other) * \sa prescale(Scalar) */ template<typename Scalar, int Dim, int Mode, int Options> -inline Transform<Scalar,Dim,Mode,Options>& Transform<Scalar,Dim,Mode,Options>::scale(Scalar s) +inline Transform<Scalar,Dim,Mode,Options>& Transform<Scalar,Dim,Mode,Options>::scale(const Scalar& s) { EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS) linearExt() *= s; @@ -831,7 +831,7 @@ Transform<Scalar,Dim,Mode,Options>::prescale(const MatrixBase<OtherDerived> &oth * \sa scale(Scalar) */ template<typename Scalar, int Dim, int Mode, int Options> -inline Transform<Scalar,Dim,Mode,Options>& Transform<Scalar,Dim,Mode,Options>::prescale(Scalar s) +inline Transform<Scalar,Dim,Mode,Options>& Transform<Scalar,Dim,Mode,Options>::prescale(const Scalar& s) { EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS) m_matrix.template topRows<Dim>() *= s; @@ -919,7 +919,7 @@ Transform<Scalar,Dim,Mode,Options>::prerotate(const RotationType& rotation) */ template<typename Scalar, int Dim, int Mode, int Options> Transform<Scalar,Dim,Mode,Options>& -Transform<Scalar,Dim,Mode,Options>::shear(Scalar sx, Scalar sy) +Transform<Scalar,Dim,Mode,Options>::shear(const Scalar& sx, const Scalar& sy) { EIGEN_STATIC_ASSERT(int(Dim)==2, YOU_MADE_A_PROGRAMMING_MISTAKE) EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS) @@ -935,7 +935,7 @@ Transform<Scalar,Dim,Mode,Options>::shear(Scalar sx, Scalar sy) */ template<typename Scalar, int Dim, int Mode, int Options> Transform<Scalar,Dim,Mode,Options>& -Transform<Scalar,Dim,Mode,Options>::preshear(Scalar sx, Scalar sy) +Transform<Scalar,Dim,Mode,Options>::preshear(const Scalar& sx, const Scalar& sy) { EIGEN_STATIC_ASSERT(int(Dim)==2, YOU_MADE_A_PROGRAMMING_MISTAKE) EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS) |