11 #ifndef EIGEN_BLOCK_HOUSEHOLDER_H 12 #define EIGEN_BLOCK_HOUSEHOLDER_H 50 template<
typename TriangularFactorType,
typename VectorsType,
typename CoeffsType>
51 void make_block_householder_triangular_factor(TriangularFactorType& triFactor,
const VectorsType& vectors,
const CoeffsType& hCoeffs)
53 const Index nbVecs = vectors.cols();
54 eigen_assert(triFactor.rows() == nbVecs && triFactor.cols() == nbVecs && vectors.rows()>=nbVecs);
56 for(
Index i = nbVecs-1; i >=0 ; --i)
58 Index rs = vectors.rows() - i - 1;
59 Index rt = nbVecs-i-1;
63 triFactor.row(i).tail(rt).noalias() = -hCoeffs(i) * vectors.col(i).tail(rs).adjoint()
64 * vectors.bottomRightCorner(rs, rt).template triangularView<UnitLower>();
67 triFactor.row(i).tail(rt) = triFactor.row(i).tail(rt) * triFactor.bottomRightCorner(rt,rt).template triangularView<Upper>();
70 triFactor(i,i) = hCoeffs(i);
78 template<
typename MatrixType,
typename VectorsType,
typename CoeffsType>
79 void apply_block_householder_on_the_left(MatrixType& mat,
const VectorsType& vectors,
const CoeffsType& hCoeffs,
bool forward)
81 enum { TFactorSize = MatrixType::ColsAtCompileTime };
82 Index nbVecs = vectors.cols();
83 Matrix<typename MatrixType::Scalar, TFactorSize, TFactorSize, RowMajor> T(nbVecs,nbVecs);
85 if(forward) make_block_householder_triangular_factor(T, vectors, hCoeffs);
86 else make_block_householder_triangular_factor(T, vectors, hCoeffs.conjugate());
87 const TriangularView<const VectorsType, UnitLower> V(vectors);
90 Matrix<
typename MatrixType::Scalar,VectorsType::ColsAtCompileTime,MatrixType::ColsAtCompileTime,
91 (VectorsType::MaxColsAtCompileTime==1 && MatrixType::MaxColsAtCompileTime!=1)?
RowMajor:
ColMajor,
92 VectorsType::MaxColsAtCompileTime,MatrixType::MaxColsAtCompileTime> tmp = V.adjoint() * mat;
94 if(forward) tmp = T.template triangularView<Upper>() * tmp;
95 else tmp = T.template triangularView<Upper>().adjoint() * tmp;
96 mat.noalias() -= V * tmp;
103 #endif // EIGEN_BLOCK_HOUSEHOLDER_H Definition: Constants.h:320
Namespace containing all symbols from the Eigen library.
Definition: Core:287
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:33
Definition: Eigen_Colamd.h:50
Definition: Constants.h:322