Remove const from return-by-value types (issue #1087)

libeigen/eigen!2144

Closes #1087

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
This commit is contained in:
Rasmus Munk Larsen
2026-02-18 03:10:11 -08:00
parent 3108f6360e
commit bdec88009d
22 changed files with 123 additions and 128 deletions

View File

@@ -247,7 +247,7 @@ class FullPivLU : public SolverBase<FullPivLU<MatrixType_, PermutationIndex_> >
* \sa TriangularView::solve(), kernel(), inverse()
*/
template <typename Rhs>
inline const Solve<FullPivLU, Rhs> solve(const MatrixBase<Rhs>& b) const;
inline Solve<FullPivLU, Rhs> solve(const MatrixBase<Rhs>& b) const;
#endif
/** \returns an estimate of the reciprocal condition number of the matrix of which \c *this is
@@ -394,7 +394,7 @@ class FullPivLU : public SolverBase<FullPivLU<MatrixType_, PermutationIndex_> >
*
* \sa MatrixBase::inverse()
*/
inline const Inverse<FullPivLU> inverse() const {
inline Inverse<FullPivLU> inverse() const {
eigen_assert(m_isInitialized && "LU is not initialized.");
eigen_assert(m_lu.rows() == m_lu.cols() && "You can't take the inverse of a non-square matrix!");
return Inverse<FullPivLU>(*this);
@@ -816,8 +816,7 @@ struct Assignment<
*/
template <typename Derived>
template <typename PermutationIndex>
inline const FullPivLU<typename MatrixBase<Derived>::PlainObject, PermutationIndex> MatrixBase<Derived>::fullPivLu()
const {
inline FullPivLU<typename MatrixBase<Derived>::PlainObject, PermutationIndex> MatrixBase<Derived>::fullPivLu() const {
return FullPivLU<PlainObject, PermutationIndex>(eval());
}

View File

@@ -276,7 +276,7 @@ struct Assignment<DstXprType, Inverse<XprType>,
* \sa computeInverseAndDetWithCheck()
*/
template <typename Derived>
EIGEN_DEVICE_FUNC inline const Inverse<Derived> MatrixBase<Derived>::inverse() const {
EIGEN_DEVICE_FUNC inline Inverse<Derived> MatrixBase<Derived>::inverse() const {
EIGEN_STATIC_ASSERT(!NumTraits<Scalar>::IsInteger, THIS_FUNCTION_IS_NOT_FOR_INTEGER_NUMERIC_TYPES)
eigen_assert(rows() == cols());
return Inverse<Derived>(derived());

View File

@@ -181,7 +181,7 @@ class PartialPivLU : public SolverBase<PartialPivLU<MatrixType_, PermutationInde
* \sa TriangularView::solve(), inverse(), computeInverse()
*/
template <typename Rhs>
inline const Solve<PartialPivLU, Rhs> solve(const MatrixBase<Rhs>& b) const;
inline Solve<PartialPivLU, Rhs> solve(const MatrixBase<Rhs>& b) const;
#endif
/** \returns an estimate of the reciprocal condition number of the matrix of which \c *this is
@@ -199,7 +199,7 @@ class PartialPivLU : public SolverBase<PartialPivLU<MatrixType_, PermutationInde
*
* \sa MatrixBase::inverse(), LU::inverse()
*/
inline const Inverse<PartialPivLU> inverse() const {
inline Inverse<PartialPivLU> inverse() const {
eigen_assert(m_isInitialized && "PartialPivLU is not initialized.");
return Inverse<PartialPivLU>(*this);
}
@@ -562,8 +562,8 @@ struct Assignment<
*/
template <typename Derived>
template <typename PermutationIndex>
inline const PartialPivLU<typename MatrixBase<Derived>::PlainObject, PermutationIndex>
MatrixBase<Derived>::partialPivLu() const {
inline PartialPivLU<typename MatrixBase<Derived>::PlainObject, PermutationIndex> MatrixBase<Derived>::partialPivLu()
const {
return PartialPivLU<PlainObject, PermutationIndex>(eval());
}
@@ -577,7 +577,7 @@ MatrixBase<Derived>::partialPivLu() const {
*/
template <typename Derived>
template <typename PermutationIndex>
inline const PartialPivLU<typename MatrixBase<Derived>::PlainObject, PermutationIndex> MatrixBase<Derived>::lu() const {
inline PartialPivLU<typename MatrixBase<Derived>::PlainObject, PermutationIndex> MatrixBase<Derived>::lu() const {
return PartialPivLU<PlainObject, PermutationIndex>(eval());
}