From 7579360672c7e149eeed5a2f777ed36305885aea Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Mon, 27 Jul 2009 18:50:39 +0200 Subject: [PATCH] fix compilation of the doc and started a page dedicated to high performance and or BLAS users --- doc/I02_HiPerformance.dox | 101 +++++++++++++++++++++++++ doc/snippets/HouseholderQR_solve.cpp | 2 +- doc/snippets/MatrixBase_asDiagonal.cpp | 2 +- doc/snippets/MatrixBase_extract.cpp | 3 + doc/snippets/MatrixBase_marked.cpp | 3 + doc/snippets/MatrixBase_part.cpp | 3 + 6 files changed, 112 insertions(+), 2 deletions(-) create mode 100644 doc/I02_HiPerformance.dox diff --git a/doc/I02_HiPerformance.dox b/doc/I02_HiPerformance.dox new file mode 100644 index 000000000..012e7d71b --- /dev/null +++ b/doc/I02_HiPerformance.dox @@ -0,0 +1,101 @@ + +namespace Eigen { + +/** \page HiPerformance Advanced - Using Eigen with high performance + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
BLAS equivalent routineEfficient version
(compile to a single optimized evaluation)
Less efficient equivalent version
(requires multiple evaluations)
comments
GEMMm1 = s1 * m2 * m3m1 = s1 * (m2 * m3)This is because m2 * m3 is evaluated by the scalar product.
GEMMm1 += s1 * m2.adjoint() * m3m1 += (s1 * m2).adjoint() * m3This is because our expression analyser stops at the first transpose expression and cannot extract the nested scalar multiple.
GEMMm1 += m2.adjoint() * m3m1 += m2.conjugate().transpose() * m3For the same reason. Use .adjoint() or .transpose().conjugate()
GEMMm1 -= (-(s0*m2).conjugate()*s1) * (s2 * m3.adjoint() * s3)Note that s0 is automatically conjugated during the simplification of the expression.
SYRm.sefadjointView().rankUpdate(v,s)Computes m += s * v * v.adjoint()
SYR2m.sefadjointView().rankUpdate(u,v,s)Computes m += s * u * v.adjoint() + s * v * u.adjoint()
SYRKm1.sefadjointView().rankUpdate(m2.adjoint(),s)Computes m1 += s * m2.adjoint() * m2
SYMM/HEMMm3 -= s1 * m1.sefadjointView() * m2.adjoint()
SYMM/HEMMm3 += s1 * m2.transpose() * m1.conjugate().sefadjointView()
TRMMm3 -= s1 * m1.triangularView() * m2.adjoint()
TRSV / TRSMm1.adjoint().triangularView().solveInPlace(m2)
+ +*/ + +} diff --git a/doc/snippets/HouseholderQR_solve.cpp b/doc/snippets/HouseholderQR_solve.cpp index aa9404951..429bd81e3 100644 --- a/doc/snippets/HouseholderQR_solve.cpp +++ b/doc/snippets/HouseholderQR_solve.cpp @@ -4,6 +4,6 @@ Matrix3f y = Matrix3f::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is the matrix y:" << endl << y << endl; Matrix3f x; -m.householderQr().solve(y, &x)); +m.householderQr().solve(y, &x); assert(y.isApprox(m*x)); cout << "Here is a solution x to the equation mx=y:" << endl << x << endl; diff --git a/doc/snippets/MatrixBase_asDiagonal.cpp b/doc/snippets/MatrixBase_asDiagonal.cpp index 4cbff8231..b01082db1 100644 --- a/doc/snippets/MatrixBase_asDiagonal.cpp +++ b/doc/snippets/MatrixBase_asDiagonal.cpp @@ -1 +1 @@ -cout << Vector3i(2,5,6).asDiagonal() << endl; +cout << Matrix3i(Vector3i(2,5,6).asDiagonal()) << endl; diff --git a/doc/snippets/MatrixBase_extract.cpp b/doc/snippets/MatrixBase_extract.cpp index 02f44c83f..a5ccd7574 100644 --- a/doc/snippets/MatrixBase_extract.cpp +++ b/doc/snippets/MatrixBase_extract.cpp @@ -1,3 +1,5 @@ +#warning deprecated +/* deprecated Matrix3i m = Matrix3i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is the upper-triangular matrix extracted from m:" << endl @@ -6,3 +8,4 @@ cout << "Here is the strictly-upper-triangular matrix extracted from m:" << endl << m.part() << endl; cout << "Here is the unit-lower-triangular matrix extracted from m:" << endl << m.part() << endl; +*/ \ No newline at end of file diff --git a/doc/snippets/MatrixBase_marked.cpp b/doc/snippets/MatrixBase_marked.cpp index 5c05ce81e..f536773c9 100644 --- a/doc/snippets/MatrixBase_marked.cpp +++ b/doc/snippets/MatrixBase_marked.cpp @@ -1,3 +1,5 @@ +#warning deprecated +/* Matrix3d m = Matrix3d::Zero(); m.part().setOnes(); cout << "Here is the matrix m:" << endl << m << endl; @@ -7,3 +9,4 @@ cout << "Here is the matrix n:" << endl << n << endl; cout << "And now here is m.inverse()*n, taking advantage of the fact that" " m is upper-triangular:" << endl << m.marked().solveTriangular(n); +*/ \ No newline at end of file diff --git a/doc/snippets/MatrixBase_part.cpp b/doc/snippets/MatrixBase_part.cpp index 6f393a14a..81e66c4cd 100644 --- a/doc/snippets/MatrixBase_part.cpp +++ b/doc/snippets/MatrixBase_part.cpp @@ -1,3 +1,5 @@ +#warning deprecated +/* Matrix3d m = Matrix3d::Zero(); m.part().setOnes(); cout << "Here is the matrix m:" << endl << m << endl; @@ -6,3 +8,4 @@ cout << "And let us now compute m*m.adjoint() in a very optimized way" << endl Matrix3d n; n.part() = (m*m.adjoint()).lazy(); cout << "The result is:" << endl << n << endl; +*/ \ No newline at end of file