Eigen-Contrib  5.0.1
 
Loading...
Searching...
No Matches
r1mpyq.h
1// IWYU pragma: private
2// SPDX-FileCopyrightText: The Eigen Authors
3// SPDX-License-Identifier: MPL-2.0
4
5#ifndef EIGEN_NONLINEAROPTIMIZATION_R1MPYQ_H
6#define EIGEN_NONLINEAROPTIMIZATION_R1MPYQ_H
7
8#include "./InternalHeaderCheck.h"
9
10namespace Eigen {
11
12namespace internal {
13
14// TODO : move this to GivensQR once there's such a thing in Eigen
15
16// Each rotation mixes a column of a with its last column, so a row vector is
17// passed as the transpose of the column vector holding it.
18template <typename Scalar, typename Derived>
19void r1mpyq(MatrixBase<Derived> &a_, const std::vector<JacobiRotation<Scalar> > &v_givens,
20 const std::vector<JacobiRotation<Scalar> > &w_givens) {
21 Derived &a = a_.derived();
22 const Index n = a.cols();
23
24 /* apply the first set of givens rotations to a. */
25 for (Index j = n - 2; j >= 0; --j) a.applyOnTheRight(j, n - 1, v_givens[j]);
26 /* apply the second set of givens rotations to a. */
27 for (Index j = 0; j < n - 1; ++j) a.applyOnTheRight(j, n - 1, w_givens[j].transpose());
28}
29
30} // end namespace internal
31
32} // end namespace Eigen
33
34#endif // EIGEN_NONLINEAROPTIMIZATION_R1MPYQ_H
Namespace containing all symbols from the Eigen library.