givens_rotation<T> [MTL Home] Programmers Guide
  Contents | Index |  Search 


Category:functors Component type:type
Description
Input a and b to the constructor to create a givens plane rotation object. Then apply the rotation to two vectors. There is a specialization of the givens rotation for complex numbers.
 [  c  s ] [ a ] = [ r ]
 [ -s  c ] [ b ]   [ 0 ]
 
Example
In apply_givens.cc:
  const int N = 5;
  double dx[] = { 1, 2, 3, 4, 5 };
  double dy[] = { 2, 4, 8, 16, 32};

  Vec x(dx, N), y(dy, N);
  double a = x[N-1];
  double b = y[N-1];

  givens_rotation<double> rot(a, b);

  rot.apply(x, y);

Definition
mtl.h
Template Parameters
Model of
Type requirements
  • the addition operator must be defined for T
  • the multiplication operator must be defined for T
  • the division operator must be defined for T
  • the abs() function must be defined for T
Members
Member Where defined Description
givens_rotation ()   Default constructor
givens_rotation (T a_in, T b_in)   Givens Plane Rotation Constructor
void set_cs (T cin, T sin)    
void scalar_apply (T& x, T& y)   Apply plane rotation to two real scalars. (name change a VC workaround)
template <class VecX, class VecY>
void apply (VecX& x, VecY& y)
  Apply plane rotation to two vectors.
T b ()    
T s ()    
New members
Notes
See also

[MTL Home] Copyright © 1998,1999 University of Notre Dame. All Rights Reserved.