Class xlifepp::JacobiRotation#

template<typename Scalar>
class JacobiRotation#

Collaboration diagram for xlifepp::JacobiRotation:

digraph { graph [bgcolor="#00000000"] node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2] edge [color="#1414CE"] "1" [label="xlifepp::JacobiRotation< Scalar >" tooltip="xlifepp::JacobiRotation< Scalar >" fillcolor="#BFBFBF"] }

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 code:

v.applyOnTheLeft(J.adjoint());

Public Functions

inline JacobiRotation()#

Default constructor without any initialization.

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

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

inline JacobiRotation adjoint() const#

Returns the adjoint transformation.

inline Scalar &c()#

returns cosine (non const)

inline Scalar c() const#

returns cosine (const)

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

computes Givens rotation

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.

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.

bool makeJacobi(RealScalar x, Scalar y, RealScalar z)#

computes Jacobi rotation

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 \).

inline JacobiRotation operator*(const JacobiRotation &other)#

Concatenates two planar rotation.

inline Scalar &s()#

returns sine (non const)

inline Scalar s() const#

returns sine (const)

inline JacobiRotation transpose() const#

Returns the transposed transformation.