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

@@ -158,7 +158,7 @@ class ColPivHouseholderQR : public SolverBase<ColPivHouseholderQR<MatrixType_, P
* Output: \verbinclude ColPivHouseholderQR_solve.out
*/
template <typename Rhs>
inline const Solve<ColPivHouseholderQR, Rhs> solve(const MatrixBase<Rhs>& b) const;
inline Solve<ColPivHouseholderQR, Rhs> solve(const MatrixBase<Rhs>& b) const;
#endif
HouseholderSequenceType householderQ() const;
@@ -318,7 +318,7 @@ class ColPivHouseholderQR : public SolverBase<ColPivHouseholderQR<MatrixType_, P
* \note If this matrix is not invertible, the returned matrix has undefined coefficients.
* Use isInvertible() to first determine whether this matrix is invertible.
*/
inline const Inverse<ColPivHouseholderQR> inverse() const {
inline Inverse<ColPivHouseholderQR> inverse() const {
eigen_assert(m_isInitialized && "ColPivHouseholderQR is not initialized.");
return Inverse<ColPivHouseholderQR>(*this);
}
@@ -664,7 +664,7 @@ ColPivHouseholderQR<MatrixType, PermutationIndex>::householderQ() const {
*/
template <typename Derived>
template <typename PermutationIndexType>
const ColPivHouseholderQR<typename MatrixBase<Derived>::PlainObject, PermutationIndexType>
ColPivHouseholderQR<typename MatrixBase<Derived>::PlainObject, PermutationIndexType>
MatrixBase<Derived>::colPivHouseholderQr() const {
return ColPivHouseholderQR<PlainObject, PermutationIndexType>(eval());
}

View File

@@ -140,7 +140,7 @@ class CompleteOrthogonalDecomposition
*
*/
template <typename Rhs>
inline const Solve<CompleteOrthogonalDecomposition, Rhs> solve(const MatrixBase<Rhs>& b) const;
inline Solve<CompleteOrthogonalDecomposition, Rhs> solve(const MatrixBase<Rhs>& b) const;
#endif
HouseholderSequenceType householderQ(void) const;
@@ -293,7 +293,7 @@ class CompleteOrthogonalDecomposition
* \warning: Do not compute \c this->pseudoInverse()*rhs to solve a linear systems.
* It is more efficient and numerically stable to call \c this->solve(rhs).
*/
inline const Inverse<CompleteOrthogonalDecomposition> pseudoInverse() const {
inline Inverse<CompleteOrthogonalDecomposition> pseudoInverse() const {
eigen_assert(m_cpqr.m_isInitialized && "CompleteOrthogonalDecomposition is not initialized.");
return Inverse<CompleteOrthogonalDecomposition>(*this);
}
@@ -638,7 +638,7 @@ CompleteOrthogonalDecomposition<MatrixType, PermutationIndex>::householderQ() co
*/
template <typename Derived>
template <typename PermutationIndex>
const CompleteOrthogonalDecomposition<typename MatrixBase<Derived>::PlainObject, PermutationIndex>
CompleteOrthogonalDecomposition<typename MatrixBase<Derived>::PlainObject, PermutationIndex>
MatrixBase<Derived>::completeOrthogonalDecomposition() const {
return CompleteOrthogonalDecomposition<PlainObject>(eval());
}

View File

@@ -186,7 +186,7 @@ class FullPivHouseholderQR : public SolverBase<FullPivHouseholderQR<MatrixType_,
* Output: \verbinclude FullPivHouseholderQR_solve.out
*/
template <typename Rhs>
inline const Solve<FullPivHouseholderQR, Rhs> solve(const MatrixBase<Rhs>& b) const;
inline Solve<FullPivHouseholderQR, Rhs> solve(const MatrixBase<Rhs>& b) const;
#endif
/** \returns Expression object representing the matrix Q
@@ -339,7 +339,7 @@ class FullPivHouseholderQR : public SolverBase<FullPivHouseholderQR<MatrixType_,
* \note If this matrix is not invertible, the returned matrix has undefined coefficients.
* Use isInvertible() to first determine whether this matrix is invertible.
*/
inline const Inverse<FullPivHouseholderQR> inverse() const {
inline Inverse<FullPivHouseholderQR> inverse() const {
eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
return Inverse<FullPivHouseholderQR>(*this);
}
@@ -723,7 +723,7 @@ FullPivHouseholderQR<MatrixType, PermutationIndex>::matrixQ() const {
*/
template <typename Derived>
template <typename PermutationIndex>
const FullPivHouseholderQR<typename MatrixBase<Derived>::PlainObject, PermutationIndex>
FullPivHouseholderQR<typename MatrixBase<Derived>::PlainObject, PermutationIndex>
MatrixBase<Derived>::fullPivHouseholderQr() const {
return FullPivHouseholderQR<PlainObject, PermutationIndex>(eval());
}

View File

@@ -156,7 +156,7 @@ class HouseholderQR : public SolverBase<HouseholderQR<MatrixType_>> {
* Output: \verbinclude HouseholderQR_solve.out
*/
template <typename Rhs>
inline const Solve<HouseholderQR, Rhs> solve(const MatrixBase<Rhs>& b) const;
inline Solve<HouseholderQR, Rhs> solve(const MatrixBase<Rhs>& b) const;
#endif
/** This method returns an expression of the unitary matrix Q as a sequence of Householder transformations.
@@ -534,7 +534,7 @@ void HouseholderQR<MatrixType>::computeInPlace() {
* \sa class HouseholderQR
*/
template <typename Derived>
const HouseholderQR<typename MatrixBase<Derived>::PlainObject> MatrixBase<Derived>::householderQr() const {
HouseholderQR<typename MatrixBase<Derived>::PlainObject> MatrixBase<Derived>::householderQr() const {
return HouseholderQR<PlainObject>(eval());
}