Eigen  3.3.7
Eigen::JacobiRotation Class Reference

Detailed Description

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:

v.applyOnTheLeft(J.adjoint());
See also
MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight()

Public Member Functions

JacobiRotation adjoint () const
 
 JacobiRotation ()
 
 JacobiRotation (const Scalar &c, const Scalar &s)
 
template<typename Derived >
bool makeJacobi (const MatrixBase< Derived > &, Index p, Index q)
 
template<typename Scalar >
bool makeJacobi (const RealScalar &x, const Scalar &y, const RealScalar &z)
 
JacobiRotation operator* (const JacobiRotation &other)
 
JacobiRotation transpose () const
 

Constructor & Destructor Documentation

◆ JacobiRotation() [1/2]

Eigen::JacobiRotation::JacobiRotation ( )
inline

Default constructor without any initialization.

◆ JacobiRotation() [2/2]

Eigen::JacobiRotation::JacobiRotation ( const Scalar &  c,
const Scalar &  s 
)
inline

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

Member Function Documentation

◆ adjoint()

JacobiRotation Eigen::JacobiRotation::adjoint ( ) const
inline

Returns the adjoint transformation

◆ makeJacobi() [1/2]

template<typename Derived >
bool Eigen::JacobiRotation::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:

Matrix2f m = Matrix2f::Random();
m = (m + m.adjoint()).eval();
JacobiRotation<float> J;
J.makeJacobi(m, 0, 1);
cout << "Here is the matrix m:" << endl << m << endl;
m.applyOnTheLeft(0, 1, J.adjoint());
m.applyOnTheRight(0, 1, J);
cout << "Here is the matrix J' * m * J:" << endl << m << endl;

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
See also
JacobiRotation::makeJacobi(RealScalar, Scalar, RealScalar), MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight()

◆ makeJacobi() [2/2]

template<typename Scalar >
bool Eigen::JacobiRotation::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 $

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

◆ operator*()

JacobiRotation Eigen::JacobiRotation::operator* ( const JacobiRotation other)
inline

Concatenates two planar rotation

◆ transpose()

JacobiRotation Eigen::JacobiRotation::transpose ( ) const
inline

Returns the transposed transformation


The documentation for this class was generated from the following files:
Eigen::DenseBase::Random
static const RandomReturnType Random()
Definition: Random.h:113