mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-08 17:59:00 +08:00
Fix bug #482: pass scalar value by const reference (it remained a few cases)
This commit is contained in:
parent
43f4fd4d71
commit
9816e8532e
@ -442,11 +442,11 @@ template<typename Derived> class DenseBase
|
|||||||
|
|
||||||
template<typename ThenDerived>
|
template<typename ThenDerived>
|
||||||
inline const Select<Derived,ThenDerived, typename ThenDerived::ConstantReturnType>
|
inline const Select<Derived,ThenDerived, typename ThenDerived::ConstantReturnType>
|
||||||
select(const DenseBase<ThenDerived>& thenMatrix, typename ThenDerived::Scalar elseScalar) const;
|
select(const DenseBase<ThenDerived>& thenMatrix, const typename ThenDerived::Scalar& elseScalar) const;
|
||||||
|
|
||||||
template<typename ElseDerived>
|
template<typename ElseDerived>
|
||||||
inline const Select<Derived, typename ElseDerived::ConstantReturnType, ElseDerived >
|
inline const Select<Derived, typename ElseDerived::ConstantReturnType, ElseDerived >
|
||||||
select(typename ElseDerived::Scalar thenScalar, const DenseBase<ElseDerived>& elseMatrix) const;
|
select(const typename ElseDerived::Scalar& thenScalar, const DenseBase<ElseDerived>& elseMatrix) const;
|
||||||
|
|
||||||
template<int p> RealScalar lpNorm() const;
|
template<int p> RealScalar lpNorm() const;
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ namespace Eigen
|
|||||||
**/
|
**/
|
||||||
template <typename Derived>
|
template <typename Derived>
|
||||||
inline const Eigen::CwiseUnaryOp<Eigen::internal::scalar_inverse_mult_op<typename Derived::Scalar>, const Derived>
|
inline const Eigen::CwiseUnaryOp<Eigen::internal::scalar_inverse_mult_op<typename Derived::Scalar>, const Derived>
|
||||||
operator/(typename Derived::Scalar s, const Eigen::ArrayBase<Derived>& a)
|
operator/(const typename Derived::Scalar& s, const Eigen::ArrayBase<Derived>& a)
|
||||||
{
|
{
|
||||||
return Eigen::CwiseUnaryOp<Eigen::internal::scalar_inverse_mult_op<typename Derived::Scalar>, const Derived>(
|
return Eigen::CwiseUnaryOp<Eigen::internal::scalar_inverse_mult_op<typename Derived::Scalar>, const Derived>(
|
||||||
a.derived(),
|
a.derived(),
|
||||||
|
@ -457,7 +457,7 @@ template<typename Derived> class MatrixBase
|
|||||||
const MatrixFunctionReturnValue<Derived> sin() const;
|
const MatrixFunctionReturnValue<Derived> sin() const;
|
||||||
const MatrixSquareRootReturnValue<Derived> sqrt() const;
|
const MatrixSquareRootReturnValue<Derived> sqrt() const;
|
||||||
const MatrixLogarithmReturnValue<Derived> log() const;
|
const MatrixLogarithmReturnValue<Derived> log() const;
|
||||||
const MatrixPowerReturnValue<Derived> pow(RealScalar p) const;
|
const MatrixPowerReturnValue<Derived> pow(const RealScalar& p) const;
|
||||||
|
|
||||||
#ifdef EIGEN2_SUPPORT
|
#ifdef EIGEN2_SUPPORT
|
||||||
template<typename ProductDerived, typename Lhs, typename Rhs>
|
template<typename ProductDerived, typename Lhs, typename Rhs>
|
||||||
|
@ -195,7 +195,7 @@ class ScaledProduct;
|
|||||||
// Also note that here we accept any compatible scalar types
|
// Also note that here we accept any compatible scalar types
|
||||||
template<typename Derived,typename Lhs,typename Rhs>
|
template<typename Derived,typename Lhs,typename Rhs>
|
||||||
const ScaledProduct<Derived>
|
const ScaledProduct<Derived>
|
||||||
operator*(const ProductBase<Derived,Lhs,Rhs>& prod, typename Derived::Scalar x)
|
operator*(const ProductBase<Derived,Lhs,Rhs>& prod, const typename Derived::Scalar& x)
|
||||||
{ return ScaledProduct<Derived>(prod.derived(), x); }
|
{ return ScaledProduct<Derived>(prod.derived(), x); }
|
||||||
|
|
||||||
template<typename Derived,typename Lhs,typename Rhs>
|
template<typename Derived,typename Lhs,typename Rhs>
|
||||||
@ -207,7 +207,7 @@ operator*(const ProductBase<Derived,Lhs,Rhs>& prod, const typename Derived::Real
|
|||||||
|
|
||||||
template<typename Derived,typename Lhs,typename Rhs>
|
template<typename Derived,typename Lhs,typename Rhs>
|
||||||
const ScaledProduct<Derived>
|
const ScaledProduct<Derived>
|
||||||
operator*(typename Derived::Scalar x,const ProductBase<Derived,Lhs,Rhs>& prod)
|
operator*(const typename Derived::Scalar& x,const ProductBase<Derived,Lhs,Rhs>& prod)
|
||||||
{ return ScaledProduct<Derived>(prod.derived(), x); }
|
{ return ScaledProduct<Derived>(prod.derived(), x); }
|
||||||
|
|
||||||
template<typename Derived,typename Lhs,typename Rhs>
|
template<typename Derived,typename Lhs,typename Rhs>
|
||||||
|
@ -136,7 +136,7 @@ template<typename Derived>
|
|||||||
template<typename ThenDerived>
|
template<typename ThenDerived>
|
||||||
inline const Select<Derived,ThenDerived, typename ThenDerived::ConstantReturnType>
|
inline const Select<Derived,ThenDerived, typename ThenDerived::ConstantReturnType>
|
||||||
DenseBase<Derived>::select(const DenseBase<ThenDerived>& thenMatrix,
|
DenseBase<Derived>::select(const DenseBase<ThenDerived>& thenMatrix,
|
||||||
typename ThenDerived::Scalar elseScalar) const
|
const typename ThenDerived::Scalar& elseScalar) const
|
||||||
{
|
{
|
||||||
return Select<Derived,ThenDerived,typename ThenDerived::ConstantReturnType>(
|
return Select<Derived,ThenDerived,typename ThenDerived::ConstantReturnType>(
|
||||||
derived(), thenMatrix.derived(), ThenDerived::Constant(rows(),cols(),elseScalar));
|
derived(), thenMatrix.derived(), ThenDerived::Constant(rows(),cols(),elseScalar));
|
||||||
@ -150,8 +150,8 @@ DenseBase<Derived>::select(const DenseBase<ThenDerived>& thenMatrix,
|
|||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
template<typename ElseDerived>
|
template<typename ElseDerived>
|
||||||
inline const Select<Derived, typename ElseDerived::ConstantReturnType, ElseDerived >
|
inline const Select<Derived, typename ElseDerived::ConstantReturnType, ElseDerived >
|
||||||
DenseBase<Derived>::select(typename ElseDerived::Scalar thenScalar,
|
DenseBase<Derived>::select(const typename ElseDerived::Scalar& thenScalar,
|
||||||
const DenseBase<ElseDerived>& elseMatrix) const
|
const DenseBase<ElseDerived>& elseMatrix) const
|
||||||
{
|
{
|
||||||
return Select<Derived,typename ElseDerived::ConstantReturnType,ElseDerived>(
|
return Select<Derived,typename ElseDerived::ConstantReturnType,ElseDerived>(
|
||||||
derived(), ElseDerived::Constant(rows(),cols(),thenScalar), elseMatrix.derived());
|
derived(), ElseDerived::Constant(rows(),cols(),thenScalar), elseMatrix.derived());
|
||||||
|
@ -132,7 +132,7 @@ template<typename MatrixType, unsigned int UpLo> class SelfAdjointView
|
|||||||
* \sa rankUpdate(const MatrixBase<DerivedU>&, Scalar)
|
* \sa rankUpdate(const MatrixBase<DerivedU>&, Scalar)
|
||||||
*/
|
*/
|
||||||
template<typename DerivedU, typename DerivedV>
|
template<typename DerivedU, typename DerivedV>
|
||||||
SelfAdjointView& rankUpdate(const MatrixBase<DerivedU>& u, const MatrixBase<DerivedV>& v, Scalar alpha = Scalar(1));
|
SelfAdjointView& rankUpdate(const MatrixBase<DerivedU>& u, const MatrixBase<DerivedV>& v, const Scalar& alpha = Scalar(1));
|
||||||
|
|
||||||
/** Perform a symmetric rank K update of the selfadjoint matrix \c *this:
|
/** Perform a symmetric rank K update of the selfadjoint matrix \c *this:
|
||||||
* \f$ this = this + \alpha ( u u^* ) \f$ where \a u is a vector or matrix.
|
* \f$ this = this + \alpha ( u u^* ) \f$ where \a u is a vector or matrix.
|
||||||
@ -145,7 +145,7 @@ template<typename MatrixType, unsigned int UpLo> class SelfAdjointView
|
|||||||
* \sa rankUpdate(const MatrixBase<DerivedU>&, const MatrixBase<DerivedV>&, Scalar)
|
* \sa rankUpdate(const MatrixBase<DerivedU>&, const MatrixBase<DerivedV>&, Scalar)
|
||||||
*/
|
*/
|
||||||
template<typename DerivedU>
|
template<typename DerivedU>
|
||||||
SelfAdjointView& rankUpdate(const MatrixBase<DerivedU>& u, Scalar alpha = Scalar(1));
|
SelfAdjointView& rankUpdate(const MatrixBase<DerivedU>& u, const Scalar& alpha = Scalar(1));
|
||||||
|
|
||||||
/////////// Cholesky module ///////////
|
/////////// Cholesky module ///////////
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ struct selfadjoint_product_selector<MatrixType,OtherType,UpLo,false>
|
|||||||
template<typename MatrixType, unsigned int UpLo>
|
template<typename MatrixType, unsigned int UpLo>
|
||||||
template<typename DerivedU>
|
template<typename DerivedU>
|
||||||
SelfAdjointView<MatrixType,UpLo>& SelfAdjointView<MatrixType,UpLo>
|
SelfAdjointView<MatrixType,UpLo>& SelfAdjointView<MatrixType,UpLo>
|
||||||
::rankUpdate(const MatrixBase<DerivedU>& u, Scalar alpha)
|
::rankUpdate(const MatrixBase<DerivedU>& u, const Scalar& alpha)
|
||||||
{
|
{
|
||||||
selfadjoint_product_selector<MatrixType,DerivedU,UpLo>::run(_expression().const_cast_derived(), u.derived(), alpha);
|
selfadjoint_product_selector<MatrixType,DerivedU,UpLo>::run(_expression().const_cast_derived(), u.derived(), alpha);
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ template<bool Cond, typename T> struct conj_expr_if
|
|||||||
template<typename MatrixType, unsigned int UpLo>
|
template<typename MatrixType, unsigned int UpLo>
|
||||||
template<typename DerivedU, typename DerivedV>
|
template<typename DerivedU, typename DerivedV>
|
||||||
SelfAdjointView<MatrixType,UpLo>& SelfAdjointView<MatrixType,UpLo>
|
SelfAdjointView<MatrixType,UpLo>& SelfAdjointView<MatrixType,UpLo>
|
||||||
::rankUpdate(const MatrixBase<DerivedU>& u, const MatrixBase<DerivedV>& v, Scalar alpha)
|
::rankUpdate(const MatrixBase<DerivedU>& u, const MatrixBase<DerivedV>& v, const Scalar& alpha)
|
||||||
{
|
{
|
||||||
typedef internal::blas_traits<DerivedU> UBlasTraits;
|
typedef internal::blas_traits<DerivedU> UBlasTraits;
|
||||||
typedef typename UBlasTraits::DirectLinearAccessType ActualUType;
|
typedef typename UBlasTraits::DirectLinearAccessType ActualUType;
|
||||||
|
@ -154,7 +154,7 @@ public:
|
|||||||
* \a t in [0;1]
|
* \a t in [0;1]
|
||||||
* see http://en.wikipedia.org/wiki/Slerp
|
* see http://en.wikipedia.org/wiki/Slerp
|
||||||
*/
|
*/
|
||||||
template<class OtherDerived> Quaternion<Scalar> slerp(Scalar t, const QuaternionBase<OtherDerived>& other) const;
|
template<class OtherDerived> Quaternion<Scalar> slerp(const Scalar& t, const QuaternionBase<OtherDerived>& other) const;
|
||||||
|
|
||||||
/** \returns \c true if \c *this is approximately equal to \a other, within the precision
|
/** \returns \c true if \c *this is approximately equal to \a other, within the precision
|
||||||
* determined by \a prec.
|
* determined by \a prec.
|
||||||
@ -683,7 +683,7 @@ QuaternionBase<Derived>::angularDistance(const QuaternionBase<OtherDerived>& oth
|
|||||||
template <class Derived>
|
template <class Derived>
|
||||||
template <class OtherDerived>
|
template <class OtherDerived>
|
||||||
Quaternion<typename internal::traits<Derived>::Scalar>
|
Quaternion<typename internal::traits<Derived>::Scalar>
|
||||||
QuaternionBase<Derived>::slerp(Scalar t, const QuaternionBase<OtherDerived>& other) const
|
QuaternionBase<Derived>::slerp(const Scalar& t, const QuaternionBase<OtherDerived>& other) const
|
||||||
{
|
{
|
||||||
using std::acos;
|
using std::acos;
|
||||||
using std::sin;
|
using std::sin;
|
||||||
|
@ -535,7 +535,7 @@ class MatrixPowerReturnValue : public ReturnByValue<MatrixPowerReturnValue<Deriv
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
const MatrixPowerReturnValue<Derived> MatrixBase<Derived>::pow(RealScalar p) const
|
const MatrixPowerReturnValue<Derived> MatrixBase<Derived>::pow(const RealScalar& p) const
|
||||||
{ return MatrixPowerReturnValue<Derived>(derived(), p); }
|
{ return MatrixPowerReturnValue<Derived>(derived(), p); }
|
||||||
|
|
||||||
} // namespace Eigen
|
} // namespace Eigen
|
||||||
|
Loading…
x
Reference in New Issue
Block a user