r1mpyq.h
Go to the documentation of this file.
00001 namespace internal {
00002 
00003 // TODO : move this to GivensQR once there's such a thing in Eigen
00004 
00005 template <typename Scalar>
00006 void r1mpyq(DenseIndex m, DenseIndex n, Scalar *a, const std::vector<JacobiRotation<Scalar> > &v_givens, const std::vector<JacobiRotation<Scalar> > &w_givens)
00007 {
00008     typedef DenseIndex Index;
00009 
00010     /*     apply the first set of givens rotations to a. */
00011     for (Index j = n-2; j>=0; --j)
00012         for (Index i = 0; i<m; ++i) {
00013             Scalar temp = v_givens[j].c() * a[i+m*j] - v_givens[j].s() * a[i+m*(n-1)];
00014             a[i+m*(n-1)] = v_givens[j].s() * a[i+m*j] + v_givens[j].c() * a[i+m*(n-1)];
00015             a[i+m*j] = temp;
00016         }
00017     /*     apply the second set of givens rotations to a. */
00018     for (Index j = 0; j<n-1; ++j)
00019         for (Index i = 0; i<m; ++i) {
00020             Scalar temp = w_givens[j].c() * a[i+m*j] + w_givens[j].s() * a[i+m*(n-1)];
00021             a[i+m*(n-1)] = -w_givens[j].s() * a[i+m*j] + w_givens[j].c() * a[i+m*(n-1)];
00022             a[i+m*j] = temp;
00023         }
00024 }
00025 
00026 } // end namespace internal


libicr
Author(s): Robert Krug
autogenerated on Mon Jan 6 2014 11:33:16