Go to the documentation of this file.
12 #ifndef EIGEN_COMPLEX_EIGEN_SOLVER_H
13 #define EIGEN_COMPLEX_EIGEN_SOLVER_H
125 template<
typename InputType>
212 template<
typename InputType>
258 template<
typename MatrixType>
259 template<
typename InputType>
263 check_template_parameters();
270 m_schur.compute(
matrix.derived(), computeEigenvectors);
274 m_eivalues = m_schur.matrixT().diagonal();
275 if(computeEigenvectors)
276 doComputeEigenvectors(m_schur.matrixT().norm());
277 sortEigenvalues(computeEigenvectors);
280 m_isInitialized =
true;
281 m_eigenvectorsOk = computeEigenvectors;
286 template<
typename MatrixType>
289 const Index n = m_eivalues.size();
295 m_matX = EigenvectorType::Zero(
n,
n);
296 for(
Index k=
n-1 ; k>=0 ; k--)
302 m_matX.coeffRef(
i,k) = -m_schur.matrixT().coeff(
i,k);
304 m_matX.coeffRef(
i,k) -= (m_schur.matrixT().row(
i).segment(
i+1,k-
i-1) * m_matX.col(k).segment(
i+1,k-
i-1)).
value();
305 ComplexScalar z = m_schur.matrixT().coeff(
i,
i) - m_schur.matrixT().coeff(k,k);
312 m_matX.coeffRef(
i,k) = m_matX.coeff(
i,k) /
z;
317 m_eivec.noalias() = m_schur.matrixU() * m_matX;
319 for(
Index k=0 ; k<
n ; k++)
321 m_eivec.col(k).normalize();
326 template<
typename MatrixType>
329 const Index n = m_eivalues.size();
333 m_eivalues.cwiseAbs().tail(
n-
i).minCoeff(&k);
338 if(computeEigenvectors)
339 m_eivec.col(
i).swap(m_eivec.col(k));
346 #endif // EIGEN_COMPLEX_EIGEN_SOLVER_H
ComplexEigenSolver()
Default constructor.
Matrix< ComplexScalar, RowsAtCompileTime, ColsAtCompileTime, Options, MaxRowsAtCompileTime, MaxColsAtCompileTime > EigenvectorType
Type for matrix of eigenvectors as returned by eigenvectors().
ComplexEigenSolver(const EigenBase< InputType > &matrix, bool computeEigenvectors=true)
Constructor; computes eigendecomposition of given matrix.
EigenvalueType m_eivalues
void doComputeEigenvectors(RealScalar matrixnorm)
Namespace containing all symbols from the Eigen library.
ComplexSchur & setMaxIterations(Index maxIters)
Sets the maximum number of iterations allowed.
ComplexSchur< MatrixType > m_schur
std::complex< RealScalar > ComplexScalar
Complex scalar type for MatrixType.
ComplexEigenSolver & setMaxIterations(Index maxIters)
Sets the maximum number of iterations allowed.
static void check_template_parameters()
Index getMaxIterations()
Returns the maximum number of iterations.
const EigenvalueType & eigenvalues() const
Returns the eigenvalues of given matrix.
ComputationInfo info() const
Reports whether previous computation was successful.
NumTraits< Scalar >::Real RealScalar
EIGEN_DEVICE_FUNC internal::add_const_on_value_type< EIGEN_MATHFUNC_RETVAL(real_ref, Scalar) >::type real_ref(const Scalar &x)
void swap(GeographicLib::NearestNeighbor< dist_t, pos_t, distfun_t > &a, GeographicLib::NearestNeighbor< dist_t, pos_t, distfun_t > &b)
ComplexEigenSolver(Index size)
Default Constructor with memory preallocation.
Map< Matrix< T, Dynamic, Dynamic, ColMajor >, 0, OuterStride<> > matrix(T *data, int rows, int cols, int stride)
_MatrixType MatrixType
Synonym for the template parameter _MatrixType.
const EigenvectorType & eigenvectors() const
Returns the eigenvectors of given matrix.
Index getMaxIterations()
Returns the maximum number of iterations.
ComputationInfo info() const
Reports whether previous computation was successful.
MatrixType::Scalar Scalar
Scalar type for matrices of type MatrixType.
Computes eigenvalues and eigenvectors of general complex matrices.
ComplexEigenSolver & compute(const EigenBase< InputType > &matrix, bool computeEigenvectors=true)
Computes eigendecomposition of given matrix.
void sortEigenvalues(bool computeEigenvectors)
The matrix class, also used for vectors and row-vectors.
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T maxi(const T &x, const T &y)
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
#define EIGEN_STATIC_ASSERT_NON_INTEGER(TYPE)
gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:02:00