27 #ifndef EIGEN_COMPLEX_SCHUR_H
28 #define EIGEN_COMPLEX_SCHUR_H
35 template<
typename MatrixType,
bool IsComplex>
struct complex_schur_reduce_to_hessenberg;
79 typedef typename MatrixType::Scalar
Scalar;
81 typedef typename MatrixType::Index
Index;
127 :
m_matT(matrix.rows(),matrix.cols()),
128 m_matU(matrix.rows(),matrix.cols()),
225 bool subdiagonalEntryIsNeglegible(
Index i);
227 void reduceToTriangularForm(
bool computeU);
234 template<typename MatrixType>
249 template<
typename MatrixType>
252 if (iter == 10 || iter == 20)
260 Matrix<ComplexScalar,2,2> t =
m_matT.template block<2,2>(iu-1,iu-1);
272 if(internal::norm1(eival1) > internal::norm1(eival2))
273 eival2 = det / eival1;
275 eival1 = det / eival2;
278 if(internal::norm1(eival1-t.coeff(1,1)) < internal::norm1(eival2-t.coeff(1,1)))
279 return normt * eival1;
281 return normt * eival2;
285 template<
typename MatrixType>
291 if(matrix.cols() == 1)
293 m_matT = matrix.template cast<ComplexScalar>();
294 if(computeU)
m_matU = ComplexMatrixType::Identity(1,1);
302 reduceToTriangularForm(computeU);
309 template<
typename MatrixType,
bool IsComplex>
310 struct complex_schur_reduce_to_hessenberg
321 template<
typename MatrixType>
322 struct complex_schur_reduce_to_hessenberg<
MatrixType, false>
324 static void run(ComplexSchur<MatrixType>& _this,
const MatrixType& matrix,
bool computeU)
330 _this.m_hess.compute(matrix);
331 _this.m_matT = _this.m_hess.matrixH().template cast<ComplexScalar>();
336 _this.m_matU = Q.template cast<ComplexScalar>();
344 template<
typename MatrixType>
345 void ComplexSchur<MatrixType>::reduceToTriangularForm(
bool computeU)
360 if(!subdiagonalEntryIsNeglegible(iu-1))
break;
374 while(il > 0 && !subdiagonalEntryIsNeglegible(il-1))
383 ComplexScalar shift = computeShift(iu, iter);
384 JacobiRotation<ComplexScalar> rot;
387 m_matT.topRows((std::min)(il+2,iu)+1).applyOnTheRight(il, il+1, rot);
388 if(computeU)
m_matU.applyOnTheRight(il, il+1, rot);
390 for(
Index i=il+1 ; i<iu ; i++)
395 m_matT.topRows((std::min)(i+2,iu)+1).applyOnTheRight(i, i+1, rot);
396 if(computeU)
m_matU.applyOnTheRight(i, i+1, rot);
411 #endif // EIGEN_COMPLEX_SCHUR_H