yat  0.14.5pre
SVD.h
1 #ifndef _theplu_yat_utility_svd_
2 #define _theplu_yat_utility_svd_
3 
4 // $Id: SVD.h 2119 2009-12-12 23:11:43Z peter $
5 
6 /*
7  Copyright (C) 2003 Daniel Dalevi, Jari Häkkinen
8  Copyright (C) 2004 Jari Häkkinen
9  Copyright (C) 2005 Jari Häkkinen, Peter Johansson
10  Copyright (C) 2006 Jari Häkkinen, Markus Ringnér
11  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
12 
13  This file is part of the yat library, http://dev.thep.lu.se/yat
14 
15  The yat library is free software; you can redistribute it and/or
16  modify it under the terms of the GNU General Public License as
17  published by the Free Software Foundation; either version 3 of the
18  License, or (at your option) any later version.
19 
20  The yat library is distributed in the hope that it will be useful,
21  but WITHOUT ANY WARRANTY; without even the implied warranty of
22  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23  General Public License for more details.
24 
25  You should have received a copy of the GNU General Public License
26  along with yat. If not, see <http://www.gnu.org/licenses/>.
27 */
28 
29 #include "Matrix.h"
30 #include "Vector.h"
31 
32 #include <gsl/gsl_linalg.h>
33 
34 namespace theplu {
35 namespace yat {
36 namespace utility {
37 
38  class VectorBase;
39 
53  class SVD
54  {
55  public:
56 
63  enum SVDalgorithm {
64  GolubReinsch,
65  ModifiedGolubReinsch,
66  Jacobi
67  };
68 
76  SVD(const utility::Matrix& Ain);
77 
81  ~SVD(void);
82 
89  void decompose(SVDalgorithm algo=GolubReinsch);
90 
99  const utility::Vector& s(void) const;
100 
110  void solve(const utility::VectorBase& b, utility::Vector& x);
111 
120  const utility::Matrix& U(void) const;
121 
130  const utility::Matrix& V(void) const;
131 
132  private:
138  int jacobi(void);
139 
145  int golub_reinsch(void);
146 
152  int modified_golub_reinsch(void);
153 
154  utility::Matrix U_, V_;
155  utility::Vector s_;
156  };
157 
158 }}} // of namespace utility, yat, and theplu
159 
160 #endif
const utility::Vector & s(void) const
Access to the s vector.
const utility::Matrix & V(void) const
Access to the V matrix.
This is the yat interface to GSL vector.
Definition: Vector.h:57
Singular Value Decomposition.
Definition: SVD.h:53
This is the yat interface to GSL vector.
Definition: VectorBase.h:52
void solve(const utility::VectorBase &b, utility::Vector &x)
Solve the system using the decomposition of A.
~SVD(void)
The destructor.
void decompose(SVDalgorithm algo=GolubReinsch)
This function will perform SVD with the method specified by algo.
const utility::Matrix & U(void) const
Access to the U matrix.
Interface to GSL matrix.
Definition: Matrix.h:63
SVDalgorithm
Definition: SVD.h:63
SVD(const utility::Matrix &Ain)
Constructs an SVD object using the matrix Ain as only input. The input matrix is copied for further u...

Generated on Tue Sep 26 2017 02:33:29 for yat by  doxygen 1.8.5