rwupdt.h
Go to the documentation of this file.
1 // IWYU pragma: private
3 
4 namespace Eigen {
5 
6 namespace internal {
7 
8 template <typename Scalar>
10  Scalar alpha) {
11  typedef DenseIndex Index;
12 
13  const Index n = r.cols();
14  eigen_assert(r.rows() >= n);
15  std::vector<JacobiRotation<Scalar> > givens(n);
16 
17  /* Local variables */
18  Scalar temp, rowj;
19 
20  /* Function Body */
21  for (Index j = 0; j < n; ++j) {
22  rowj = w[j];
23 
24  /* apply the previous transformations to */
25  /* r(i,j), i=0,1,...,j-1, and to w(j). */
26  for (Index i = 0; i < j; ++i) {
27  temp = givens[i].c() * r(i, j) + givens[i].s() * rowj;
28  rowj = -givens[i].s() * r(i, j) + givens[i].c() * rowj;
29  r(i, j) = temp;
30  }
31 
32  /* determine a givens rotation which eliminates w(j). */
33  givens[j].makeGivens(-r(j, j), rowj);
34 
35  if (rowj == 0.) continue; // givens[j] is identity
36 
37  /* apply the current transformation to r(j,j), b(j), and alpha. */
38  r(j, j) = givens[j].c() * r(j, j) + givens[j].s() * rowj;
39  temp = givens[j].c() * b[j] + givens[j].s() * alpha;
40  alpha = -givens[j].s() * b[j] + givens[j].c() * alpha;
41  b[j] = temp;
42  }
43 }
44 
45 } // end namespace internal
46 
47 } // end namespace Eigen
int i
Definition: BiCGSTAB_step_by_step.cpp:9
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
#define eigen_assert(x)
Definition: Macros.h:910
RowVector3d w
Definition: Matrix_resize_int.cpp:3
Scalar * b
Definition: benchVecAdd.cpp:17
SCALAR Scalar
Definition: bench_gemm.cpp:45
RealScalar alpha
Definition: level1_cplx_impl.h:151
void rwupdt(Matrix< Scalar, Dynamic, Dynamic > &r, const Matrix< Scalar, Dynamic, 1 > &w, Matrix< Scalar, Dynamic, 1 > &b, Scalar alpha)
Definition: rwupdt.h:9
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:70
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:83
EIGEN_DEFAULT_DENSE_INDEX_TYPE DenseIndex
Definition: Meta.h:75
r
Definition: UniformPSDSelfTest.py:20
Definition: Eigen_Colamd.h:49
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2