// demo intelligent auto-evaluation
m4 = m4 * m4; // auto-evaluates so no aliasing problem (performance penalty is low)
Eigen::Matrix4f other = (m4 * m4).lazy(); // forces lazy evaluation
m4 = m4 + m4; // here Eigen goes for lazy evaluation, as with most expressions
m4 = -m4 + m4 + 5 * m4; // same here, Eigen chooses lazy evaluation for all that.
m4 = m4 * (m4 + m4); // here Eigen chooses to first evaluate m4 + m4 into a temporary. // indeed, here it is an optimization to cache this intermediate result.
m3 = m3 * m4.block<3,3>(1,1); // here Eigen chooses NOT to evaluate block() into a temporary // because accessing coefficients of that block expression is not more costly than accessing // coefficients of a plain matrix.
m4 = m4 * m4.transpose(); // same here, lazy evaluation of the transpose.
m4 = m4 * m4.transpose().eval(); // forces immediate evaluation of the transpose
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.