yat  0.8.3pre
SVD.h
00001 #ifndef _theplu_yat_utility_svd_
00002 #define _theplu_yat_utility_svd_
00003 
00004 // $Id: SVD.h 2119 2009-12-12 23:11:43Z peter $
00005 
00006 /*
00007   Copyright (C) 2003 Daniel Dalevi, Jari Häkkinen
00008   Copyright (C) 2004 Jari Häkkinen
00009   Copyright (C) 2005 Jari Häkkinen, Peter Johansson
00010   Copyright (C) 2006 Jari Häkkinen, Markus Ringnér
00011   Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
00012 
00013   This file is part of the yat library, http://dev.thep.lu.se/yat
00014 
00015   The yat library is free software; you can redistribute it and/or
00016   modify it under the terms of the GNU General Public License as
00017   published by the Free Software Foundation; either version 3 of the
00018   License, or (at your option) any later version.
00019 
00020   The yat library is distributed in the hope that it will be useful,
00021   but WITHOUT ANY WARRANTY; without even the implied warranty of
00022   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00023   General Public License for more details.
00024 
00025   You should have received a copy of the GNU General Public License
00026   along with yat. If not, see <http://www.gnu.org/licenses/>.
00027 */
00028 
00029 #include "Matrix.h"
00030 #include "Vector.h"
00031 
00032 #include <gsl/gsl_linalg.h>
00033 
00034 namespace theplu {
00035 namespace yat {
00036 namespace utility {
00037 
00038   class VectorBase;
00039 
00053   class SVD
00054   {
00055   public:
00056 
00063     enum SVDalgorithm {
00064       GolubReinsch,
00065       ModifiedGolubReinsch,
00066       Jacobi
00067     };
00068 
00076     SVD(const utility::Matrix& Ain);
00077 
00081     ~SVD(void);
00082 
00089     void decompose(SVDalgorithm algo=GolubReinsch);
00090 
00099     const utility::Vector& s(void) const;
00100 
00110     void solve(const utility::VectorBase& b, utility::Vector& x);
00111 
00120     const utility::Matrix& U(void) const;
00121 
00130     const utility::Matrix& V(void) const;
00131 
00132   private:
00138     int jacobi(void);
00139 
00145     int golub_reinsch(void);
00146 
00152     int modified_golub_reinsch(void);
00153 
00154     utility::Matrix U_, V_;
00155     utility::Vector s_;
00156   };  
00157 
00158 }}} // of namespace utility, yat, and theplu
00159 
00160 #endif

Generated on Thu Dec 20 2012 03:12:58 for yat by  doxygen 1.8.0-20120409