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 namespace Eigen {
15 
16 namespace internal {
17 
18 template<typename Derived, bool IsComplex>
20 {
21  // this is the implementation for the case IsComplex = true
22  static inline typename MatrixBase<Derived>::EigenvaluesReturnType const
24  {
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>
33 {
34  static inline typename MatrixBase<Derived>::EigenvaluesReturnType const
36  {
37  typedef typename Derived::PlainObject PlainObject;
38  PlainObject m_eval(m);
39  return EigenSolver<PlainObject>(m_eval, false).eigenvalues();
40  }
41 };
42 
43 } // end namespace internal
44 
65 template<typename Derived>
68 {
70 }
71 
86 template<typename MatrixType, unsigned int UpLo>
89 {
90  PlainObject thisAsMatrix(*this);
91  return SelfAdjointEigenSolver<PlainObject>(thisAsMatrix, false).eigenvalues();
92 }
93 
94 
95 
118 template<typename Derived>
119 inline typename MatrixBase<Derived>::RealScalar
121 {
122  using std::sqrt;
123  typename Derived::PlainObject m_eval(derived());
124  // FIXME if it is really guaranteed that the eigenvalues are already sorted,
125  // then we don't need to compute a maxCoeff() here, comparing the 1st and last ones is enough.
126  return sqrt((m_eval*m_eval.adjoint())
127  .eval()
128  .template selfadjointView<Lower>()
129  .eigenvalues()
130  .maxCoeff()
131  );
132 }
133 
149 template<typename MatrixType, unsigned int UpLo>
152 {
153  return eigenvalues().cwiseAbs().maxCoeff();
154 }
155 
156 } // end namespace Eigen
157 
158 #endif
EIGEN_DEVICE_FUNC
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:976
Eigen
Namespace containing all symbols from the Eigen library.
Definition: jet.h:637
Eigen::SelfAdjointView::RealScalar
NumTraits< Scalar >::Real RealScalar
Definition: SelfAdjointView.h:256
Eigen::MatrixBase::eigenvalues
EigenvaluesReturnType eigenvalues() const
Computes the eigenvalues of a matrix.
Definition: MatrixBaseEigenvalues.h:67
Eigen::SelfAdjointEigenSolver::eigenvalues
const EIGEN_DEVICE_FUNC RealVectorType & eigenvalues() const
Returns the eigenvalues of given matrix.
Definition: SelfAdjointEigenSolver.h:300
Eigen::SelfAdjointView< const Derived, UpLo >::PlainObject
MatrixType::PlainObject PlainObject
Definition: SelfAdjointView.h:71
Eigen::SelfAdjointView::eigenvalues
EIGEN_DEVICE_FUNC EigenvaluesReturnType eigenvalues() const
Computes the eigenvalues of a matrix.
Definition: MatrixBaseEigenvalues.h:88
Eigen::internal::eigenvalues_selector
Definition: MatrixBaseEigenvalues.h:19
Eigen::ComplexEigenSolver::eigenvalues
const EigenvalueType & eigenvalues() const
Returns the eigenvalues of given matrix.
Definition: ComplexEigenSolver.h:182
Eigen::SelfAdjointView::operatorNorm
EIGEN_DEVICE_FUNC RealScalar operatorNorm() const
Computes the L2 operator norm.
Definition: MatrixBaseEigenvalues.h:151
Eigen::MatrixBase::operatorNorm
RealScalar operatorNorm() const
Computes the L2 operator norm.
Definition: MatrixBaseEigenvalues.h:120
Eigen::SelfAdjointEigenSolver
Computes eigenvalues and eigenvectors of selfadjoint matrices.
Definition: SelfAdjointEigenSolver.h:76
gtsam.examples.DogLegOptimizerExample.run
def run(args)
Definition: DogLegOptimizerExample.py:21
m
Matrix3f m
Definition: AngleAxis_mimic_euler.cpp:1
Eigen::MatrixBase::RealScalar
NumTraits< Scalar >::Real RealScalar
Definition: MatrixBase.h:58
Eigen::MatrixBase::EigenvaluesReturnType
Matrix< std::complex< RealScalar >, internal::traits< Derived >::ColsAtCompileTime, 1, ColMajor > EigenvaluesReturnType
Definition: MatrixBase.h:115
Eigen::internal::eigenvalues_selector::run
static const MatrixBase< Derived >::EigenvaluesReturnType run(const MatrixBase< Derived > &m)
Definition: MatrixBaseEigenvalues.h:23
Eigen::ComplexEigenSolver
Computes eigenvalues and eigenvectors of general complex matrices.
Definition: ComplexEigenSolver.h:45
Eigen::EigenSolver
Computes eigenvalues and eigenvectors of general matrices.
Definition: EigenSolver.h:64
Eigen::Matrix
The matrix class, also used for vectors and row-vectors.
Definition: 3rdparty/Eigen/Eigen/src/Core/Matrix.h:178
internal
Definition: BandTriangularSolver.h:13
Eigen::MatrixBase
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:48
ceres::sqrt
Jet< T, N > sqrt(const Jet< T, N > &f)
Definition: jet.h:418
Eigen::internal::eigenvalues_selector< Derived, false >::run
static const MatrixBase< Derived >::EigenvaluesReturnType run(const MatrixBase< Derived > &m)
Definition: MatrixBaseEigenvalues.h:35
Eigen::EigenSolver::eigenvalues
const EigenvalueType & eigenvalues() const
Returns the eigenvalues of given matrix.
Definition: EigenSolver.h:244


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:03:06