From 12a1313b09bcfdddc2cda311d6cb29b2accc2763 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Mon, 25 Feb 2013 18:05:57 +0100 Subject: bug #482: pass scalar arguments by const references. Still remains a few cases that might affect the ABI (see the bug entry) --- Eigen/src/Cholesky/LDLT.h | 10 +++++----- Eigen/src/Core/Functors.h | 6 +++--- Eigen/src/Core/GeneralProduct.h | 14 +++++++------- Eigen/src/Core/ProductBase.h | 6 +++--- Eigen/src/Core/products/GeneralMatrixMatrix.h | 4 ++-- Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h | 6 +++--- Eigen/src/Core/products/SelfadjointMatrixMatrix.h | 8 ++++---- Eigen/src/Core/products/SelfadjointMatrixVector.h | 4 ++-- Eigen/src/Core/products/SelfadjointProduct.h | 8 ++++---- Eigen/src/Core/products/SelfadjointRank2Update.h | 4 ++-- Eigen/src/Core/products/TriangularMatrixMatrix.h | 8 ++++---- Eigen/src/Core/products/TriangularMatrixVector.h | 12 ++++++------ Eigen/src/Eigenvalues/ComplexEigenSolver.h | 4 ++-- Eigen/src/Eigenvalues/EigenSolver.h | 2 +- Eigen/src/Eigenvalues/RealSchur.h | 8 ++++---- Eigen/src/Geometry/AlignedBox.h | 2 +- Eigen/src/IterativeLinearSolvers/IncompleteLUT.h | 6 +++--- Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h | 2 +- Eigen/src/Jacobi/Jacobi.h | 4 ++-- Eigen/src/SPQRSupport/SuiteSparseQRSupport.h | 2 +- Eigen/src/SparseCore/AmbiVector.h | 2 +- Eigen/src/SparseLU/SparseLU.h | 2 +- Eigen/src/SparseLU/SparseLUImpl.h | 2 +- Eigen/src/SparseLU/SparseLU_pivotL.h | 2 +- blas/level2_cplx_impl.h | 2 +- blas/level2_impl.h | 2 +- blas/level2_real_impl.h | 2 +- blas/level3_impl.h | 6 +++--- 28 files changed, 70 insertions(+), 70 deletions(-) diff --git a/Eigen/src/Cholesky/LDLT.h b/Eigen/src/Cholesky/LDLT.h index 219a0e8b9..4c0be9dd9 100644 --- a/Eigen/src/Cholesky/LDLT.h +++ b/Eigen/src/Cholesky/LDLT.h @@ -196,7 +196,7 @@ template class LDLT LDLT& compute(const MatrixType& matrix); template - LDLT& rankUpdate(const MatrixBase& w,RealScalar alpha=1); + LDLT& rankUpdate(const MatrixBase& w, const RealScalar& alpha=1); /** \returns the internal LDLT decomposition matrix * @@ -347,7 +347,7 @@ template<> struct ldlt_inplace // Here only rank-1 updates are implemented, to reduce the // requirement for intermediate storage and improve accuracy template - static bool updateInPlace(MatrixType& mat, MatrixBase& w, typename MatrixType::RealScalar sigma=1) + static bool updateInPlace(MatrixType& mat, MatrixBase& w, const typename MatrixType::RealScalar& sigma=1) { using internal::isfinite; typedef typename MatrixType::Scalar Scalar; @@ -386,7 +386,7 @@ template<> struct ldlt_inplace } template - static bool update(MatrixType& mat, const TranspositionType& transpositions, Workspace& tmp, const WType& w, typename MatrixType::RealScalar sigma=1) + static bool update(MatrixType& mat, const TranspositionType& transpositions, Workspace& tmp, const WType& w, const typename MatrixType::RealScalar& sigma=1) { // Apply the permutation to the input w tmp = transpositions * w; @@ -405,7 +405,7 @@ template<> struct ldlt_inplace } template - static EIGEN_STRONG_INLINE bool update(MatrixType& mat, TranspositionType& transpositions, Workspace& tmp, WType& w, typename MatrixType::RealScalar sigma=1) + static EIGEN_STRONG_INLINE bool update(MatrixType& mat, TranspositionType& transpositions, Workspace& tmp, WType& w, const typename MatrixType::RealScalar& sigma=1) { Transpose matt(mat); return ldlt_inplace::update(matt, transpositions, tmp, w.conjugate(), sigma); @@ -457,7 +457,7 @@ LDLT& LDLT::compute(const MatrixType& a) */ template template -LDLT& LDLT::rankUpdate(const MatrixBase& w,typename NumTraits::Real sigma) +LDLT& LDLT::rankUpdate(const MatrixBase& w, const typename NumTraits::Real& sigma) { const Index size = w.rows(); if (m_isInitialized) diff --git a/Eigen/src/Core/Functors.h b/Eigen/src/Core/Functors.h index f54c574e2..147df3a50 100644 --- a/Eigen/src/Core/Functors.h +++ b/Eigen/src/Core/Functors.h @@ -551,7 +551,7 @@ struct linspaced_op_impl { typedef typename packet_traits::type Packet; - linspaced_op_impl(Scalar low, Scalar step) : + linspaced_op_impl(const Scalar& low, const Scalar& step) : m_low(low), m_step(step), m_packetStep(pset1(packet_traits::size*step)), m_base(padd(pset1(low), pmul(pset1(step),plset(-packet_traits::size)))) {} @@ -580,7 +580,7 @@ struct linspaced_op_impl { typedef typename packet_traits::type Packet; - linspaced_op_impl(Scalar low, Scalar step) : + linspaced_op_impl(const Scalar& low, const Scalar& step) : m_low(low), m_step(step), m_lowPacket(pset1(m_low)), m_stepPacket(pset1(m_step)), m_interPacket(plset(0)) {} @@ -609,7 +609,7 @@ template struct functor_traits< linspaced_o template struct linspaced_op { typedef typename packet_traits::type Packet; - linspaced_op(Scalar low, Scalar high, int num_steps) : impl((num_steps==1 ? high : low), (num_steps==1 ? Scalar() : (high-low)/(num_steps-1))) {} + linspaced_op(const Scalar& low, const Scalar& high, int num_steps) : impl((num_steps==1 ? high : low), (num_steps==1 ? Scalar() : (high-low)/(num_steps-1))) {} template EIGEN_STRONG_INLINE const Scalar operator() (Index i) const { return impl(i); } diff --git a/Eigen/src/Core/GeneralProduct.h b/Eigen/src/Core/GeneralProduct.h index 06fb8e6c0..086eac32d 100644 --- a/Eigen/src/Core/GeneralProduct.h +++ b/Eigen/src/Core/GeneralProduct.h @@ -270,7 +270,7 @@ class GeneralProduct internal::outer_product_selector<(int(Dest::Flags)&RowMajorBit) ? RowMajor : ColMajor>::run(*this, dest, sub()); } - template void scaleAndAddTo(Dest& dest, Scalar alpha) const + template void scaleAndAddTo(Dest& dest, const Scalar& alpha) const { internal::outer_product_selector<(int(Dest::Flags)&RowMajorBit) ? RowMajor : ColMajor>::run(*this, dest, adds(alpha)); } @@ -346,7 +346,7 @@ class GeneralProduct enum { Side = Lhs::IsVectorAtCompileTime ? OnTheLeft : OnTheRight }; typedef typename internal::conditional::type MatrixType; - template void scaleAndAddTo(Dest& dst, Scalar alpha) const + template void scaleAndAddTo(Dest& dst, const Scalar& alpha) const { eigen_assert(m_lhs.rows() == dst.rows() && m_rhs.cols() == dst.cols()); internal::gemv_selector struct gemv_selector { template - static void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha) + static void run(const ProductType& prod, Dest& dest, const typename ProductType::Scalar& alpha) { Transpose destT(dest); enum { OtherStorageOrder = StorageOrder == RowMajor ? ColMajor : RowMajor }; @@ -410,7 +410,7 @@ struct gemv_static_vector_if template<> struct gemv_selector { template - static inline void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha) + static inline void run(const ProductType& prod, Dest& dest, const typename ProductType::Scalar& alpha) { typedef typename ProductType::Index Index; typedef typename ProductType::LhsScalar LhsScalar; @@ -483,7 +483,7 @@ template<> struct gemv_selector template<> struct gemv_selector { template - static void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha) + static void run(const ProductType& prod, Dest& dest, const typename ProductType::Scalar& alpha) { typedef typename ProductType::LhsScalar LhsScalar; typedef typename ProductType::RhsScalar RhsScalar; @@ -534,7 +534,7 @@ template<> struct gemv_selector template<> struct gemv_selector { template - static void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha) + static void run(const ProductType& prod, Dest& dest, const typename ProductType::Scalar& alpha) { typedef typename Dest::Index Index; // TODO makes sure dest is sequentially stored in memory, otherwise use a temp @@ -547,7 +547,7 @@ template<> struct gemv_selector template<> struct gemv_selector { template - static void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha) + static void run(const ProductType& prod, Dest& dest, const typename ProductType::Scalar& alpha) { typedef typename Dest::Index Index; // TODO makes sure rhs is sequentially stored in memory, otherwise use a temp diff --git a/Eigen/src/Core/ProductBase.h b/Eigen/src/Core/ProductBase.h index 9748167a5..5bb7e342a 100644 --- a/Eigen/src/Core/ProductBase.h +++ b/Eigen/src/Core/ProductBase.h @@ -108,7 +108,7 @@ class ProductBase : public MatrixBase inline void subTo(Dest& dst) const { scaleAndAddTo(dst,Scalar(-1)); } template - inline void scaleAndAddTo(Dest& dst,Scalar alpha) const { derived().scaleAndAddTo(dst,alpha); } + inline void scaleAndAddTo(Dest& dst, const Scalar& alpha) const { derived().scaleAndAddTo(dst,alpha); } const _LhsNested& lhs() const { return m_lhs; } const _RhsNested& rhs() const { return m_rhs; } @@ -241,7 +241,7 @@ class ScaledProduct typedef typename Base::PlainObject PlainObject; // EIGEN_PRODUCT_PUBLIC_INTERFACE(ScaledProduct) - ScaledProduct(const NestedProduct& prod, Scalar x) + ScaledProduct(const NestedProduct& prod, const Scalar& x) : Base(prod.lhs(),prod.rhs()), m_prod(prod), m_alpha(x) {} template @@ -254,7 +254,7 @@ class ScaledProduct inline void subTo(Dest& dst) const { scaleAndAddTo(dst, Scalar(-1)); } template - inline void scaleAndAddTo(Dest& dst,Scalar a_alpha) const { m_prod.derived().scaleAndAddTo(dst,a_alpha * m_alpha); } + inline void scaleAndAddTo(Dest& dst, const Scalar& a_alpha) const { m_prod.derived().scaleAndAddTo(dst,a_alpha * m_alpha); } const Scalar& alpha() const { return m_alpha; } diff --git a/Eigen/src/Core/products/GeneralMatrixMatrix.h b/Eigen/src/Core/products/GeneralMatrixMatrix.h index 73a465ec5..0c1f35c69 100644 --- a/Eigen/src/Core/products/GeneralMatrixMatrix.h +++ b/Eigen/src/Core/products/GeneralMatrixMatrix.h @@ -204,7 +204,7 @@ struct traits > template struct gemm_functor { - gemm_functor(const Lhs& lhs, const Rhs& rhs, Dest& dest, Scalar actualAlpha, + gemm_functor(const Lhs& lhs, const Rhs& rhs, Dest& dest, const Scalar& actualAlpha, BlockingType& blocking) : m_lhs(lhs), m_rhs(rhs), m_dest(dest), m_actualAlpha(actualAlpha), m_blocking(blocking) {} @@ -395,7 +395,7 @@ class GeneralProduct EIGEN_CHECK_BINARY_COMPATIBILIY(BinOp,LhsScalar,RhsScalar); } - template void scaleAndAddTo(Dest& dst, Scalar alpha) const + template void scaleAndAddTo(Dest& dst, const Scalar& alpha) const { eigen_assert(dst.rows()==m_lhs.rows() && dst.cols()==m_rhs.cols()); diff --git a/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h b/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h index c4f83cd13..be7134072 100644 --- a/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h +++ b/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h @@ -42,7 +42,7 @@ struct general_matrix_matrix_triangular_product::ReturnType ResScalar; static EIGEN_STRONG_INLINE void run(Index size, Index depth,const LhsScalar* lhs, Index lhsStride, - const RhsScalar* rhs, Index rhsStride, ResScalar* res, Index resStride, ResScalar alpha) + const RhsScalar* rhs, Index rhsStride, ResScalar* res, Index resStride, const ResScalar& alpha) { general_matrix_matrix_triangular_product::ReturnType ResScalar; static EIGEN_STRONG_INLINE void run(Index size, Index depth,const LhsScalar* _lhs, Index lhsStride, - const RhsScalar* _rhs, Index rhsStride, ResScalar* res, Index resStride, ResScalar alpha) + const RhsScalar* _rhs, Index rhsStride, ResScalar* res, Index resStride, const ResScalar& alpha) { const_blas_data_mapper lhs(_lhs,lhsStride); const_blas_data_mapper rhs(_rhs,rhsStride); @@ -136,7 +136,7 @@ struct tribb_kernel enum { BlockSize = EIGEN_PLAIN_ENUM_MAX(mr,nr) }; - void operator()(ResScalar* res, Index resStride, const LhsScalar* blockA, const RhsScalar* blockB, Index size, Index depth, ResScalar alpha, RhsScalar* workspace) + void operator()(ResScalar* res, Index resStride, const LhsScalar* blockA, const RhsScalar* blockB, Index size, Index depth, const ResScalar& alpha, RhsScalar* workspace) { gebp_kernel gebp_kernel; Matrix buffer; diff --git a/Eigen/src/Core/products/SelfadjointMatrixMatrix.h b/Eigen/src/Core/products/SelfadjointMatrixMatrix.h index 48209636e..e4b21dedd 100644 --- a/Eigen/src/Core/products/SelfadjointMatrixMatrix.h +++ b/Eigen/src/Core/products/SelfadjointMatrixMatrix.h @@ -211,7 +211,7 @@ struct product_selfadjoint_matrix RhsIsSelfAdjoint = (RhsMode&SelfAdjoint)==SelfAdjoint }; - template void scaleAndAddTo(Dest& dst, Scalar alpha) const + template void scaleAndAddTo(Dest& dst, const Scalar& alpha) const { eigen_assert(dst.rows()==m_lhs.rows() && dst.cols()==m_rhs.cols()); diff --git a/Eigen/src/Core/products/SelfadjointMatrixVector.h b/Eigen/src/Core/products/SelfadjointMatrixVector.h index c3145c69a..6d736f01c 100644 --- a/Eigen/src/Core/products/SelfadjointMatrixVector.h +++ b/Eigen/src/Core/products/SelfadjointMatrixVector.h @@ -180,7 +180,7 @@ struct SelfadjointProductMatrix SelfadjointProductMatrix(const Lhs& lhs, const Rhs& rhs) : Base(lhs,rhs) {} - template void scaleAndAddTo(Dest& dest, Scalar alpha) const + template void scaleAndAddTo(Dest& dest, const Scalar& alpha) const { typedef typename Dest::Scalar ResScalar; typedef typename Base::RhsScalar RhsScalar; @@ -260,7 +260,7 @@ struct SelfadjointProductMatrix SelfadjointProductMatrix(const Lhs& lhs, const Rhs& rhs) : Base(lhs,rhs) {} - template void scaleAndAddTo(Dest& dest, Scalar alpha) const + template void scaleAndAddTo(Dest& dest, const Scalar& alpha) const { // let's simply transpose the product Transpose destT(dest); diff --git a/Eigen/src/Core/products/SelfadjointProduct.h b/Eigen/src/Core/products/SelfadjointProduct.h index 302e0d841..773ba2ff2 100644 --- a/Eigen/src/Core/products/SelfadjointProduct.h +++ b/Eigen/src/Core/products/SelfadjointProduct.h @@ -22,7 +22,7 @@ namespace Eigen { template struct selfadjoint_rank1_update { - static void run(Index size, Scalar* mat, Index stride, const Scalar* vecX, const Scalar* vecY, Scalar alpha) + static void run(Index size, Scalar* mat, Index stride, const Scalar* vecX, const Scalar* vecY, const Scalar& alpha) { internal::conj_if cj; typedef Map > OtherMap; @@ -38,7 +38,7 @@ struct selfadjoint_rank1_update template struct selfadjoint_rank1_update { - static void run(Index size, Scalar* mat, Index stride, const Scalar* vecX, const Scalar* vecY, Scalar alpha) + static void run(Index size, Scalar* mat, Index stride, const Scalar* vecX, const Scalar* vecY, const Scalar& alpha) { selfadjoint_rank1_update::run(size,mat,stride,vecY,vecX,alpha); } @@ -50,7 +50,7 @@ struct selfadjoint_product_selector; template struct selfadjoint_product_selector { - static void run(MatrixType& mat, const OtherType& other, typename MatrixType::Scalar alpha) + static void run(MatrixType& mat, const OtherType& other, const typename MatrixType::Scalar& alpha) { typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Index Index; @@ -83,7 +83,7 @@ struct selfadjoint_product_selector template struct selfadjoint_product_selector { - static void run(MatrixType& mat, const OtherType& other, typename MatrixType::Scalar alpha) + static void run(MatrixType& mat, const OtherType& other, const typename MatrixType::Scalar& alpha) { typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Index Index; diff --git a/Eigen/src/Core/products/SelfadjointRank2Update.h b/Eigen/src/Core/products/SelfadjointRank2Update.h index 57a98cc2d..0a5e4fd0f 100644 --- a/Eigen/src/Core/products/SelfadjointRank2Update.h +++ b/Eigen/src/Core/products/SelfadjointRank2Update.h @@ -24,7 +24,7 @@ struct selfadjoint_rank2_update_selector; template struct selfadjoint_rank2_update_selector { - static void run(Scalar* mat, Index stride, const UType& u, const VType& v, Scalar alpha) + static void run(Scalar* mat, Index stride, const UType& u, const VType& v, const Scalar& alpha) { const Index size = u.size(); for (Index i=0; i template struct selfadjoint_rank2_update_selector { - static void run(Scalar* mat, Index stride, const UType& u, const VType& v, Scalar alpha) + static void run(Scalar* mat, Index stride, const UType& u, const VType& v, const Scalar& alpha) { const Index size = u.size(); for (Index i=0; i& blocking) + const Scalar& alpha, level3_blocking& blocking) { product_triangular_matrix_matrix& blocking) + const Scalar& alpha, level3_blocking& blocking) { // strip zeros Index diagSize = (std::min)(_rows,_depth); @@ -225,7 +225,7 @@ struct product_triangular_matrix_matrix& blocking) + const Scalar& alpha, level3_blocking& blocking) { // strip zeros Index diagSize = (std::min)(_cols,_depth); @@ -364,7 +364,7 @@ struct TriangularProduct TriangularProduct(const Lhs& lhs, const Rhs& rhs) : Base(lhs,rhs) {} - template void scaleAndAddTo(Dest& dst, Scalar alpha) const + template void scaleAndAddTo(Dest& dst, const Scalar& alpha) const { typename internal::add_const_on_value_type::type lhs = LhsBlasTraits::extract(m_lhs); typename internal::add_const_on_value_type::type rhs = RhsBlasTraits::extract(m_rhs); diff --git a/Eigen/src/Core/products/TriangularMatrixVector.h b/Eigen/src/Core/products/TriangularMatrixVector.h index b1c10c201..701e283f6 100644 --- a/Eigen/src/Core/products/TriangularMatrixVector.h +++ b/Eigen/src/Core/products/TriangularMatrixVector.h @@ -27,7 +27,7 @@ struct triangular_matrix_vector_product TriangularProduct(const Lhs& lhs, const Rhs& rhs) : Base(lhs,rhs) {} - template void scaleAndAddTo(Dest& dst, Scalar alpha) const + template void scaleAndAddTo(Dest& dst, const Scalar& alpha) const { eigen_assert(dst.rows()==m_lhs.rows() && dst.cols()==m_rhs.cols()); @@ -187,7 +187,7 @@ struct TriangularProduct TriangularProduct(const Lhs& lhs, const Rhs& rhs) : Base(lhs,rhs) {} - template void scaleAndAddTo(Dest& dst, Scalar alpha) const + template void scaleAndAddTo(Dest& dst, const Scalar& alpha) const { eigen_assert(dst.rows()==m_lhs.rows() && dst.cols()==m_rhs.cols()); @@ -205,7 +205,7 @@ namespace internal { template<> struct trmv_selector { template - static void run(const TriangularProduct& prod, Dest& dest, typename TriangularProduct::Scalar alpha) + static void run(const TriangularProduct& prod, Dest& dest, const typename TriangularProduct::Scalar& alpha) { typedef TriangularProduct ProductType; typedef typename ProductType::Index Index; @@ -281,7 +281,7 @@ template<> struct trmv_selector template<> struct trmv_selector { template - static void run(const TriangularProduct& prod, Dest& dest, typename TriangularProduct::Scalar alpha) + static void run(const TriangularProduct& prod, Dest& dest, const typename TriangularProduct::Scalar& alpha) { typedef TriangularProduct ProductType; typedef typename ProductType::LhsScalar LhsScalar; diff --git a/Eigen/src/Eigenvalues/ComplexEigenSolver.h b/Eigen/src/Eigenvalues/ComplexEigenSolver.h index 238e08925..bd41bf7ed 100644 --- a/Eigen/src/Eigenvalues/ComplexEigenSolver.h +++ b/Eigen/src/Eigenvalues/ComplexEigenSolver.h @@ -242,7 +242,7 @@ template class ComplexEigenSolver EigenvectorType m_matX; private: - void doComputeEigenvectors(RealScalar matrixnorm); + void doComputeEigenvectors(const RealScalar& matrixnorm); void sortEigenvalues(bool computeEigenvectors); }; @@ -273,7 +273,7 @@ ComplexEigenSolver::compute(const MatrixType& matrix, bool computeEi template -void ComplexEigenSolver::doComputeEigenvectors(RealScalar matrixnorm) +void ComplexEigenSolver::doComputeEigenvectors(const RealScalar& matrixnorm) { const Index n = m_eivalues.size(); diff --git a/Eigen/src/Eigenvalues/EigenSolver.h b/Eigen/src/Eigenvalues/EigenSolver.h index a80f88eb0..f0d4e5afa 100644 --- a/Eigen/src/Eigenvalues/EigenSolver.h +++ b/Eigen/src/Eigenvalues/EigenSolver.h @@ -410,7 +410,7 @@ EigenSolver::compute(const MatrixType& matrix, bool computeEigenvect // Complex scalar division. template -std::complex cdiv(Scalar xr, Scalar xi, Scalar yr, Scalar yi) +std::complex cdiv(const Scalar& xr, const Scalar& xi, const Scalar& yr, const Scalar& yi) { using std::abs; Scalar r,d; diff --git a/Eigen/src/Eigenvalues/RealSchur.h b/Eigen/src/Eigenvalues/RealSchur.h index a770b3187..64d136341 100644 --- a/Eigen/src/Eigenvalues/RealSchur.h +++ b/Eigen/src/Eigenvalues/RealSchur.h @@ -234,8 +234,8 @@ template class RealSchur typedef Matrix Vector3s; Scalar computeNormOfT(); - Index findSmallSubdiagEntry(Index iu, Scalar norm); - void splitOffTwoRows(Index iu, bool computeU, Scalar exshift); + Index findSmallSubdiagEntry(Index iu, const Scalar& norm); + void splitOffTwoRows(Index iu, bool computeU, const Scalar& exshift); void computeShift(Index iu, Index iter, Scalar& exshift, Vector3s& shiftInfo); void initFrancisQRStep(Index il, Index iu, const Vector3s& shiftInfo, Index& im, Vector3s& firstHouseholderVector); void performFrancisQRStep(Index il, Index im, Index iu, bool computeU, const Vector3s& firstHouseholderVector, Scalar* workspace); @@ -343,7 +343,7 @@ inline typename MatrixType::Scalar RealSchur::computeNormOfT() /** \internal Look for single small sub-diagonal element and returns its index */ template -inline typename MatrixType::Index RealSchur::findSmallSubdiagEntry(Index iu, Scalar norm) +inline typename MatrixType::Index RealSchur::findSmallSubdiagEntry(Index iu, const Scalar& norm) { using std::abs; Index res = iu; @@ -361,7 +361,7 @@ inline typename MatrixType::Index RealSchur::findSmallSubdiagEntry(I /** \internal Update T given that rows iu-1 and iu decouple from the rest. */ template -inline void RealSchur::splitOffTwoRows(Index iu, bool computeU, Scalar exshift) +inline void RealSchur::splitOffTwoRows(Index iu, bool computeU, const Scalar& exshift) { using std::sqrt; using std::abs; diff --git a/Eigen/src/Geometry/AlignedBox.h b/Eigen/src/Geometry/AlignedBox.h index 48cc0a488..c50543e5c 100644 --- a/Eigen/src/Geometry/AlignedBox.h +++ b/Eigen/src/Geometry/AlignedBox.h @@ -282,7 +282,7 @@ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim) * determined by \a prec. * * \sa MatrixBase::isApprox() */ - bool isApprox(const AlignedBox& other, RealScalar prec = ScalarTraits::dummy_precision()) const + bool isApprox(const AlignedBox& other, const RealScalar& prec = ScalarTraits::dummy_precision()) const { return m_min.isApprox(other.m_min, prec) && m_max.isApprox(other.m_max, prec); } protected: diff --git a/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h b/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h index 5b408f83d..f8da15506 100644 --- a/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h +++ b/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h @@ -110,7 +110,7 @@ class IncompleteLUT : internal::noncopyable {} template - IncompleteLUT(const MatrixType& mat, RealScalar droptol=NumTraits::dummy_precision(), int fillfactor = 10) + IncompleteLUT(const MatrixType& mat, const RealScalar& droptol=NumTraits::dummy_precision(), int fillfactor = 10) : m_droptol(droptol),m_fillfactor(fillfactor), m_analysisIsOk(false),m_factorizationIsOk(false),m_isInitialized(false) { @@ -154,7 +154,7 @@ class IncompleteLUT : internal::noncopyable return *this; } - void setDroptol(RealScalar droptol); + void setDroptol(const RealScalar& droptol); void setFillfactor(int fillfactor); template @@ -203,7 +203,7 @@ protected: * \param droptol Drop any element whose magnitude is less than this tolerance **/ template -void IncompleteLUT::setDroptol(RealScalar droptol) +void IncompleteLUT::setDroptol(const RealScalar& droptol) { this->m_droptol = droptol; } diff --git a/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h b/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h index 11706ceba..2036922d6 100644 --- a/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +++ b/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h @@ -120,7 +120,7 @@ public: RealScalar tolerance() const { return m_tolerance; } /** Sets the tolerance threshold used by the stopping criteria */ - Derived& setTolerance(RealScalar tolerance) + Derived& setTolerance(const RealScalar& tolerance) { m_tolerance = tolerance; return derived(); diff --git a/Eigen/src/Jacobi/Jacobi.h b/Eigen/src/Jacobi/Jacobi.h index 20e227640..d9d75196c 100644 --- a/Eigen/src/Jacobi/Jacobi.h +++ b/Eigen/src/Jacobi/Jacobi.h @@ -63,7 +63,7 @@ template class JacobiRotation template bool makeJacobi(const MatrixBase&, typename Derived::Index p, typename Derived::Index q); - bool makeJacobi(RealScalar x, Scalar y, RealScalar z); + bool makeJacobi(const RealScalar& x, const Scalar& y, const RealScalar& z); void makeGivens(const Scalar& p, const Scalar& q, Scalar* z=0); @@ -80,7 +80,7 @@ template class JacobiRotation * \sa MatrixBase::makeJacobi(const MatrixBase&, Index, Index), MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight() */ template -bool JacobiRotation::makeJacobi(RealScalar x, Scalar y, RealScalar z) +bool JacobiRotation::makeJacobi(const RealScalar& x, const Scalar& y, const RealScalar& z) { using std::sqrt; using std::abs; diff --git a/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h b/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h index d625b0e2f..0ffb894f6 100644 --- a/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h +++ b/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h @@ -187,7 +187,7 @@ class SPQR /// Set the fill-reducing ordering method to be used void setSPQROrdering(int ord) { m_ordering = ord;} /// Set the tolerance tol to treat columns with 2-norm < =tol as zero - void setPivotThreshold(RealScalar tol) { m_tolerance = tol; } + void setPivotThreshold(const RealScalar& tol) { m_tolerance = tol; } /** \returns a pointer to the SPQR workspace */ cholmod_common *cholmodCommon() const { return &m_cc; } diff --git a/Eigen/src/SparseCore/AmbiVector.h b/Eigen/src/SparseCore/AmbiVector.h index dca738751..17fff96a7 100644 --- a/Eigen/src/SparseCore/AmbiVector.h +++ b/Eigen/src/SparseCore/AmbiVector.h @@ -288,7 +288,7 @@ class AmbiVector<_Scalar,_Index>::Iterator * In practice, all coefficients having a magnitude smaller than \a epsilon * are skipped. */ - Iterator(const AmbiVector& vec, RealScalar epsilon = 0) + Iterator(const AmbiVector& vec, const RealScalar& epsilon = 0) : m_vector(vec) { using std::abs; diff --git a/Eigen/src/SparseLU/SparseLU.h b/Eigen/src/SparseLU/SparseLU.h index 819a6df38..e78250084 100644 --- a/Eigen/src/SparseLU/SparseLU.h +++ b/Eigen/src/SparseLU/SparseLU.h @@ -134,7 +134,7 @@ class SparseLU : public internal::SparseLUImpl(m_Lstore); } /** Set the threshold used for a diagonal entry to be an acceptable pivot. */ - void setPivotThreshold(RealScalar thresh) + void setPivotThreshold(const RealScalar& thresh) { m_diagpivotthresh = thresh; } diff --git a/Eigen/src/SparseLU/SparseLUImpl.h b/Eigen/src/SparseLU/SparseLUImpl.h index 229a77843..14d70897d 100644 --- a/Eigen/src/SparseLU/SparseLUImpl.h +++ b/Eigen/src/SparseLU/SparseLUImpl.h @@ -38,7 +38,7 @@ class SparseLUImpl void relax_snode (const Index n, IndexVector& et, const Index relax_columns, IndexVector& descendants, IndexVector& relax_end); Index snode_dfs(const Index jcol, const Index kcol,const MatrixType& mat, IndexVector& xprune, IndexVector& marker, GlobalLU_t& glu); Index snode_bmod (const Index jcol, const Index fsupc, ScalarVector& dense, GlobalLU_t& glu); - Index pivotL(const Index jcol, const RealScalar diagpivotthresh, IndexVector& perm_r, IndexVector& iperm_c, Index& pivrow, GlobalLU_t& glu); + Index pivotL(const Index jcol, const RealScalar& diagpivotthresh, IndexVector& perm_r, IndexVector& iperm_c, Index& pivrow, GlobalLU_t& glu); template void dfs_kernel(const Index jj, IndexVector& perm_r, Index& nseg, IndexVector& panel_lsub, IndexVector& segrep, diff --git a/Eigen/src/SparseLU/SparseLU_pivotL.h b/Eigen/src/SparseLU/SparseLU_pivotL.h index cd6dfd0d4..ddcd4ec98 100644 --- a/Eigen/src/SparseLU/SparseLU_pivotL.h +++ b/Eigen/src/SparseLU/SparseLU_pivotL.h @@ -57,7 +57,7 @@ namespace internal { * */ template -Index SparseLUImpl::pivotL(const Index jcol, const RealScalar diagpivotthresh, IndexVector& perm_r, IndexVector& iperm_c, Index& pivrow, GlobalLU_t& glu) +Index SparseLUImpl::pivotL(const Index jcol, const RealScalar& diagpivotthresh, IndexVector& perm_r, IndexVector& iperm_c, Index& pivrow, GlobalLU_t& glu) { Index fsupc = (glu.xsup)((glu.supno)(jcol)); // First column in the supernode containing the column jcol diff --git a/blas/level2_cplx_impl.h b/blas/level2_cplx_impl.h index ceed3e86d..b850b6cd1 100644 --- a/blas/level2_cplx_impl.h +++ b/blas/level2_cplx_impl.h @@ -216,7 +216,7 @@ int EIGEN_BLAS_FUNC(hpr2)(char *uplo, int *n, RealScalar *palpha, RealScalar *px */ int EIGEN_BLAS_FUNC(her)(char *uplo, int *n, RealScalar *palpha, RealScalar *px, int *incx, RealScalar *pa, int *lda) { - typedef void (*functype)(int, Scalar*, int, const Scalar*, const Scalar*, Scalar); + typedef void (*functype)(int, Scalar*, int, const Scalar*, const Scalar*, const Scalar&); static functype func[2]; static bool init = false; diff --git a/blas/level2_impl.h b/blas/level2_impl.h index bd41f7e60..5f3941975 100644 --- a/blas/level2_impl.h +++ b/blas/level2_impl.h @@ -130,7 +130,7 @@ int EIGEN_BLAS_FUNC(trsv)(char *uplo, char *opa, char *diag, int *n, RealScalar int EIGEN_BLAS_FUNC(trmv)(char *uplo, char *opa, char *diag, int *n, RealScalar *pa, int *lda, RealScalar *pb, int *incb) { - typedef void (*functype)(int, int, const Scalar *, int, const Scalar *, int, Scalar *, int, Scalar); + typedef void (*functype)(int, int, const Scalar *, int, const Scalar *, int, Scalar *, int, const Scalar&); static functype func[16]; static bool init = false; diff --git a/blas/level2_real_impl.h b/blas/level2_real_impl.h index 842f0a066..8d56eaaa1 100644 --- a/blas/level2_real_impl.h +++ b/blas/level2_real_impl.h @@ -85,7 +85,7 @@ int EIGEN_BLAS_FUNC(syr)(char *uplo, int *n, RealScalar *palpha, RealScalar *px, // init = true; // } - typedef void (*functype)(int, Scalar*, int, const Scalar*, const Scalar*, Scalar); + typedef void (*functype)(int, Scalar*, int, const Scalar*, const Scalar*, const Scalar&); static functype func[2]; static bool init = false; diff --git a/blas/level3_impl.h b/blas/level3_impl.h index 84c9f4f2b..a57189f53 100644 --- a/blas/level3_impl.h +++ b/blas/level3_impl.h @@ -152,7 +152,7 @@ int EIGEN_BLAS_FUNC(trsm)(char *side, char *uplo, char *opa, char *diag, int *m, int EIGEN_BLAS_FUNC(trmm)(char *side, char *uplo, char *opa, char *diag, int *m, int *n, RealScalar *palpha, RealScalar *pa, int *lda, RealScalar *pb, int *ldb) { // std::cerr << "in trmm " << *side << " " << *uplo << " " << *opa << " " << *diag << " " << *m << " " << *n << " " << *lda << " " << *ldb << " " << *palpha << "\n"; - typedef void (*functype)(DenseIndex, DenseIndex, DenseIndex, const Scalar *, DenseIndex, const Scalar *, DenseIndex, Scalar *, DenseIndex, Scalar, internal::level3_blocking&); + typedef void (*functype)(DenseIndex, DenseIndex, DenseIndex, const Scalar *, DenseIndex, const Scalar *, DenseIndex, Scalar *, DenseIndex, const Scalar&, internal::level3_blocking&); static functype func[32]; static bool init = false; if(!init) @@ -306,7 +306,7 @@ int EIGEN_BLAS_FUNC(syrk)(char *uplo, char *op, int *n, int *k, RealScalar *palp { // std::cerr << "in syrk " << *uplo << " " << *op << " " << *n << " " << *k << " " << *palpha << " " << *lda << " " << *pbeta << " " << *ldc << "\n"; #if !ISCOMPLEX - typedef void (*functype)(DenseIndex, DenseIndex, const Scalar *, DenseIndex, const Scalar *, DenseIndex, Scalar *, DenseIndex, Scalar); + typedef void (*functype)(DenseIndex, DenseIndex, const Scalar *, DenseIndex, const Scalar *, DenseIndex, Scalar *, DenseIndex, const Scalar&); static functype func[8]; static bool init = false; @@ -500,7 +500,7 @@ int EIGEN_BLAS_FUNC(hemm)(char *side, char *uplo, int *m, int *n, RealScalar *pa // c = alpha*conj(a')*a + beta*c for op = 'C'or'c' int EIGEN_BLAS_FUNC(herk)(char *uplo, char *op, int *n, int *k, RealScalar *palpha, RealScalar *pa, int *lda, RealScalar *pbeta, RealScalar *pc, int *ldc) { - typedef void (*functype)(DenseIndex, DenseIndex, const Scalar *, DenseIndex, const Scalar *, DenseIndex, Scalar *, DenseIndex, Scalar); + typedef void (*functype)(DenseIndex, DenseIndex, const Scalar *, DenseIndex, const Scalar *, DenseIndex, Scalar *, DenseIndex, const Scalar&); static functype func[8]; static bool init = false; -- cgit v1.2.3