Skip to content

Enable fill_n and memset optimizations for construction and assignment

Reference issue

What does this implement/fix?

Currently, Eigen optimizes xpr.setConstant(val) and xpr.setZero() with fill_n and memset as appropriate. This MR enables the same optimization for expressive code like MatrixXf A = MatrixXf::Zero(rows, cols), which is semantically equivalent to MatrixXf A(rows, cols); A.setZero(); This MR intercepts assignments where the right hand side is either ConstantReturnType or ZeroReturnType, resizes the left hand side if needed, and uses the setConstant and setZero logic.

Additional information

Merge request reports

Loading