RealSvd2x2.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) 2009-2010 Benoit Jacob <jacob.benoit.1@gmail.com>
5 // Copyright (C) 2013-2016 Gael Guennebaud <gael.guennebaud@inria.fr>
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_REALSVD2X2_H
12 #define EIGEN_REALSVD2X2_H
13 
14 namespace Eigen {
15 
16 namespace internal {
17 
18 template<typename MatrixType, typename RealScalar, typename Index>
22 {
23  using std::sqrt;
24  using std::abs;
26  m << numext::real(matrix.coeff(p,p)), numext::real(matrix.coeff(p,q)),
27  numext::real(matrix.coeff(q,p)), numext::real(matrix.coeff(q,q));
29  RealScalar t = m.coeff(0,0) + m.coeff(1,1);
30  RealScalar d = m.coeff(1,0) - m.coeff(0,1);
31 
33  {
34  rot1.s() = RealScalar(0);
35  rot1.c() = RealScalar(1);
36  }
37  else
38  {
39  // If d!=0, then t/d cannot overflow because the magnitude of the
40  // entries forming d are not too small compared to the ones forming t.
41  RealScalar u = t / d;
42  RealScalar tmp = sqrt(RealScalar(1) + numext::abs2(u));
43  rot1.s() = RealScalar(1) / tmp;
44  rot1.c() = u / tmp;
45  }
46  m.applyOnTheLeft(0,1,rot1);
47  j_right->makeJacobi(m,0,1);
48  *j_left = rot1 * j_right->transpose();
49 }
50 
51 } // end namespace internal
52 
53 } // end namespace Eigen
54 
55 #endif // EIGEN_REALSVD2X2_H
Eigen
Namespace containing all symbols from the Eigen library.
Definition: jet.h:637
d
static const double d[K][N]
Definition: igam.h:11
MatrixType
MatrixXf MatrixType
Definition: benchmark-blocking-sizes.cpp:52
real
float real
Definition: datatypes.h:10
Eigen::JacobiRotation
Rotation given by a cosine-sine pair.
Definition: ForwardDeclarations.h:283
Eigen::numext::q
EIGEN_DEVICE_FUNC const Scalar & q
Definition: SpecialFunctionsImpl.h:1984
Eigen::JacobiRotation::c
EIGEN_DEVICE_FUNC Scalar & c()
Definition: Jacobi.h:47
m
Matrix3f m
Definition: AngleAxis_mimic_euler.cpp:1
matrix
Map< Matrix< T, Dynamic, Dynamic, ColMajor >, 0, OuterStride<> > matrix(T *data, int rows, int cols, int stride)
Definition: gtsam/3rdparty/Eigen/blas/common.h:110
RealScalar
NumTraits< Scalar >::Real RealScalar
Definition: bench_gemm.cpp:47
Eigen::JacobiRotation::transpose
EIGEN_DEVICE_FUNC JacobiRotation transpose() const
Definition: Jacobi.h:63
Eigen::numext::abs2
EIGEN_DEVICE_FUNC bool abs2(bool x)
Definition: Eigen/src/Core/MathFunctions.h:1294
Eigen::JacobiRotation::makeJacobi
EIGEN_DEVICE_FUNC bool makeJacobi(const MatrixBase< Derived > &, Index p, Index q)
Definition: Jacobi.h:139
Eigen::internal::real_2x2_jacobi_svd
void real_2x2_jacobi_svd(const MatrixType &matrix, Index p, Index q, JacobiRotation< RealScalar > *j_left, JacobiRotation< RealScalar > *j_right)
Definition: RealSvd2x2.h:19
p
float * p
Definition: Tutorial_Map_using.cpp:9
min
#define min(a, b)
Definition: datatypes.h:19
Eigen::Matrix
The matrix class, also used for vectors and row-vectors.
Definition: 3rdparty/Eigen/Eigen/src/Core/Matrix.h:178
abs
#define abs(x)
Definition: datatypes.h:17
internal
Definition: BandTriangularSolver.h:13
Eigen::JacobiRotation::s
EIGEN_DEVICE_FUNC Scalar & s()
Definition: Jacobi.h:49
align_3::t
Point2 t(10, 10)
ceres::sqrt
Jet< T, N > sqrt(const Jet< T, N > &f)
Definition: jet.h:418
Eigen::Index
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:74


gtsam
Author(s):
autogenerated on Fri Nov 1 2024 03:34:53