4
4
// Copyright (C) 2010 Benoit Jacob <jacob.benoit.1@gmail.com>
5
5
// Copyright (C) 2009 Gael Guennebaud <gael.guennebaud@inria.fr>
7
// Eigen is free software; you can redistribute it and/or
8
// modify it under the terms of the GNU Lesser General Public
9
// License as published by the Free Software Foundation; either
10
// version 3 of the License, or (at your option) any later version.
12
// Alternatively, you can redistribute it and/or
13
// modify it under the terms of the GNU General Public License as
14
// published by the Free Software Foundation; either version 2 of
15
// the License, or (at your option) any later version.
17
// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
18
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19
// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
20
// GNU General Public License for more details.
22
// You should have received a copy of the GNU Lesser General Public
23
// License and a copy of the GNU General Public License along with
24
// Eigen. If not, see <http://www.gnu.org/licenses/>.
7
// This Source Code Form is subject to the terms of the Mozilla
8
// Public License v. 2.0. If a copy of the MPL was not distributed
9
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
26
11
#ifndef EIGEN_HOUSEHOLDER_H
27
12
#define EIGEN_HOUSEHOLDER_H
29
16
namespace internal {
30
17
template<int n> struct decrement_size
25
/** Computes the elementary reflector H such that:
26
* \f$ H *this = [ beta 0 ... 0]^T \f$
27
* where the transformation H is:
28
* \f$ H = I - tau v v^*\f$
29
* and the vector v is:
30
* \f$ v^T = [1 essential^T] \f$
32
* The essential part of the vector \c v is stored in *this.
35
* \param tau the scaling factor of the Householder transformation
36
* \param beta the result of H * \c *this
38
* \sa MatrixBase::makeHouseholder(), MatrixBase::applyHouseholderOnTheLeft(),
39
* MatrixBase::applyHouseholderOnTheRight()
38
41
template<typename Derived>
39
42
void MatrixBase<Derived>::makeHouseholderInPlace(Scalar& tau, RealScalar& beta)
53
56
* \param essential the essential part of the vector \c v
54
* \param tau the scaling factor of the householder transformation
57
* \param tau the scaling factor of the Householder transformation
55
58
* \param beta the result of H * \c *this
57
60
* \sa MatrixBase::makeHouseholderInPlace(), MatrixBase::applyHouseholderOnTheLeft(),
92
/** Apply the elementary reflector H given by
93
* \f$ H = I - tau v v^*\f$
95
* \f$ v^T = [1 essential^T] \f$
96
* from the left to a vector or matrix.
99
* \param essential the essential part of the vector \c v
100
* \param tau the scaling factor of the Householder transformation
101
* \param workspace a pointer to working space with at least
102
* this->cols() * essential.size() entries
104
* \sa MatrixBase::makeHouseholder(), MatrixBase::makeHouseholderInPlace(),
105
* MatrixBase::applyHouseholderOnTheRight()
89
107
template<typename Derived>
90
108
template<typename EssentialPart>
91
109
void MatrixBase<Derived>::applyHouseholderOnTheLeft(
129
/** Apply the elementary reflector H given by
130
* \f$ H = I - tau v v^*\f$
132
* \f$ v^T = [1 essential^T] \f$
133
* from the right to a vector or matrix.
136
* \param essential the essential part of the vector \c v
137
* \param tau the scaling factor of the Householder transformation
138
* \param workspace a pointer to working space with at least
139
* this->cols() * essential.size() entries
141
* \sa MatrixBase::makeHouseholder(), MatrixBase::makeHouseholderInPlace(),
142
* MatrixBase::applyHouseholderOnTheLeft()
111
144
template<typename Derived>
112
145
template<typename EssentialPart>
113
146
void MatrixBase<Derived>::applyHouseholderOnTheRight(