My Project  0.0.16
QUCS Mapping
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
eqnsys.h
Go to the documentation of this file.
1 /*
2  * eqnsys.h - equations system solver class definitions
3  *
4  * Copyright (C) 2004, 2005, 2006 Stefan Jahn <stefan@lkcc.org>
5  *
6  * This is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * This software is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this package; see the file COPYING. If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  *
21  * $Id: eqnsys.h 1825 2011-03-11 20:42:14Z ela $
22  *
23  */
24 
25 #ifndef __EQNSYS_H__
26 #define __EQNSYS_H__
27 
28 // Definition of equation system solving algorithms.
29 enum algo_type {
30  ALGO_INVERSE = 0x0001,
31  ALGO_GAUSS = 0x0002,
40  ALGO_JACOBI = 0x0080,
42  ALGO_SOR = 0x0200,
46  // testing
48 };
49 
50 // Definition of pivoting strategies.
51 enum pivot_type {
52  PIVOT_NONE = 0x01,
53  PIVOT_PARTIAL = 0x02,
54  PIVOT_FULL = 0x04
55 };
56 
57 #include "tvector.h"
58 #include "tmatrix.h"
59 
60 template <class nr_type_t>
61 class eqnsys
62 {
63  public:
64  eqnsys ();
65  eqnsys (eqnsys &);
66  ~eqnsys ();
67  void setAlgo (int a) { algo = a; }
68  int getAlgo (void) { return algo; }
71  void solve (void);
72 
73  private:
74  int update;
75  int algo;
76  int pivoting;
77  int * rMap;
78  int * cMap;
79  int N;
80  nr_double_t * nPvt;
81 
90 
91  void solve_inverse (void);
92  void solve_gauss (void);
93  void solve_gauss_jordan (void);
94  void solve_lu_crout (void);
95  void solve_lu_doolittle (void);
96  void factorize_lu_crout (void);
97  void factorize_lu_doolittle (void);
98  void substitute_lu_crout (void);
99  void substitute_lu_doolittle (void);
100  void solve_qr (void);
101  void solve_qr_ls (void);
102  void solve_qrh (void);
103  void factorize_qrh (void);
104  void substitute_qrh (void);
105  void factorize_qr_householder (void);
106  void substitute_qr_householder (void);
107  void substitute_qr_householder_ls (void);
108  nr_type_t householder_create_left (int);
109  void householder_apply_left (int, nr_type_t);
110  nr_type_t householder_left (int);
111  nr_type_t householder_create_right (int);
112  void householder_apply_right (int, nr_type_t);
113  void householder_apply_right_extern (int, nr_type_t);
114  nr_type_t householder_right (int);
115  nr_double_t euclidian_c (int, int r = 1);
116  nr_double_t euclidian_r (int, int c = 1);
117  void givens_apply_u (int, int, nr_double_t, nr_double_t);
118  void givens_apply_v (int, int, nr_double_t, nr_double_t);
119  void solve_svd (void);
120  void chop_svd (void);
121  void factorize_svd (void);
122  void substitute_svd (void);
123  void diagonalize_svd (void);
124  void solve_iterative (void);
125  void solve_sor (void);
126  nr_double_t convergence_criteria (void);
127  void ensure_diagonal (void);
128  void ensure_diagonal_MNA (void);
129  int countPairs (int, int&, int&);
130  void preconditioner (void);
131 };
132 
133 #include "eqnsys.cpp"
134 
135 #endif /* __EQNSYS_H__ */