diff options
author | Benoit Jacob <jacob.benoit.1@gmail.com> | 2010-05-09 13:20:46 -0400 |
---|---|---|
committer | Benoit Jacob <jacob.benoit.1@gmail.com> | 2010-05-09 13:20:46 -0400 |
commit | 82d898083f4783517c8af430c776105a7ac9f8f9 (patch) | |
tree | 5ffa90994ed613ee623c30c51d5964bf806148e1 | |
parent | 6624b93d67dea8fd07a60a0b8508d670b45efc1e (diff) |
fix compilation error thanks to test case by Trevor Irons, and expand unit test
-rw-r--r-- | Eigen/src/Core/DenseCoeffsBase.h | 6 | ||||
-rw-r--r-- | Eigen/src/Core/Functors.h | 2 | ||||
-rw-r--r-- | test/basicstuff.cpp | 6 |
3 files changed, 10 insertions, 4 deletions
diff --git a/Eigen/src/Core/DenseCoeffsBase.h b/Eigen/src/Core/DenseCoeffsBase.h index d79b5c107..04ae24c7a 100644 --- a/Eigen/src/Core/DenseCoeffsBase.h +++ b/Eigen/src/Core/DenseCoeffsBase.h @@ -22,8 +22,8 @@ // License and a copy of the GNU General Public License along with // Eigen. If not, see <http://www.gnu.org/licenses/>. -#ifndef EIGEN_COEFFS_H -#define EIGEN_COEFFS_H +#ifndef EIGEN_DENSECOEFFSBASE_H +#define EIGEN_DENSECOEFFSBASE_H template<typename Derived, bool EnableDirectAccessAPI> class DenseCoeffsBase : public EigenBase<Derived> @@ -599,4 +599,4 @@ struct ei_outer_stride_at_compile_time<Derived, false> enum { ret = 0 }; }; -#endif // EIGEN_COEFFS_H +#endif // EIGEN_DENSECOEFFSBASE_H diff --git a/Eigen/src/Core/Functors.h b/Eigen/src/Core/Functors.h index 494a56fca..a42f36b1b 100644 --- a/Eigen/src/Core/Functors.h +++ b/Eigen/src/Core/Functors.h @@ -334,7 +334,7 @@ template<typename Scalar> struct ei_scalar_imag_ref_op { EIGEN_EMPTY_STRUCT_CTOR(ei_scalar_imag_ref_op) typedef typename NumTraits<Scalar>::Real result_type; - EIGEN_STRONG_INLINE result_type& operator() (Scalar& a) const { return ei_imag_ref(*const_cast<Scalar*>(&a)); } + EIGEN_STRONG_INLINE result_type& operator() (const Scalar& a) const { return ei_imag_ref(*const_cast<Scalar*>(&a)); } }; template<typename Scalar> struct ei_functor_traits<ei_scalar_imag_ref_op<Scalar> > diff --git a/test/basicstuff.cpp b/test/basicstuff.cpp index 7ef127ac2..53b503f46 100644 --- a/test/basicstuff.cpp +++ b/test/basicstuff.cpp @@ -147,6 +147,12 @@ template<typename MatrixType> void basicStuffComplex(const MatrixType& m) cm.imag() = rm2; VERIFY_IS_APPROX(static_cast<const MatrixType&>(cm).real(), rm1); VERIFY_IS_APPROX(static_cast<const MatrixType&>(cm).imag(), rm2); + rm1.setZero(); + rm2.setZero(); + rm1 = cm.real(); + rm2 = cm.imag(); + VERIFY_IS_APPROX(static_cast<const MatrixType&>(cm).real(), rm1); + VERIFY_IS_APPROX(static_cast<const MatrixType&>(cm).imag(), rm2); cm.real().setZero(); VERIFY(static_cast<const MatrixType&>(cm).real().isZero()); VERIFY(!static_cast<const MatrixType&>(cm).imag().isZero()); |