QR.h
Go to the documentation of this file.
00001 // This file is part of Eigen, a lightweight C++ template library
00002 // for linear algebra.
00003 //
00004 // Copyright (C) 2008 Gael Guennebaud <g.gael@free.fr>
00005 // Copyright (C) 2011 Benoit Jacob <jacob.benoit.1@gmail.com>
00006 //
00007 // Eigen is free software; you can redistribute it and/or
00008 // modify it under the terms of the GNU Lesser General Public
00009 // License as published by the Free Software Foundation; either
00010 // version 3 of the License, or (at your option) any later version.
00011 //
00012 // Alternatively, you can redistribute it and/or
00013 // modify it under the terms of the GNU General Public License as
00014 // published by the Free Software Foundation; either version 2 of
00015 // the License, or (at your option) any later version.
00016 //
00017 // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
00018 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00019 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
00020 // GNU General Public License for more details.
00021 //
00022 // You should have received a copy of the GNU Lesser General Public
00023 // License and a copy of the GNU General Public License along with
00024 // Eigen. If not, see <http://www.gnu.org/licenses/>.
00025 
00026 #ifndef EIGEN2_QR_H
00027 #define EIGEN2_QR_H
00028 
00029 template<typename MatrixType>
00030 class QR : public HouseholderQR<MatrixType>
00031 {
00032   public:
00033 
00034     typedef HouseholderQR<MatrixType> Base;
00035     typedef Block<const MatrixType, MatrixType::ColsAtCompileTime, MatrixType::ColsAtCompileTime> MatrixRBlockType;
00036 
00037     QR() : Base() {}
00038 
00039     template<typename T>
00040     explicit QR(const T& t) : Base(t) {}
00041 
00042     template<typename OtherDerived, typename ResultType>
00043     bool solve(const MatrixBase<OtherDerived>& b, ResultType *result) const
00044     {
00045       *result = static_cast<const Base*>(this)->solve(b);
00046       return true;
00047     }
00048 
00049     MatrixType matrixQ(void) const {
00050       MatrixType ret = MatrixType::Identity(this->rows(), this->cols());
00051       ret = this->householderQ() * ret;
00052       return ret;
00053     }
00054 
00055     bool isFullRank() const {
00056       return true;
00057     }
00058     
00059     const TriangularView<MatrixRBlockType, UpperTriangular>
00060     matrixR(void) const
00061     {
00062       int cols = this->cols();
00063       return MatrixRBlockType(this->matrixQR(), 0, 0, cols, cols).template triangularView<UpperTriangular>();
00064     }
00065 };
00066 
00071 template<typename Derived>
00072 const QR<typename MatrixBase<Derived>::PlainObject>
00073 MatrixBase<Derived>::qr() const
00074 {
00075   return QR<PlainObject>(eval());
00076 }
00077 
00078 
00079 #endif // EIGEN2_QR_H


libicr
Author(s): Robert Krug
autogenerated on Mon Jan 6 2014 11:33:14