* implement the corner() API change: new methods topLeftCorner() etc

* get rid of BlockReturnType: it was not needed, and code was not always using it consistently anyway
* add topRows(), leftCols(), bottomRows(), rightCols()
* add corners unit-test covering all of that
* adapt docs, expand "porting from eigen 2 to 3"
* adapt Eigen2Support
This commit is contained in:
Benoit Jacob
2010-04-22 14:11:18 -04:00
parent 28dde19e40
commit 9962c59b56
37 changed files with 820 additions and 350 deletions

View File

@@ -171,11 +171,11 @@ Tridiagonalization<MatrixType>::matrixT(void) const
// and fill it ? (to avoid temporaries)
int n = m_matrix.rows();
MatrixType matT = m_matrix;
matT.corner(TopRight,n-1, n-1).diagonal() = subDiagonal().template cast<Scalar>().conjugate();
matT.topRightCorner(n-1, n-1).diagonal() = subDiagonal().template cast<Scalar>().conjugate();
if (n>2)
{
matT.corner(TopRight,n-2, n-2).template triangularView<Upper>().setZero();
matT.corner(BottomLeft,n-2, n-2).template triangularView<Lower>().setZero();
matT.topRightCorner(n-2, n-2).template triangularView<Upper>().setZero();
matT.bottomLeftCorner(n-2, n-2).template triangularView<Lower>().setZero();
}
return matT;
}
@@ -210,12 +210,12 @@ void Tridiagonalization<MatrixType>::_compute(MatrixType& matA, CoeffVectorType&
// i.e., A = H A H' where H = I - h v v' and v = matA.col(i).tail(n-i-1)
matA.col(i).coeffRef(i+1) = 1;
hCoeffs.tail(n-i-1).noalias() = (matA.corner(BottomRight,remainingSize,remainingSize).template selfadjointView<Lower>()
hCoeffs.tail(n-i-1).noalias() = (matA.bottomRightCorner(remainingSize,remainingSize).template selfadjointView<Lower>()
* (ei_conj(h) * matA.col(i).tail(remainingSize)));
hCoeffs.tail(n-i-1) += (ei_conj(h)*Scalar(-0.5)*(hCoeffs.tail(remainingSize).dot(matA.col(i).tail(remainingSize)))) * matA.col(i).tail(n-i-1);
matA.corner(BottomRight, remainingSize, remainingSize).template selfadjointView<Lower>()
matA.bottomRightCorner(remainingSize, remainingSize).template selfadjointView<Lower>()
.rankUpdate(matA.col(i).tail(remainingSize), hCoeffs.tail(remainingSize), -1);
matA.col(i).coeffRef(i+1) = beta;
@@ -243,7 +243,7 @@ void Tridiagonalization<MatrixType>::matrixQInPlace(MatrixBase<QDerived>* q) con
RowVectorType aux(n);
for (int i = n-2; i>=0; i--)
{
matQ.corner(BottomRight,n-i-1,n-i-1)
matQ.bottomRightCorner(n-i-1,n-i-1)
.applyHouseholderOnTheLeft(m_matrix.col(i).tail(n-i-2), ei_conj(m_hCoeffs.coeff(i)), &aux.coeffRef(0,0));
}
}