mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-09 18:29:03 +08:00
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
This commit is contained in:
parent
a994e51c96
commit
c9b0dcd733
@ -91,8 +91,9 @@ struct ei_product_eval_mode
|
|||||||
{
|
{
|
||||||
enum {
|
enum {
|
||||||
SizeAtCompileTime = MatrixBase<Product<Lhs,Rhs,UnrolledDotProduct> >::SizeAtCompileTime,
|
SizeAtCompileTime = MatrixBase<Product<Lhs,Rhs,UnrolledDotProduct> >::SizeAtCompileTime,
|
||||||
|
MaxSizeAtCompileTime = MatrixBase<Product<Lhs,Rhs,UnrolledDotProduct> >::MaxSizeAtCompileTime,
|
||||||
EvalMode = ( EIGEN_UNROLLED_LOOPS
|
EvalMode = ( EIGEN_UNROLLED_LOOPS
|
||||||
&& SizeAtCompileTime != Dynamic
|
&& MaxSizeAtCompileTime != Dynamic
|
||||||
&& SizeAtCompileTime <= EIGEN_UNROLLING_LIMIT) ? UnrolledDotProduct : CacheOptimal,
|
&& SizeAtCompileTime <= EIGEN_UNROLLING_LIMIT) ? UnrolledDotProduct : CacheOptimal,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -67,8 +67,8 @@ int main(int, char **)
|
|||||||
// now m is still a matrix of rank N-1
|
// now m is still a matrix of rank N-1
|
||||||
cout << "Here's the matrix m:" << endl << m << endl;
|
cout << "Here's the matrix m:" << endl << m << endl;
|
||||||
|
|
||||||
cout << "Now let's echelon m:" << endl;
|
cout << "Now let's echelon m (repeating many times for benchmarking purposes):" << endl;
|
||||||
echelon(m);
|
for(int i = 0; i < 1000000; i++) echelon(m);
|
||||||
|
|
||||||
cout << "Now m is:" << endl << m << endl;
|
cout << "Now m is:" << endl << m << endl;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user