mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-13 20:26:03 +08:00
block householder : minor optimization
This commit is contained in:
parent
905beb0953
commit
6be06745df
@ -42,9 +42,8 @@ void ei_make_block_householder_triangular_factor(TriangularFactorType& triFactor
|
|||||||
Index rs = vectors.rows() - i;
|
Index rs = vectors.rows() - i;
|
||||||
Scalar Vii = vectors(i,i);
|
Scalar Vii = vectors(i,i);
|
||||||
vectors.const_cast_derived().coeffRef(i,i) = Scalar(1);
|
vectors.const_cast_derived().coeffRef(i,i) = Scalar(1);
|
||||||
triFactor.col(i).head(i).noalias() = vectors.block(i, 0, rs, i).adjoint()
|
triFactor.col(i).head(i).noalias() = -hCoeffs(i) * vectors.block(i, 0, rs, i).adjoint()
|
||||||
* vectors.col(i).tail(rs);
|
* vectors.col(i).tail(rs);
|
||||||
triFactor.col(i).head(i) *= -hCoeffs(i);
|
|
||||||
vectors.const_cast_derived().coeffRef(i, i) = Vii;
|
vectors.const_cast_derived().coeffRef(i, i) = Vii;
|
||||||
// FIXME add .noalias() once the triangular product can work inplace
|
// FIXME add .noalias() once the triangular product can work inplace
|
||||||
triFactor.col(i).head(i) = triFactor.block(0,0,i,i).template triangularView<Upper>()
|
triFactor.col(i).head(i) = triFactor.block(0,0,i,i).template triangularView<Upper>()
|
||||||
|
@ -62,7 +62,7 @@ template<typename _MatrixType> class HouseholderQR
|
|||||||
typedef typename MatrixType::Scalar Scalar;
|
typedef typename MatrixType::Scalar Scalar;
|
||||||
typedef typename MatrixType::RealScalar RealScalar;
|
typedef typename MatrixType::RealScalar RealScalar;
|
||||||
typedef typename MatrixType::Index Index;
|
typedef typename MatrixType::Index Index;
|
||||||
typedef Matrix<Scalar, RowsAtCompileTime, RowsAtCompileTime, ei_traits<MatrixType>::Flags&RowMajorBit ? RowMajor : ColMajor, MaxRowsAtCompileTime, MaxRowsAtCompileTime> MatrixQType;
|
typedef Matrix<Scalar, RowsAtCompileTime, RowsAtCompileTime, (MatrixType::Flags&RowMajorBit) ? RowMajor : ColMajor, MaxRowsAtCompileTime, MaxRowsAtCompileTime> MatrixQType;
|
||||||
typedef typename ei_plain_diag_type<MatrixType>::type HCoeffsType;
|
typedef typename ei_plain_diag_type<MatrixType>::type HCoeffsType;
|
||||||
typedef typename ei_plain_row_type<MatrixType>::type RowVectorType;
|
typedef typename ei_plain_row_type<MatrixType>::type RowVectorType;
|
||||||
typedef typename HouseholderSequence<MatrixType,HCoeffsType>::ConjugateReturnType HouseholderSequenceType;
|
typedef typename HouseholderSequence<MatrixType,HCoeffsType>::ConjugateReturnType HouseholderSequenceType;
|
||||||
@ -245,7 +245,7 @@ void ei_householder_qr_inplace_blocked(MatrixQR& mat, HCoeffs& hCoeffs,
|
|||||||
Index cols = mat.cols();
|
Index cols = mat.cols();
|
||||||
Index size = std::min(rows, cols);
|
Index size = std::min(rows, cols);
|
||||||
|
|
||||||
typedef Matrix<Scalar,Dynamic,1,0,MatrixQR::MaxColsAtCompileTime,1> TempType;
|
typedef Matrix<Scalar,Dynamic,1,ColMajor,MatrixQR::MaxColsAtCompileTime,1> TempType;
|
||||||
TempType tempVector;
|
TempType tempVector;
|
||||||
if(tempData==0)
|
if(tempData==0)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user