mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-03-31 19:00:35 +08:00
fix compilation of the doc and started a page dedicated to high performance and or BLAS users
This commit is contained in:
parent
5f3606bce9
commit
7579360672
101
doc/I02_HiPerformance.dox
Normal file
101
doc/I02_HiPerformance.dox
Normal file
@ -0,0 +1,101 @@
|
||||
|
||||
namespace Eigen {
|
||||
|
||||
/** \page HiPerformance Advanced - Using Eigen with high performance
|
||||
|
||||
<table class="tutorial_code">
|
||||
<tr>
|
||||
<td>BLAS equivalent routine</td>
|
||||
<td>Efficient version <br> (compile to a single optimized evaluation)</td>
|
||||
<td>Less efficient equivalent version <br> (requires multiple evaluations)</td>
|
||||
<td>comments</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>GEMM</td>
|
||||
<td>m1 = s1 * m2 * m3</td>
|
||||
<td>m1 = s1 * (m2 * m3)</td>
|
||||
<td>This is because m2 * m3 is evaluated by the scalar product.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>GEMM</td>
|
||||
<td>m1 += s1 * m2.adjoint() * m3</td>
|
||||
<td>m1 += (s1 * m2).adjoint() * m3</td>
|
||||
<td>This is because our expression analyser stops at the first transpose expression and cannot extract the nested scalar multiple.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>GEMM</td>
|
||||
<td>m1 += m2.adjoint() * m3</td>
|
||||
<td>m1 += m2.conjugate().transpose() * m3</td>
|
||||
<td>For the same reason. Use .adjoint() or .transpose().conjugate()</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>GEMM</td>
|
||||
<td>m1 -= (-(s0*m2).conjugate()*s1) * (s2 * m3.adjoint() * s3)</td>
|
||||
<td></td>
|
||||
<td>Note that s0 is automatically conjugated during the simplification of the expression.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SYR</td>
|
||||
<td>m.sefadjointView<LowerTriangular>().rankUpdate(v,s)</td>
|
||||
<td></td>
|
||||
<td>Computes m += s * v * v.adjoint()</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SYR2</td>
|
||||
<td>m.sefadjointView<LowerTriangular>().rankUpdate(u,v,s)</td>
|
||||
<td></td>
|
||||
<td>Computes m += s * u * v.adjoint() + s * v * u.adjoint()</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SYRK</td>
|
||||
<td>m1.sefadjointView<UpperTriangular>().rankUpdate(m2.adjoint(),s)</td>
|
||||
<td></td>
|
||||
<td>Computes m1 += s * m2.adjoint() * m2</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SYMM/HEMM</td>
|
||||
<td>m3 -= s1 * m1.sefadjointView<UpperTriangular>() * m2.adjoint()</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SYMM/HEMM</td>
|
||||
<td>m3 += s1 * m2.transpose() * m1.conjugate().sefadjointView<UpperTriangular>()</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>TRMM</td>
|
||||
<td>m3 -= s1 * m1.triangularView<UnitUpperTriangular>() * m2.adjoint()</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>TRSV / TRSM</td>
|
||||
<td>m1.adjoint().triangularView<UnitLowerTriangular>().solveInPlace(m2)</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
*/
|
||||
|
||||
}
|
@ -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;
|
||||
|
@ -1 +1 @@
|
||||
cout << Vector3i(2,5,6).asDiagonal() << endl;
|
||||
cout << Matrix3i(Vector3i(2,5,6).asDiagonal()) << endl;
|
||||
|
@ -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<Eigen::StrictlyUpperTriangular>() << endl;
|
||||
cout << "Here is the unit-lower-triangular matrix extracted from m:" << endl
|
||||
<< m.part<Eigen::UnitLowerTriangular>() << endl;
|
||||
*/
|
@ -1,3 +1,5 @@
|
||||
#warning deprecated
|
||||
/*
|
||||
Matrix3d m = Matrix3d::Zero();
|
||||
m.part<Eigen::UpperTriangular>().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<Eigen::UpperTriangular>().solveTriangular(n);
|
||||
*/
|
@ -1,3 +1,5 @@
|
||||
#warning deprecated
|
||||
/*
|
||||
Matrix3d m = Matrix3d::Zero();
|
||||
m.part<Eigen::StrictlyUpperTriangular>().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<Eigen::SelfAdjoint>() = (m*m.adjoint()).lazy();
|
||||
cout << "The result is:" << endl << n << endl;
|
||||
*/
|
Loading…
x
Reference in New Issue
Block a user