mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Clean up informal language, vague TODOs, and dead code in comments
libeigen/eigen!2191 Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
This commit is contained in:
@@ -277,8 +277,8 @@ typename ComplexSchur<MatrixType>::ComplexScalar ComplexSchur<MatrixType>::compu
|
||||
using std::abs;
|
||||
if ((iter == 10 || iter == 20) && iu > 1) {
|
||||
// exceptional shift, taken from http://www.netlib.org/eispack/comqr.f
|
||||
return ComplexSchur<MatrixType>::ComplexScalar(
|
||||
abs(numext::real(m_matT.coeff(iu, iu - 1))) + abs(numext::real(m_matT.coeff(iu - 1, iu - 2))));
|
||||
return ComplexSchur<MatrixType>::ComplexScalar(abs(numext::real(m_matT.coeff(iu, iu - 1))) +
|
||||
abs(numext::real(m_matT.coeff(iu - 1, iu - 2))));
|
||||
}
|
||||
|
||||
// compute the shift as one of the eigenvalues of t, the 2x2
|
||||
@@ -363,7 +363,7 @@ struct complex_schur_reduce_to_hessenberg<MatrixType, false> {
|
||||
_this.m_hess.compute(matrix);
|
||||
_this.m_matT = _this.m_hess.matrixH().template cast<ComplexScalar>();
|
||||
if (computeU) {
|
||||
// This may cause an allocation which seems to be avoidable
|
||||
// TODO: this temporary allocation could potentially be avoided.
|
||||
MatrixType Q = _this.m_hess.matrixQ();
|
||||
_this.m_matU = Q.template cast<ComplexScalar>();
|
||||
}
|
||||
|
||||
@@ -317,7 +317,7 @@ namespace internal {
|
||||
* HessenbergDecomposition class until the it is assigned or evaluated for
|
||||
* some other reason (the reference should remain valid during the life time
|
||||
* of this object). This class is the return type of
|
||||
* HessenbergDecomposition::matrixH(); there is probably no other use for this
|
||||
* HessenbergDecomposition::matrixH(); there is no other intended use for this
|
||||
* class.
|
||||
*/
|
||||
template <typename MatrixType>
|
||||
|
||||
@@ -111,8 +111,7 @@ template <typename Derived>
|
||||
inline typename MatrixBase<Derived>::RealScalar MatrixBase<Derived>::operatorNorm() const {
|
||||
using std::sqrt;
|
||||
typename Derived::PlainObject m_eval(derived());
|
||||
// FIXME if it is really guaranteed that the eigenvalues are already sorted,
|
||||
// then we don't need to compute a maxCoeff() here, comparing the 1st and last ones is enough.
|
||||
// FIXME: if eigenvalues are guaranteed to be sorted, comparing the first and last is sufficient.
|
||||
return sqrt((m_eval * m_eval.adjoint()).eval().template selfadjointView<Lower>().eigenvalues().maxCoeff());
|
||||
}
|
||||
|
||||
|
||||
@@ -343,7 +343,7 @@ RealSchur<MatrixType>& RealSchur<MatrixType>::computeFromHessenberg(const HessMa
|
||||
template <typename MatrixType>
|
||||
inline typename MatrixType::Scalar RealSchur<MatrixType>::computeNormOfT() {
|
||||
const Index size = m_matT.cols();
|
||||
// FIXME to be efficient the following would requires a triangular reduxion code
|
||||
// FIXME: a triangular reduction would be more efficient here.
|
||||
// Scalar norm = m_matT.upper().cwiseAbs().sum()
|
||||
// + m_matT.bottomLeftCorner(size-1,size-1).diagonal().cwiseAbs().sum();
|
||||
Scalar norm(0);
|
||||
|
||||
@@ -548,8 +548,7 @@ EIGEN_DEVICE_FUNC ComputationInfo computeFromTridiagonal_impl(DiagType& diag, Su
|
||||
info = NoConvergence;
|
||||
|
||||
// Sort eigenvalues and corresponding vectors.
|
||||
// TODO make the sort optional ?
|
||||
// TODO use a better sort algorithm !!
|
||||
// TODO: make the sort optional and use a more efficient sorting algorithm.
|
||||
if (info == Success) {
|
||||
for (Index i = 0; i < n - 1; ++i) {
|
||||
Index k;
|
||||
@@ -653,12 +652,12 @@ struct direct_selfadjoint_eigenvalues<SolverType, 3, false> {
|
||||
|
||||
// Shift the matrix to the mean eigenvalue and map the matrix coefficients to [-1:1] to avoid over- and underflow.
|
||||
Scalar shift = mat.trace() / Scalar(3);
|
||||
// TODO Avoid this copy. Currently it is necessary to suppress bogus values when determining maxCoeff and for
|
||||
// computing the eigenvectors later
|
||||
// TODO: avoid this copy. Currently necessary to suppress bogus values when determining maxCoeff and for
|
||||
// computing the eigenvectors later.
|
||||
MatrixType scaledMat = mat.template selfadjointView<Lower>();
|
||||
scaledMat.diagonal().array() -= shift;
|
||||
Scalar scale = scaledMat.cwiseAbs().maxCoeff();
|
||||
if (scale > 0) scaledMat /= scale; // TODO for scale==0 we could save the remaining operations
|
||||
if (scale > 0) scaledMat /= scale; // TODO: skip remaining operations when scale==0.
|
||||
|
||||
// compute the eigenvalues
|
||||
computeRoots(scaledMat, eivals);
|
||||
|
||||
Reference in New Issue
Block a user