11#ifndef EIGEN_BLOCK_HOUSEHOLDER_H
12#define EIGEN_BLOCK_HOUSEHOLDER_H
50template<
typename TriangularFactorType,
typename VectorsType,
typename CoeffsType>
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>();
68 for(
Index j=nbVecs-1; j>i; --j)
70 typename TriangularFactorType::Scalar z = triFactor(i,j);
71 triFactor(i,j) = z * triFactor(j,j);
73 triFactor.row(i).tail(nbVecs-j-1) += z * triFactor.row(j).tail(nbVecs-j-1);
77 triFactor(i,i) = hCoeffs(i);
85template<
typename MatrixType,
typename VectorsType,
typename CoeffsType>
88 enum { TFactorSize = MatrixType::ColsAtCompileTime };
89 Index nbVecs = vectors.cols();
97 Matrix<
typename MatrixType::Scalar,VectorsType::ColsAtCompileTime,MatrixType::ColsAtCompileTime,
98 (VectorsType::MaxColsAtCompileTime==1 && MatrixType::MaxColsAtCompileTime!=1)?
RowMajor:
ColMajor,
99 VectorsType::MaxColsAtCompileTime,MatrixType::MaxColsAtCompileTime> tmp = V.
adjoint() * mat;
101 if(forward) tmp = T.template triangularView<Upper>() * tmp;
102 else tmp = T.template triangularView<Upper>().adjoint() * tmp;
103 mat.noalias() -= V * tmp;
#define eigen_assert(x)
Definition: Macros.h:1047
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:180
Expression of a triangular part in a matrix.
Definition: TriangularMatrix.h:189
EIGEN_DEVICE_FUNC const AdjointReturnType adjoint() const
Definition: TriangularMatrix.h:260
@ ColMajor
Storage order is column major (see TopicStorageOrders).
Definition: Constants.h:319
@ RowMajor
Storage order is row major (see TopicStorageOrders).
Definition: Constants.h:321
void make_block_householder_triangular_factor(TriangularFactorType &triFactor, const VectorsType &vectors, const CoeffsType &hCoeffs)
Definition: BlockHouseholder.h:51
void apply_block_householder_on_the_left(MatrixType &mat, const VectorsType &vectors, const CoeffsType &hCoeffs, bool forward)
Definition: BlockHouseholder.h:86
Namespace containing all symbols from the Eigen library.
Definition: Core:141
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:74
Definition: Eigen_Colamd.h:50