yat  0.16.4pre
SVD.h
1 #ifndef _theplu_yat_utility_svd_
2 #define _theplu_yat_utility_svd_
3 
4 // $Id: SVD.h 3792 2019-04-12 07:15:09Z 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  Copyright (C) 2018 Peter Johansson
13 
14  This file is part of the yat library, http://dev.thep.lu.se/yat
15 
16  The yat library is free software; you can redistribute it and/or
17  modify it under the terms of the GNU General Public License as
18  published by the Free Software Foundation; either version 3 of the
19  License, or (at your option) any later version.
20 
21  The yat library is distributed in the hope that it will be useful,
22  but WITHOUT ANY WARRANTY; without even the implied warranty of
23  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24  General Public License for more details.
25 
26  You should have received a copy of the GNU General Public License
27  along with yat. If not, see <http://www.gnu.org/licenses/>.
28 */
29 
30 #include "config_public.h"
31 
32 #include "Matrix.h"
33 #include "Vector.h"
34 
35 #include <gsl/gsl_linalg.h>
36 
37 namespace theplu {
38 namespace yat {
39 namespace utility {
40 
41  class VectorBase;
42 
56  class SVD
57  {
58  public:
59 
66  enum SVDalgorithm {
67  GolubReinsch,
68  ModifiedGolubReinsch,
69  Jacobi
70  };
71 
79  explicit SVD(const Matrix& Ain);
80 
81 #ifdef YAT_HAVE_RVALE
82 
88  explicit SVD(Matrix&& Ain);
89 #endif
90 
94  ~SVD(void);
95 
102  void decompose(SVDalgorithm algo=GolubReinsch);
103 
112  const Vector& s(void) const;
113 
123  void solve(const VectorBase& b, Vector& x);
124 
133  const Matrix& U(void) const;
134 
143  const Matrix& V(void) const;
144 
145  private:
151  int jacobi(void);
152 
158  int golub_reinsch(void);
159 
165  int modified_golub_reinsch(void);
166 
167  Matrix U_, V_;
168  Vector s_;
169  };
170 
171 }}} // of namespace utility, yat, and theplu
172 
173 #endif
SVD(const Matrix &Ain)
Constructs an SVD object using the matrix Ain as only input. The input matrix is copied for further u...
The Department of Theoretical Physics namespace as we define it.
This is the yat interface to GSL vector.
Definition: Vector.h:59
Singular Value Decomposition.
Definition: SVD.h:56
This is the yat interface to GSL vector.
Definition: VectorBase.h:55
~SVD(void)
The destructor.
void decompose(SVDalgorithm algo=GolubReinsch)
This function will perform SVD with the method specified by algo.
Interface to GSL matrix.
Definition: Matrix.h:74
const Vector & s(void) const
Access to the s vector.
SVDalgorithm
Definition: SVD.h:66
void solve(const VectorBase &b, Vector &x)
Solve the system using the decomposition of A.
const Matrix & U(void) const
Access to the U matrix.
const Matrix & V(void) const
Access to the V matrix.

Generated on Thu Dec 12 2019 03:12:08 for yat by  doxygen 1.8.11