template<typename Scalar>
class Eigen::JacobiRotation< Scalar >
Rotation given by a cosine-sine pair.
This is defined in the Jacobi module.
Code
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());
Array< int, Dynamic, 1 > v
JacobiRotation< float > J
Code
- See also
- MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight()
Definition at line 36 of file Jacobi.h.
template<typename Scalar >
Makes *this
as a Givens rotation G
such that applying to the left of the vector yields: .
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:
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;
JacobiRotation< float > G
static const RandomReturnType Random()
Matrix< float, 2, 1 > Vector2f
2×1 vector of type float.
Code
Output:
Here is the vector v:
0.68
-0.211
Here is the vector J' * v:
0.712
0
Code
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 164 of file Jacobi.h.
void makeGivens(const Scalar &p, const Scalar &q, Scalar *r=0)
Code