Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GaussianProcessTuning/HeuristicLab.Eigen/Eigen/src/Eigen2Support/QR.h @ 9562

Last change on this file since 9562 was 9562, checked in by gkronber, 11 years ago

#1967 worked on Gaussian process evolution.

File size: 1.7 KB
Line 
1// This file is part of Eigen, a lightweight C++ template library
2// for linear algebra.
3//
4// Copyright (C) 2008 Gael Guennebaud <g.gael@free.fr>
5// Copyright (C) 2011 Benoit Jacob <jacob.benoit.1@gmail.com>
6//
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/.
10
11#ifndef EIGEN2_QR_H
12#define EIGEN2_QR_H
13
14namespace Eigen {
15
16template<typename MatrixType>
17class QR : public HouseholderQR<MatrixType>
18{
19  public:
20
21    typedef HouseholderQR<MatrixType> Base;
22    typedef Block<const MatrixType, MatrixType::ColsAtCompileTime, MatrixType::ColsAtCompileTime> MatrixRBlockType;
23
24    QR() : Base() {}
25
26    template<typename T>
27    explicit QR(const T& t) : Base(t) {}
28
29    template<typename OtherDerived, typename ResultType>
30    bool solve(const MatrixBase<OtherDerived>& b, ResultType *result) const
31    {
32      *result = static_cast<const Base*>(this)->solve(b);
33      return true;
34    }
35
36    MatrixType matrixQ(void) const {
37      MatrixType ret = MatrixType::Identity(this->rows(), this->cols());
38      ret = this->householderQ() * ret;
39      return ret;
40    }
41
42    bool isFullRank() const {
43      return true;
44    }
45   
46    const TriangularView<MatrixRBlockType, UpperTriangular>
47    matrixR(void) const
48    {
49      int cols = this->cols();
50      return MatrixRBlockType(this->matrixQR(), 0, 0, cols, cols).template triangularView<UpperTriangular>();
51    }
52};
53
54/** \return the QR decomposition of \c *this.
55  *
56  * \sa class QR
57  */
58template<typename Derived>
59const QR<typename MatrixBase<Derived>::PlainObject>
60MatrixBase<Derived>::qr() const
61{
62  return QR<PlainObject>(eval());
63}
64
65} // end namespace Eigen
66
67#endif // EIGEN2_QR_H
Note: See TracBrowser for help on using the repository browser.