Eigen  3.4.90 (git rev 67eeba6e720c5745abc77ae6c92ce0a44aa7b7ae)
Eigen::JacobiRotation< Scalar > Class Template Reference

## Detailed Description

### template<typename Scalar> class Eigen::JacobiRotation< Scalar >

Rotation given by a cosine-sine pair.

This is defined in the Jacobi module.

#include <Eigen/Jacobi>

This class represents a Jacobi or Givens rotation. This is a 2D rotation in the plane J of angle $$\theta$$ defined by its cosine c and sine s as follow: $$J = \left ( \begin{array}{cc} c & \overline s \\ -s & \overline c \end{array} \right )$$

You can apply the respective counter-clockwise rotation to a column vector v by applying its adjoint on the left: $$v = J^* v$$ that translates to the following Eigen code:

MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight()

## Public Member Functions

JacobiRotation ()

JacobiRotation (const Scalar &c, const Scalar &s)

void makeGivens (const Scalar &p, const Scalar &q, Scalar *r=0)

template<typename Derived >
bool makeJacobi (const MatrixBase< Derived > &, Index p, Index q)

bool makeJacobi (const RealScalar &x, const Scalar &y, const RealScalar &z)

JacobiRotation operator* (const JacobiRotation &other)

JacobiRotation transpose () const

## ◆ JacobiRotation() [1/2]

template<typename Scalar >
 Eigen::JacobiRotation< Scalar >::JacobiRotation ( )
inline

Default constructor without any initialization.

## ◆ JacobiRotation() [2/2]

template<typename Scalar >
 Eigen::JacobiRotation< Scalar >::JacobiRotation ( const Scalar & c, const Scalar & s )
inline

Construct a planar rotation from a cosine-sine pair (c, s).

## Member Function Documentation

template<typename Scalar >
 JacobiRotation Eigen::JacobiRotation< Scalar >::adjoint ( ) const
inline

## ◆ makeGivens()

template<typename Scalar >
 void Eigen::JacobiRotation< Scalar >::makeGivens ( const Scalar & p, const Scalar & q, Scalar * r = 0 )

Makes *this as a Givens rotation G such that applying $$G^*$$ to the left of the vector $$V = \left ( \begin{array}{c} p \\ q \end{array} \right )$$ yields: $$G^* V = \left ( \begin{array}{c} r \\ 0 \end{array} \right )$$.

The value of r is returned if r is not null (the default is null). Also note that G is built such that the cosine is always real.

Example:

JacobiRotation<float> G;
G.makeGivens(v.x(), v.y());
cout << "Here is the vector v:" << endl << v << endl;
cout << "Here is the vector J' * v:" << endl << v << endl;
static const RandomReturnType Random()
Definition: Random.h:114
Matrix< float, 2, 1 > Vector2f
2×1 vector of type float.
Definition: Matrix.h:500

Output:

Here is the vector v:
0.68
-0.211
Here is the vector J' * v:
0.712
0


This function implements the continuous Givens rotation generation algorithm found in Anderson (2000), Discontinuous Plane Rotations and the Symmetric Eigenvalue Problem. LAPACK Working Note 150, University of Tennessee, UT-CS-00-454, December 4, 2000.

MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight()

## ◆ makeJacobi() [1/2]

template<typename Scalar >
template<typename Derived >
 bool Eigen::JacobiRotation< Scalar >::makeJacobi ( const MatrixBase< Derived > & m, Index p, Index q )
inline

Makes *this as a Jacobi rotation J such that applying J on both the right and left sides of the 2x2 selfadjoint matrix $$B = \left ( \begin{array}{cc} \text{this}_{pp} & \text{this}_{pq} \\ (\text{this}_{pq})^* & \text{this}_{qq} \end{array} \right )$$ yields a diagonal matrix $$A = J^* B J$$

Example:

JacobiRotation<float> J;
J.makeJacobi(m, 0, 1);
cout << "Here is the matrix m:" << endl << m << endl;
m.applyOnTheRight(0, 1, J);
cout << "Here is the matrix J' * m * J:" << endl << m << endl;
Matrix< float, 2, 2 > Matrix2f
2×2 matrix of type float.
Definition: Matrix.h:500

Output:

Here is the matrix m:
1.36 0.355
0.355  1.19
Here is the matrix J' * m * J:
1.64     0
0 0.913

JacobiRotation::makeJacobi(RealScalar, Scalar, RealScalar), MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight()

## ◆ makeJacobi() [2/2]

template<typename Scalar >
 bool Eigen::JacobiRotation< Scalar >::makeJacobi ( const RealScalar & x, const Scalar & y, const RealScalar & z )

Makes *this as a Jacobi rotation J such that applying J on both the right and left sides of the selfadjoint 2x2 matrix $$B = \left ( \begin{array}{cc} x & y \\ \overline y & z \end{array} \right )$$ yields a diagonal matrix $$A = J^* B J$$

MatrixBase::makeJacobi(const MatrixBase<Derived>&, Index, Index), MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight()

## ◆ operator*()

template<typename Scalar >
 JacobiRotation Eigen::JacobiRotation< Scalar >::operator* ( const JacobiRotation< Scalar > & other )
inline

Concatenates two planar rotation

## ◆ transpose()

template<typename Scalar >
 JacobiRotation Eigen::JacobiRotation< Scalar >::transpose ( ) const
inline

Returns the transposed transformation

The documentation for this class was generated from the following file: