Eigne Matrix Class Library

Dependents:   Eigen_test Odometry_test AttitudeEstimation_usingTicker MPU9250_Quaternion_Binary_Serial ... more

Embed: (wiki syntax)

« Back to documentation index

JacobiRotation< Scalar > Class Template Reference

JacobiRotation< Scalar > Class Template Reference
[Jacobi module]

More...

#include <Jacobi.h>

Public Member Functions

 JacobiRotation ()
 Default constructor without any initialization.
 JacobiRotation (const Scalar &c, const Scalar &s)
 Construct a planar rotation from a cosine-sine pair (c, s).
JacobiRotation operator* (const JacobiRotation &other)
 Concatenates two planar rotation.
JacobiRotation transpose () const
 Returns the transposed transformation.
JacobiRotation adjoint () const
 Returns the adjoint transformation.
template<typename Derived >
bool makeJacobi (const MatrixBase< Derived > &, typename Derived::Index p, typename Derived::Index q)
 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 $.
bool 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 $.
void makeGivens (const Scalar &p, const Scalar &q, Scalar *z=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 )$.

Detailed Description

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

Rotation given by a cosine-sine pair.

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()

Definition at line 34 of file src/Jacobi/Jacobi.h.


Constructor & Destructor Documentation

Default constructor without any initialization.

Definition at line 40 of file src/Jacobi/Jacobi.h.

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

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

Definition at line 43 of file src/Jacobi/Jacobi.h.


Member Function Documentation

JacobiRotation adjoint (  ) const

Returns the adjoint transformation.

Definition at line 62 of file src/Jacobi/Jacobi.h.

void makeGivens ( const Scalar &  p,
const Scalar &  q,
Scalar *  z = 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 z is returned if z is not null (the default is null). Also note that G is built such that the cosine is always real.

Example:

Output:

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.

See also:
MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight()

Definition at line 148 of file src/Jacobi/Jacobi.h.

bool 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()

Definition at line 83 of file src/Jacobi/Jacobi.h.

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

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:

Output:

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

Definition at line 126 of file src/Jacobi/Jacobi.h.

JacobiRotation operator* ( const JacobiRotation< Scalar > &  other )

Concatenates two planar rotation.

Definition at line 51 of file src/Jacobi/Jacobi.h.

JacobiRotation transpose (  ) const

Returns the transposed transformation.

Definition at line 59 of file src/Jacobi/Jacobi.h.