diff options
author | 2008-03-26 09:29:29 +0000 | |
---|---|---|
committer | 2008-03-26 09:29:29 +0000 | |
commit | c9b0dcd733b94c8a3faf3f110c2d4823aaaa337c (patch) | |
tree | ca5356df4302491c63b0b60fdbe545f278e04dcd | |
parent | a994e51c96565d52edb80996167b61e67b0deba7 (diff) |
look at that subtle difference in Product.h...
the cacheOptimal is only good for large enough matrices.
When taking a block in a fixed-size (hence small) matrix,
the SizeAtCompileTime is Dynamic hence that's not a good
indicator. This example shows that the good indicator is
MaxSizeAtCompileTime.
Result: +10% speed in echelon.cpp
-rw-r--r-- | Eigen/src/Core/Product.h | 3 | ||||
-rw-r--r-- | doc/echelon.cpp | 4 |
2 files changed, 4 insertions, 3 deletions
diff --git a/Eigen/src/Core/Product.h b/Eigen/src/Core/Product.h index 548656209..a1ec6b8d2 100644 --- a/Eigen/src/Core/Product.h +++ b/Eigen/src/Core/Product.h @@ -91,8 +91,9 @@ struct ei_product_eval_mode { enum { SizeAtCompileTime = MatrixBase<Product<Lhs,Rhs,UnrolledDotProduct> >::SizeAtCompileTime, + MaxSizeAtCompileTime = MatrixBase<Product<Lhs,Rhs,UnrolledDotProduct> >::MaxSizeAtCompileTime, EvalMode = ( EIGEN_UNROLLED_LOOPS - && SizeAtCompileTime != Dynamic + && MaxSizeAtCompileTime != Dynamic && SizeAtCompileTime <= EIGEN_UNROLLING_LIMIT) ? UnrolledDotProduct : CacheOptimal, }; }; diff --git a/doc/echelon.cpp b/doc/echelon.cpp index 8e3b03cd9..d28726b0f 100644 --- a/doc/echelon.cpp +++ b/doc/echelon.cpp @@ -67,8 +67,8 @@ int main(int, char **) // now m is still a matrix of rank N-1 cout << "Here's the matrix m:" << endl << m << endl; - cout << "Now let's echelon m:" << endl; - echelon(m); + cout << "Now let's echelon m (repeating many times for benchmarking purposes):" << endl; + for(int i = 0; i < 1000000; i++) echelon(m); cout << "Now m is:" << endl << m << endl; } |