This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen
View | Details | Raw Unified | Return to bug 99 | Differences between
and this patch

Collapse All | Expand All

(-)a/Eigen/Core (-6 / +5 lines)
Lines 277-292 using std::size_t; Link Here
277
#include "src/Core/arch/Default/Settings.h"
277
#include "src/Core/arch/Default/Settings.h"
278
278
279
#include "src/Core/Functors.h"
279
#include "src/Core/Functors.h"
280
#include "src/Core/DenseCoeffsBase.h"
280
#include "src/Core/DenseCoeffsBase.h"
281
#include "src/Core/DenseBase.h"
281
#include "src/Core/DenseBase.h"
282
#include "src/Core/MatrixBase.h"
282
#include "src/Core/MatrixBase.h"
283
#include "src/Core/EigenBase.h"
283
#include "src/Core/EigenBase.h"
284
284
285
#define EIGEN_ENABLE_EVALUATORS
286
#include "src/Core/Product.h"
287
#include "src/Core/CoreEvaluators.h"
288
#include "src/Core/AssignEvaluator.h"
289
285
#ifndef EIGEN_PARSED_BY_DOXYGEN // work around Doxygen bug triggered by Assign.h r814874
290
#ifndef EIGEN_PARSED_BY_DOXYGEN // work around Doxygen bug triggered by Assign.h r814874
286
                                // at least confirmed with Doxygen 1.5.5 and 1.5.6
291
                                // at least confirmed with Doxygen 1.5.5 and 1.5.6
287
  #include "src/Core/Assign.h"
292
  #include "src/Core/Assign.h"
288
#endif
293
#endif
289
294
290
#include "src/Core/util/BlasUtil.h"
295
#include "src/Core/util/BlasUtil.h"
291
#include "src/Core/DenseStorage.h"
296
#include "src/Core/DenseStorage.h"
292
#include "src/Core/NestByValue.h"
297
#include "src/Core/NestByValue.h"
Lines 346-367 using std::size_t; Link Here
346
#include "src/Core/Select.h"
351
#include "src/Core/Select.h"
347
#include "src/Core/VectorwiseOp.h"
352
#include "src/Core/VectorwiseOp.h"
348
#include "src/Core/Random.h"
353
#include "src/Core/Random.h"
349
#include "src/Core/Replicate.h"
354
#include "src/Core/Replicate.h"
350
#include "src/Core/Reverse.h"
355
#include "src/Core/Reverse.h"
351
#include "src/Core/ArrayBase.h"
356
#include "src/Core/ArrayBase.h"
352
#include "src/Core/ArrayWrapper.h"
357
#include "src/Core/ArrayWrapper.h"
353
358
354
#ifdef EIGEN_ENABLE_EVALUATORS
355
#include "src/Core/Product.h"
356
#include "src/Core/CoreEvaluators.h"
357
#include "src/Core/AssignEvaluator.h"
358
#endif 
359
360
} // namespace Eigen
359
} // namespace Eigen
361
360
362
#include "src/Core/GlobalFunctions.h"
361
#include "src/Core/GlobalFunctions.h"
363
362
364
#include "src/Core/util/ReenableStupidWarnings.h"
363
#include "src/Core/util/ReenableStupidWarnings.h"
365
364
366
#ifdef EIGEN2_SUPPORT
365
#ifdef EIGEN2_SUPPORT
367
#include "Eigen2Support"
366
#include "Eigen2Support"
(-)a/Eigen/src/Core/Assign.h (-2 / +2 lines)
Lines 500-519 EIGEN_STRONG_INLINE Derived& DenseBase<D Link Here
500
    SameType = internal::is_same<typename Derived::Scalar,typename OtherDerived::Scalar>::value
500
    SameType = internal::is_same<typename Derived::Scalar,typename OtherDerived::Scalar>::value
501
  };
501
  };
502
502
503
  EIGEN_STATIC_ASSERT_LVALUE(Derived)
503
  EIGEN_STATIC_ASSERT_LVALUE(Derived)
504
  EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Derived,OtherDerived)
504
  EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Derived,OtherDerived)
505
  EIGEN_STATIC_ASSERT(SameType,YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
505
  EIGEN_STATIC_ASSERT(SameType,YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
506
506
507
#ifdef EIGEN_DEBUG_ASSIGN
507
#ifdef EIGEN_DEBUG_ASSIGN
508
  internal::assign_traits<Derived, OtherDerived>::debug();
508
  internal::copy_using_evaluator_traits<Derived, OtherDerived>::debug();
509
#endif
509
#endif
510
  eigen_assert(rows() == other.rows() && cols() == other.cols());
510
  eigen_assert(rows() == other.rows() && cols() == other.cols());
511
  internal::assign_impl<Derived, OtherDerived, int(SameType) ? int(internal::assign_traits<Derived, OtherDerived>::Traversal)
511
  internal::copy_using_evaluator_impl<Derived, OtherDerived, int(SameType) ? int(internal::copy_using_evaluator_traits<Derived, OtherDerived>::Traversal)
512
                                                       : int(InvalidTraversal)>::run(derived(),other.derived());
512
                                                       : int(InvalidTraversal)>::run(derived(),other.derived());
513
#ifndef EIGEN_NO_DEBUG
513
#ifndef EIGEN_NO_DEBUG
514
  checkTransposeAliasing(other.derived());
514
  checkTransposeAliasing(other.derived());
515
#endif
515
#endif
516
  return derived();
516
  return derived();
517
}
517
}
518
518
519
namespace internal {
519
namespace internal {
(-)a/Eigen/src/Core/SelfCwiseBinaryOp.h (-2 / +2 lines)
Lines 139-158 template<typename BinaryOp, typename Lhs Link Here
139
    // see CwiseBinaryOp ctor for details
139
    // see CwiseBinaryOp ctor for details
140
    template<typename RhsDerived>
140
    template<typename RhsDerived>
141
    EIGEN_STRONG_INLINE SelfCwiseBinaryOp& lazyAssign(const DenseBase<RhsDerived>& rhs)
141
    EIGEN_STRONG_INLINE SelfCwiseBinaryOp& lazyAssign(const DenseBase<RhsDerived>& rhs)
142
    {
142
    {
143
      EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Lhs,RhsDerived)
143
      EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Lhs,RhsDerived)
144
      EIGEN_CHECK_BINARY_COMPATIBILIY(BinaryOp,typename Lhs::Scalar,typename RhsDerived::Scalar);
144
      EIGEN_CHECK_BINARY_COMPATIBILIY(BinaryOp,typename Lhs::Scalar,typename RhsDerived::Scalar);
145
      
145
      
146
    #ifdef EIGEN_DEBUG_ASSIGN
146
    #ifdef EIGEN_DEBUG_ASSIGN
147
      internal::assign_traits<SelfCwiseBinaryOp, RhsDerived>::debug();
147
      internal::copy_using_evaluator_traits<SelfCwiseBinaryOp, RhsDerived>::debug();
148
    #endif
148
    #endif
149
      eigen_assert(rows() == rhs.rows() && cols() == rhs.cols());
149
      eigen_assert(rows() == rhs.rows() && cols() == rhs.cols());
150
      internal::assign_impl<SelfCwiseBinaryOp, RhsDerived>::run(*this,rhs.derived());
150
      internal::copy_using_evaluator_impl<SelfCwiseBinaryOp, RhsDerived>::run(*this,rhs.derived());
151
    #ifndef EIGEN_NO_DEBUG
151
    #ifndef EIGEN_NO_DEBUG
152
      this->checkTransposeAliasing(rhs.derived());
152
      this->checkTransposeAliasing(rhs.derived());
153
    #endif
153
    #endif
154
      return *this;
154
      return *this;
155
    }
155
    }
156
    
156
    
157
    // overloaded to honor evaluation of special matrices
157
    // overloaded to honor evaluation of special matrices
158
    // maybe another solution would be to not use SelfCwiseBinaryOp
158
    // maybe another solution would be to not use SelfCwiseBinaryOp
(-)a/test/evaluators.cpp (-15 / +18 lines)
Lines 44-74 void test_evaluators() Link Here
44
44
45
  VERIFY_IS_APPROX_EVALUATOR(w, RowVector2d::Zero());
45
  VERIFY_IS_APPROX_EVALUATOR(w, RowVector2d::Zero());
46
46
47
  VERIFY_IS_APPROX_EVALUATOR(w, RowVector2d::Constant(3));
47
  VERIFY_IS_APPROX_EVALUATOR(w, RowVector2d::Constant(3));
48
  
48
  
49
  // mix CwiseNullaryOp and transpose
49
  // mix CwiseNullaryOp and transpose
50
  VERIFY_IS_APPROX_EVALUATOR(w, Vector2d::Zero().transpose());
50
  VERIFY_IS_APPROX_EVALUATOR(w, Vector2d::Zero().transpose());
51
51
52
  {
52
  // This fails because there is no evaluator for GeneralProduct, which is the expression
53
    int s = internal::random<int>(1,100);
53
  // type produced by operator* acting on matrices.
54
    MatrixXf a(s,s), b(s,s), c(s,s), d(s,s);
54
  //
55
    a.setRandom();
55
  // {
56
    b.setRandom();
56
  //   int s = internal::random<int>(1,100);
57
    c.setRandom();
57
  //   MatrixXf a(s,s), b(s,s), c(s,s), d(s,s);
58
    d.setRandom();
58
  //   a.setRandom();
59
    VERIFY_IS_APPROX_EVALUATOR(d, (a + b));
59
  //   b.setRandom();
60
    VERIFY_IS_APPROX_EVALUATOR(d, (a + b).transpose());
60
  //   c.setRandom();
61
    VERIFY_IS_APPROX_EVALUATOR2(d, prod(a,b).transpose(), (a*b).transpose());
61
  //   d.setRandom();
62
    VERIFY_IS_APPROX_EVALUATOR2(d, prod(a,b) + prod(b,c), a*b + b*c);
62
  //   VERIFY_IS_APPROX_EVALUATOR(d, (a + b));
63
    
63
  //   VERIFY_IS_APPROX_EVALUATOR(d, (a + b).transpose());
64
//     copy_using_evaluator(d, a.transpose() + (a.transpose() * (b+b)));
64
  //   VERIFY_IS_APPROX_EVALUATOR2(d, prod(a,b).transpose(), (a*b).transpose());
65
//     cout << d << endl;
65
  //   VERIFY_IS_APPROX_EVALUATOR2(d, prod(a,b) + prod(b,c), a*b + b*c);
66
  }
66
  //   
67
  //   copy_using_evaluator(d, a.transpose() + (a.transpose() * (b+b)));
68
  //   cout << d << endl;
69
  // }
67
  
70
  
68
  // this does not work because Random is eval-before-nested: 
71
  // this does not work because Random is eval-before-nested: 
69
  // copy_using_evaluator(w, Vector2d::Random().transpose());
72
  // copy_using_evaluator(w, Vector2d::Random().transpose());
70
  
73
  
71
  // test CwiseUnaryOp
74
  // test CwiseUnaryOp
72
  VERIFY_IS_APPROX_EVALUATOR(v2, 3 * v);
75
  VERIFY_IS_APPROX_EVALUATOR(v2, 3 * v);
73
  VERIFY_IS_APPROX_EVALUATOR(w, (3 * v).transpose());
76
  VERIFY_IS_APPROX_EVALUATOR(w, (3 * v).transpose());
74
  VERIFY_IS_APPROX_EVALUATOR(b, (a + 3).transpose());
77
  VERIFY_IS_APPROX_EVALUATOR(b, (a + 3).transpose());
(-)a/test/main.h (-1 / +3 lines)
Lines 251-267 inline bool test_isApprox(const long dou Link Here
251
inline bool test_isMuchSmallerThan(const long double& a, const long double& b)
251
inline bool test_isMuchSmallerThan(const long double& a, const long double& b)
252
{ return internal::isMuchSmallerThan(a, b, test_precision<long double>()); }
252
{ return internal::isMuchSmallerThan(a, b, test_precision<long double>()); }
253
inline bool test_isApproxOrLessThan(const long double& a, const long double& b)
253
inline bool test_isApproxOrLessThan(const long double& a, const long double& b)
254
{ return internal::isApproxOrLessThan(a, b, test_precision<long double>()); }
254
{ return internal::isApproxOrLessThan(a, b, test_precision<long double>()); }
255
255
256
template<typename Type1, typename Type2>
256
template<typename Type1, typename Type2>
257
inline bool test_isApprox(const Type1& a, const Type2& b)
257
inline bool test_isApprox(const Type1& a, const Type2& b)
258
{
258
{
259
  return a.isApprox(b, test_precision<typename Type1::Scalar>());
259
  typename internal::eval<Type1>::type a_eval(a);
260
  typename internal::eval<Type2>::type b_eval(b);
261
  return a_eval.isApprox(b_eval, test_precision<typename Type1::Scalar>());
260
}
262
}
261
263
262
// The idea behind this function is to compare the two scalars a and b where
264
// The idea behind this function is to compare the two scalars a and b where
263
// the scalar ref is a hint about the expected order of magnitude of a and b.
265
// the scalar ref is a hint about the expected order of magnitude of a and b.
264
// Therefore, if for some reason a and b are very small compared to ref,
266
// Therefore, if for some reason a and b are very small compared to ref,
265
// we won't issue a false negative.
267
// we won't issue a false negative.
266
// This test could be: abs(a-b) <= eps * ref
268
// This test could be: abs(a-b) <= eps * ref
267
// However, it seems that simply comparing a+ref and b+ref is more sensitive to true error.
269
// However, it seems that simply comparing a+ref and b+ref is more sensitive to true error.

Return to bug 99