Warning, file /include/eigen3/Eigen/src/Householder/BlockHouseholder.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef EIGEN_BLOCK_HOUSEHOLDER_H
0012 #define EIGEN_BLOCK_HOUSEHOLDER_H
0013
0014
0015
0016 namespace Eigen {
0017
0018 namespace internal {
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050 template<typename TriangularFactorType,typename VectorsType,typename CoeffsType>
0051 void make_block_householder_triangular_factor(TriangularFactorType& triFactor, const VectorsType& vectors, const CoeffsType& hCoeffs)
0052 {
0053 const Index nbVecs = vectors.cols();
0054 eigen_assert(triFactor.rows() == nbVecs && triFactor.cols() == nbVecs && vectors.rows()>=nbVecs);
0055
0056 for(Index i = nbVecs-1; i >=0 ; --i)
0057 {
0058 Index rs = vectors.rows() - i - 1;
0059 Index rt = nbVecs-i-1;
0060
0061 if(rt>0)
0062 {
0063 triFactor.row(i).tail(rt).noalias() = -hCoeffs(i) * vectors.col(i).tail(rs).adjoint()
0064 * vectors.bottomRightCorner(rs, rt).template triangularView<UnitLower>();
0065
0066
0067
0068 for(Index j=nbVecs-1; j>i; --j)
0069 {
0070 typename TriangularFactorType::Scalar z = triFactor(i,j);
0071 triFactor(i,j) = z * triFactor(j,j);
0072 if(nbVecs-j-1>0)
0073 triFactor.row(i).tail(nbVecs-j-1) += z * triFactor.row(j).tail(nbVecs-j-1);
0074 }
0075
0076 }
0077 triFactor(i,i) = hCoeffs(i);
0078 }
0079 }
0080
0081
0082
0083
0084
0085 template<typename MatrixType,typename VectorsType,typename CoeffsType>
0086 void apply_block_householder_on_the_left(MatrixType& mat, const VectorsType& vectors, const CoeffsType& hCoeffs, bool forward)
0087 {
0088 enum { TFactorSize = MatrixType::ColsAtCompileTime };
0089 Index nbVecs = vectors.cols();
0090 Matrix<typename MatrixType::Scalar, TFactorSize, TFactorSize, RowMajor> T(nbVecs,nbVecs);
0091
0092 if(forward) make_block_householder_triangular_factor(T, vectors, hCoeffs);
0093 else make_block_householder_triangular_factor(T, vectors, hCoeffs.conjugate());
0094 const TriangularView<const VectorsType, UnitLower> V(vectors);
0095
0096
0097 Matrix<typename MatrixType::Scalar,VectorsType::ColsAtCompileTime,MatrixType::ColsAtCompileTime,
0098 (VectorsType::MaxColsAtCompileTime==1 && MatrixType::MaxColsAtCompileTime!=1)?RowMajor:ColMajor,
0099 VectorsType::MaxColsAtCompileTime,MatrixType::MaxColsAtCompileTime> tmp = V.adjoint() * mat;
0100
0101 if(forward) tmp = T.template triangularView<Upper>() * tmp;
0102 else tmp = T.template triangularView<Upper>().adjoint() * tmp;
0103 mat.noalias() -= V * tmp;
0104 }
0105
0106 }
0107
0108 }
0109
0110 #endif