Added Scaling function overload for vector rvalue reference

Reference issue

#2431 (closed)

What does this implement/fix?

Provides an overload to Scaling that takes an rvalue reference, so that if a user attempts to generate a diagonal (scaling) matrix from one, e.g. a temporary Vector<Scalar, Size>, they obtain a valid matrix. The current Scaling overload that is used when an eigen user tries to do this returns a DiagonalWrapper<Derived> unlike all the other Scaling functions.

The linked issue explains the issue in more detail, and shows an example of a user falling into this trap, as well as a code example demonstrating this overload working in the desired case.

Additional information

An alternative fix is to not supply an additional overload, but change the current overload that takes a vector and returns a DiagonalWrapper<Derived> and instead return a DiagonalMatrix, such as by the method used in the new overload in this MR.

Merge request reports

Loading