File indexing completed on 2025-01-18 09:57:06
0001 namespace Eigen {
0002
0003 namespace internal {
0004
0005 template <typename Scalar>
0006 void rwupdt(
0007 Matrix< Scalar, Dynamic, Dynamic > &r,
0008 const Matrix< Scalar, Dynamic, 1> &w,
0009 Matrix< Scalar, Dynamic, 1> &b,
0010 Scalar alpha)
0011 {
0012 typedef DenseIndex Index;
0013
0014 const Index n = r.cols();
0015 eigen_assert(r.rows()>=n);
0016 std::vector<JacobiRotation<Scalar> > givens(n);
0017
0018
0019 Scalar temp, rowj;
0020
0021
0022 for (Index j = 0; j < n; ++j) {
0023 rowj = w[j];
0024
0025
0026
0027 for (Index i = 0; i < j; ++i) {
0028 temp = givens[i].c() * r(i,j) + givens[i].s() * rowj;
0029 rowj = -givens[i].s() * r(i,j) + givens[i].c() * rowj;
0030 r(i,j) = temp;
0031 }
0032
0033
0034 givens[j].makeGivens(-r(j,j), rowj);
0035
0036 if (rowj == 0.)
0037 continue;
0038
0039
0040 r(j,j) = givens[j].c() * r(j,j) + givens[j].s() * rowj;
0041 temp = givens[j].c() * b[j] + givens[j].s() * alpha;
0042 alpha = -givens[j].s() * b[j] + givens[j].c() * alpha;
0043 b[j] = temp;
0044 }
0045 }
0046
0047 }
0048
0049 }