rwupdt.h
Go to the documentation of this file.
00001 namespace internal {
00002 
00003 template <typename Scalar>
00004 void rwupdt(
00005         Matrix< Scalar, Dynamic, Dynamic >  &r,
00006         const Matrix< Scalar, Dynamic, 1>  &w,
00007         Matrix< Scalar, Dynamic, 1>  &b,
00008         Scalar alpha)
00009 {
00010     typedef DenseIndex Index;
00011 
00012     const Index n = r.cols();
00013     assert(r.rows()>=n);
00014     std::vector<JacobiRotation<Scalar> > givens(n);
00015 
00016     /* Local variables */
00017     Scalar temp, rowj;
00018 
00019     /* Function Body */
00020     for (Index j = 0; j < n; ++j) {
00021         rowj = w[j];
00022 
00023         /* apply the previous transformations to */
00024         /* r(i,j), i=0,1,...,j-1, and to w(j). */
00025         for (Index i = 0; i < j; ++i) {
00026             temp = givens[i].c() * r(i,j) + givens[i].s() * rowj;
00027             rowj = -givens[i].s() * r(i,j) + givens[i].c() * rowj;
00028             r(i,j) = temp;
00029         }
00030 
00031         /* determine a givens rotation which eliminates w(j). */
00032         givens[j].makeGivens(-r(j,j), rowj);
00033 
00034         if (rowj == 0.)
00035             continue; // givens[j] is identity
00036 
00037         /* apply the current transformation to r(j,j), b(j), and alpha. */
00038         r(j,j) = givens[j].c() * r(j,j) + givens[j].s() * rowj;
00039         temp = givens[j].c() * b[j] + givens[j].s() * alpha;
00040         alpha = -givens[j].s() * b[j] + givens[j].c() * alpha;
00041         b[j] = temp;
00042     }
00043 }
00044 
00045 } // end namespace internal
00046 


re_vision
Author(s): Dorian Galvez-Lopez
autogenerated on Sun Jan 5 2014 11:32:23