This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen
Bug 482 - Pass scalar arguments by const ref
Summary: Pass scalar arguments by const ref
Status: RESOLVED FIXED
Alias: None
Product: Eigen
Classification: Unclassified
Component: General (show other bugs)
Version: unspecified
Hardware: All All
: Normal Unknown
Assignee: Nobody
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 3.2
  Show dependency treegraph
 
Reported: 2012-06-27 17:12 UTC by Gael Guennebaud
Modified: 2019-12-04 11:45 UTC (History)
2 users (show)



Attachments
replace 'RealScalar' arguments by 'const RealScalar&' in the Core module (18.16 KB, application/octet-stream)
2012-06-27 17:12 UTC, Gael Guennebaud
no flags Details

Description Gael Guennebaud 2012-06-27 17:12:59 UTC
Created attachment 281 [details]
replace 'RealScalar' arguments by 'const RealScalar&' in the Core module

This is needed when the scalar type requires some specific alignment since MSVC cannot align function arguments.
Comment 1 Gael Guennebaud 2012-06-27 17:14:13 UTC
the patch is incomplete, we need to check the other modules too.
Comment 2 Gael Guennebaud 2012-06-28 02:20:21 UTC
a first pass:
https://bitbucket.org/eigen/eigen/changeset/0c5fc8f89361/
changeset:   0c5fc8f89361
user:        ggael
date:        2012-06-28 02:08:59
summary:     bug 482: pass scalar arguments by const references. This changeset only concerns the Core and Geometry modules

We need an automatic process to track them.
Comment 3 Gael Guennebaud 2012-06-28 21:07:21 UTC
pass on sparse module:

https://bitbucket.org/eigen/eigen/changeset/28c7f269dac7/
changeset:   28c7f269dac7
user:        ggael
date:        2012-06-28 21:01:02
summary:     bug 482: pass scalar by const ref - pass on the sparse module
(also fix a compilation issue due to previous pass)
Comment 4 Gael Guennebaud 2013-02-25 18:07:33 UTC
Pass 3:

https://bitbucket.org/eigen/eigen/commits/56956bb0c314/
changeset:   56956bb0c314
user:        ggael
date:        2013-02-25 18:05:57
summary:     bug 482: pass scalar arguments by const references.

It only remains the following cases that I'm not sure about because I thin they might break the ABI:

Eigen/src/Core/DenseBase.h:    select(const DenseBase<ThenDerived>& thenMatrix, typename ThenDerived::Scalar elseScalar) const;
Eigen/src/Core/DenseBase.h:    select(typename ElseDerived::Scalar thenScalar, const DenseBase<ElseDerived>& elseMatrix) const;
Eigen/src/Core/GlobalFunctions.h:    operator/(typename Derived::Scalar s, const Eigen::ArrayBase<Derived>& a)
Eigen/src/Core/MatrixBase.h:    const MatrixPowerReturnValue<Derived> pow(RealScalar p) const;
Eigen/src/Core/ProductBase.h:operator*(const ProductBase<Derived,Lhs,Rhs>& prod, typename Derived::Scalar x)
Eigen/src/Core/ProductBase.h:operator*(typename Derived::Scalar x,const ProductBase<Derived,Lhs,Rhs>& prod)
Eigen/src/Core/products/SelfadjointProduct.h:::rankUpdate(const MatrixBase<DerivedU>& u, Scalar alpha)
Eigen/src/Core/products/SelfadjointRank2Update.h:::rankUpdate(const MatrixBase<DerivedU>& u, const MatrixBase<DerivedV>& v, Scalar alpha)
Eigen/src/Core/SelfAdjointView.h:    SelfAdjointView& rankUpdate(const MatrixBase<DerivedU>& u, const MatrixBase<DerivedV>& v, Scalar alpha = Scalar(1));
Eigen/src/Core/SelfAdjointView.h:    SelfAdjointView& rankUpdate(const MatrixBase<DerivedU>& u, Scalar alpha = Scalar(1));
Eigen/src/Geometry/Quaternion.h:  template<class OtherDerived> Quaternion<Scalar> slerp(Scalar t, const QuaternionBase<OtherDerived>& other) const;
Eigen/src/Geometry/Quaternion.h:QuaternionBase<Derived>::slerp(Scalar t, const QuaternionBase<OtherDerived>& other) const
Eigen/src/SuperLUSupport/SuperLUSupport.h:      eigen_assert(false && "Scalar type not supported by SuperLU");
Comment 5 Gael Guennebaud 2013-04-12 15:29:07 UTC
Finally, I don't think such a change might break ABI in practice, and moreover such a change is really important to preserve alignment. 

https://bitbucket.org/eigen/eigen/commits/6332c61ffc97/
Changeset:   6332c61ffc97
User:        ggael
Date:        2013-04-12 15:26:55
Summary:     Fix bug 482: pass scalar value by const reference (it remained a few cases)
Comment 6 Nobody 2019-12-04 11:45:13 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/482.

Note You need to log in before you can comment on or make changes to this bug.