Added Scaling function overload for vector rvalue reference

This commit is contained in:
William Talbot 2022-04-04 16:50:09 +00:00 committed by Rasmus Munk Larsen
parent ba2cb835aa
commit 2c0ef43b48
2 changed files with 9 additions and 0 deletions

View File

@ -200,6 +200,10 @@ class DiagonalMatrix
explicit EIGEN_STRONG_INLINE DiagonalMatrix(const std::initializer_list<std::initializer_list<Scalar>>& list)
: m_diagonal(list) {}
/** \brief Constructs a DiagonalMatrix from an r-value diagonal vector type */
EIGEN_DEVICE_FUNC
explicit inline DiagonalMatrix(DiagonalVectorType&& diag) : m_diagonal(std::move(diag)) {}
/** Copy constructor. */
template<typename OtherDerived>
EIGEN_DEVICE_FUNC

View File

@ -162,6 +162,11 @@ template<typename Derived>
inline const DiagonalWrapper<const Derived> Scaling(const MatrixBase<Derived>& coeffs)
{ return coeffs.asDiagonal(); }
/** Constructs an axis aligned scaling expression from vector \a coeffs when passed as an rvalue reference */
template<typename Derived>
inline typename DiagonalWrapper<const Derived>::PlainObject Scaling(MatrixBase<Derived>&& coeffs)
{ return typename DiagonalWrapper<const Derived>::PlainObject(std::move(coeffs.derived())); }
/** \deprecated */
typedef DiagonalMatrix<float, 2> AlignedScaling2f;
/** \deprecated */