Rotation given by a cosine-sine pair. More...
#include <Jacobi.h>
Public Types | |
typedef NumTraits< Scalar >::Real | RealScalar |
Public Member Functions | |
JacobiRotation | adjoint () const |
Scalar & | c () |
Scalar | c () const |
JacobiRotation () | |
JacobiRotation (const Scalar &c, const Scalar &s) | |
void | makeGivens (const Scalar &p, const Scalar &q, Scalar *z=0) |
template<typename Derived > | |
bool | makeJacobi (const MatrixBase< Derived > &, typename Derived::Index p, typename Derived::Index q) |
bool | makeJacobi (RealScalar x, Scalar y, RealScalar z) |
JacobiRotation | operator* (const JacobiRotation &other) |
Scalar & | s () |
Scalar | s () const |
JacobiRotation | transpose () const |
Protected Member Functions | |
void | makeGivens (const Scalar &p, const Scalar &q, Scalar *z, internal::true_type) |
void | makeGivens (const Scalar &p, const Scalar &q, Scalar *z, internal::false_type) |
Protected Attributes | |
Scalar | m_c |
Scalar | m_s |
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 defined by its cosine c
and sine s
as follow:
You can apply the respective counter-clockwise rotation to a column vector v
by applying its adjoint on the left: that translates to the following Eigen code:
v.applyOnTheLeft(J.adjoint());
typedef NumTraits<Scalar>::Real JacobiRotation< Scalar >::RealScalar |
JacobiRotation< Scalar >::JacobiRotation | ( | ) | [inline] |
JacobiRotation< Scalar >::JacobiRotation | ( | const Scalar & | c, |
const Scalar & | s | ||
) | [inline] |
JacobiRotation JacobiRotation< Scalar >::adjoint | ( | ) | const [inline] |
Scalar& JacobiRotation< Scalar >::c | ( | ) | [inline] |
Scalar JacobiRotation< Scalar >::c | ( | ) | const [inline] |
void JacobiRotation< Scalar >::makeGivens | ( | const Scalar & | p, |
const Scalar & | q, | ||
Scalar * | z = 0 |
||
) |
Makes *this
as a Givens rotation G
such that applying to the left of the vector yields: .
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:
Vector2f v = Vector2f::Random(); JacobiRotation<float> G; G.makeGivens(v.x(), v.y()); cout << "Here is the vector v:" << endl << v << endl; v.applyOnTheLeft(0, 1, G.adjoint()); cout << "Here is the vector J' * v:" << endl << v << endl;
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.
void JacobiRotation< Scalar >::makeGivens | ( | const Scalar & | p, |
const Scalar & | q, | ||
Scalar * | z, | ||
internal::true_type | |||
) | [protected] |
void JacobiRotation< Scalar >::makeGivens | ( | const Scalar & | p, |
const Scalar & | q, | ||
Scalar * | z, | ||
internal::false_type | |||
) | [protected] |
bool JacobiRotation< Scalar >::makeJacobi | ( | const MatrixBase< Derived > & | m, |
typename Derived::Index | p, | ||
typename Derived::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 yields a diagonal matrix
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:
bool JacobiRotation< Scalar >::makeJacobi | ( | RealScalar | x, |
Scalar | y, | ||
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 yields a diagonal matrix
JacobiRotation JacobiRotation< Scalar >::operator* | ( | const JacobiRotation< Scalar > & | other | ) | [inline] |
Scalar& JacobiRotation< Scalar >::s | ( | ) | [inline] |
Scalar JacobiRotation< Scalar >::s | ( | ) | const [inline] |
JacobiRotation JacobiRotation< Scalar >::transpose | ( | ) | const [inline] |
Scalar JacobiRotation< Scalar >::m_c [protected] |
Scalar JacobiRotation< Scalar >::m_s [protected] |