MatrixBaseEigenvalues.h
Go to the documentation of this file.
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
5 // Copyright (C) 2010 Jitse Niesen <jitse@maths.leeds.ac.uk>
6 //
7 // This Source Code Form is subject to the terms of the Mozilla
8 // Public License v. 2.0. If a copy of the MPL was not distributed
9 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 
11 #ifndef EIGEN_MATRIXBASEEIGENVALUES_H
12 #define EIGEN_MATRIXBASEEIGENVALUES_H
13 
14 // IWYU pragma: private
15 #include "./InternalHeaderCheck.h"
16 
17 namespace Eigen {
18 
19 namespace internal {
20 
21 template <typename Derived, bool IsComplex>
23  // this is the implementation for the case IsComplex = true
25  typedef typename Derived::PlainObject PlainObject;
26  PlainObject m_eval(m);
27  return ComplexEigenSolver<PlainObject>(m_eval, false).eigenvalues();
28  }
29 };
30 
31 template <typename Derived>
32 struct eigenvalues_selector<Derived, false> {
34  typedef typename Derived::PlainObject PlainObject;
35  PlainObject m_eval(m);
36  return EigenSolver<PlainObject>(m_eval, false).eigenvalues();
37  }
38 };
39 
40 } // end namespace internal
41 
62 template <typename Derived>
65 }
66 
81 template <typename MatrixType, unsigned int UpLo>
84  PlainObject thisAsMatrix(*this);
85  return SelfAdjointEigenSolver<PlainObject>(thisAsMatrix, false).eigenvalues();
86 }
87 
110 template <typename Derived>
112  using std::sqrt;
113  typename Derived::PlainObject m_eval(derived());
114  // FIXME if it is really guaranteed that the eigenvalues are already sorted,
115  // then we don't need to compute a maxCoeff() here, comparing the 1st and last ones is enough.
116  return sqrt((m_eval * m_eval.adjoint()).eval().template selfadjointView<Lower>().eigenvalues().maxCoeff());
117 }
118 
134 template <typename MatrixType, unsigned int UpLo>
137  return eigenvalues().cwiseAbs().maxCoeff();
138 }
139 
140 } // end namespace Eigen
141 
142 #endif
AnnoyingScalar sqrt(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:134
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:892
Computes eigenvalues and eigenvectors of general complex matrices.
Definition: ComplexEigenSolver.h:49
const EigenvalueType & eigenvalues() const
Returns the eigenvalues of given matrix.
Definition: ComplexEigenSolver.h:177
Computes eigenvalues and eigenvectors of general matrices.
Definition: EigenSolver.h:68
const EigenvalueType & eigenvalues() const
Returns the eigenvalues of given matrix.
Definition: EigenSolver.h:246
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:52
RealScalar operatorNorm() const
Computes the L2 operator norm.
Definition: MatrixBaseEigenvalues.h:111
EigenvaluesReturnType eigenvalues() const
Computes the eigenvalues of a matrix.
Definition: MatrixBaseEigenvalues.h:63
NumTraits< Scalar >::Real RealScalar
Definition: MatrixBase.h:60
The matrix class, also used for vectors and row-vectors.
Definition: Eigen/Eigen/src/Core/Matrix.h:186
Computes eigenvalues and eigenvectors of selfadjoint matrices.
Definition: SelfAdjointEigenSolver.h:82
EIGEN_DEVICE_FUNC const RealVectorType & eigenvalues() const
Returns the eigenvalues of given matrix.
Definition: SelfAdjointEigenSolver.h:300
MatrixType::PlainObject PlainObject
Definition: SelfAdjointView.h:72
EIGEN_DEVICE_FUNC RealScalar operatorNorm() const
Computes the L2 operator norm.
Definition: MatrixBaseEigenvalues.h:136
EIGEN_DEVICE_FUNC EigenvaluesReturnType eigenvalues() const
Computes the eigenvalues of a matrix.
Definition: MatrixBaseEigenvalues.h:83
NumTraits< Scalar >::Real RealScalar
Definition: SelfAdjointView.h:228
int * m
Definition: level2_cplx_impl.h:294
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:70
auto run(Kernel kernel, Args &&... args) -> decltype(kernel(args...))
Definition: gpu_test_helper.h:414
Definition: Eigen_Colamd.h:49
static MatrixBase< Derived >::EigenvaluesReturnType const run(const MatrixBase< Derived > &m)
Definition: MatrixBaseEigenvalues.h:33
Definition: MatrixBaseEigenvalues.h:22
static MatrixBase< Derived >::EigenvaluesReturnType const run(const MatrixBase< Derived > &m)
Definition: MatrixBaseEigenvalues.h:24