Qucs-core  0.0.18
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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$
22  *
23  */
24 
25 #ifndef __EQNSYS_H__
26 #define __EQNSYS_H__
27 
29 enum algo_type {
30  ALGO_INVERSE = 0x0001,
31  ALGO_GAUSS = 0x0002,
40  ALGO_JACOBI = 0x0080,
42  ALGO_SOR = 0x0200,
46  // testing
48 };
49 
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 namespace qucs {
61 
62 template <class nr_type_t>
63 class eqnsys
64 {
65  public:
66  eqnsys ();
67  eqnsys (eqnsys &);
68  ~eqnsys ();
69  void setAlgo (int a) { algo = a; }
70  int getAlgo (void) { return algo; }
71  void passEquationSys (tmatrix<nr_type_t> *, tvector<nr_type_t> *,
72  tvector<nr_type_t> *);
73  void solve (void);
74 
75  private:
76  int update;
77  int algo;
78  int pivoting;
79  int * rMap;
80  int * cMap;
81  int N;
82  nr_double_t * nPvt;
83 
92 
93  void solve_inverse (void);
94  void solve_gauss (void);
95  void solve_gauss_jordan (void);
96  void solve_lu_crout (void);
97  void solve_lu_doolittle (void);
98  void factorize_lu_crout (void);
99  void factorize_lu_doolittle (void);
100  void substitute_lu_crout (void);
101  void substitute_lu_doolittle (void);
102  void solve_qr (void);
103  void solve_qr_ls (void);
104  void solve_qrh (void);
105  void factorize_qrh (void);
106  void substitute_qrh (void);
107  void factorize_qr_householder (void);
108  void substitute_qr_householder (void);
109  void substitute_qr_householder_ls (void);
110  nr_type_t householder_create_left (int);
111  void householder_apply_left (int, nr_type_t);
112  nr_type_t householder_left (int);
113  nr_type_t householder_create_right (int);
114  void householder_apply_right (int, nr_type_t);
115  void householder_apply_right_extern (int, nr_type_t);
116  nr_type_t householder_right (int);
117  nr_double_t euclidian_c (int, int r = 1);
118  nr_double_t euclidian_r (int, int c = 1);
119  void givens_apply_u (int, int, nr_double_t, nr_double_t);
120  void givens_apply_v (int, int, nr_double_t, nr_double_t);
121  void solve_svd (void);
122  void chop_svd (void);
123  void factorize_svd (void);
124  void substitute_svd (void);
125  void diagonalize_svd (void);
126  void solve_iterative (void);
127  void solve_sor (void);
128  nr_double_t convergence_criteria (void);
129  void ensure_diagonal (void);
130  void ensure_diagonal_MNA (void);
131  int countPairs (int, int&, int&);
132  void preconditioner (void);
133 };
134 
135 } // namespace qucs
136 
137 #include "eqnsys.cpp"
138 
139 #endif /* __EQNSYS_H__ */
tmatrix< nr_type_t > * V
Definition: eqnsys.h:85
void ensure_diagonal_MNA(void)
Definition: eqnsys.cpp:717
void solve_inverse(void)
Definition: eqnsys.cpp:183
int update
Definition: eqnsys.h:76
tvector< nr_type_t > * X
Definition: eqnsys.h:87
void householder_apply_left(int, nr_type_t)
Definition: eqnsys.cpp:1173
void solve_gauss_jordan(void)
Definition: eqnsys.cpp:234
void ensure_diagonal(void)
Definition: eqnsys.cpp:706
void solve_lu_crout(void)
Definition: eqnsys.cpp:288
eqnsys()
Constructor creates an unnamed instance of the eqnsys class.
Definition: eqnsys.cpp:51
nr_double_t convergence_criteria(void)
Definition: eqnsys.cpp:692
int getAlgo(void)
Definition: eqnsys.h:70
nr_type_t householder_left(int)
Definition: eqnsys.cpp:1117
void factorize_lu_crout(void)
Definition: eqnsys.cpp:319
pivot_type
Definition of pivoting strategies.
Definition: eqnsys.h:51
void factorize_qrh(void)
Definition: eqnsys.cpp:884
nr_type_t householder_create_left(int)
Definition: eqnsys.cpp:1091
int pivoting
Definition: eqnsys.h:78
void substitute_lu_doolittle(void)
Definition: eqnsys.cpp:481
void substitute_qr_householder_ls(void)
Definition: eqnsys.cpp:1054
void passEquationSys(tmatrix< nr_type_t > *, tvector< nr_type_t > *, tvector< nr_type_t > *)
Definition: eqnsys.cpp:99
void householder_apply_right(int, nr_type_t)
Definition: eqnsys.cpp:1190
void factorize_qr_householder(void)
Definition: eqnsys.cpp:949
void factorize_lu_doolittle(void)
Definition: eqnsys.cpp:385
r
Definition: parse_mdl.y:515
int algo
Definition: eqnsys.h:77
tvector< nr_type_t > * R
Definition: eqnsys.h:88
void substitute_qrh(void)
Definition: eqnsys.cpp:998
void solve_svd(void)
Definition: eqnsys.cpp:1231
void givens_apply_v(int, int, nr_double_t, nr_double_t)
Definition: eqnsys.cpp:1356
int * cMap
Definition: eqnsys.h:80
algo_type
Definition of equation system solving algorithms.
Definition: eqnsys.h:29
void substitute_svd(void)
Definition: eqnsys.cpp:1252
void solve_lu_doolittle(void)
Definition: eqnsys.cpp:302
void factorize_svd(void)
Definition: eqnsys.cpp:1278
~eqnsys()
Destructor deletes the eqnsys class object.
Definition: eqnsys.cpp:65
nr_double_t * nPvt
Definition: eqnsys.h:82
void preconditioner(void)
Definition: eqnsys.cpp:777
tvector< nr_double_t > * S
Definition: eqnsys.h:90
tvector< nr_type_t > * B
Definition: eqnsys.h:86
void solve_qr_ls(void)
Definition: eqnsys.cpp:820
void solve(void)
Definition: eqnsys.cpp:124
void setAlgo(int a)
Definition: eqnsys.h:69
nr_double_t euclidian_r(int, int c=1)
Definition: eqnsys.cpp:859
void chop_svd(void)
Annihilates near-zero singular values.
Definition: eqnsys.cpp:1239
void solve_gauss(void)
Definition: eqnsys.cpp:194
void householder_apply_right_extern(int, nr_type_t)
Definition: eqnsys.cpp:1214
tvector< nr_double_t > * E
Definition: eqnsys.h:91
void substitute_qr_householder(void)
Definition: eqnsys.cpp:1024
void solve_qr(void)
Definition: eqnsys.cpp:811
nr_double_t euclidian_c(int, int r=1)
Definition: eqnsys.cpp:847
void solve_sor(void)
Definition: eqnsys.cpp:598
tmatrix< nr_type_t > * A
Definition: eqnsys.h:84
void diagonalize_svd(void)
Definition: eqnsys.cpp:1372
int countPairs(int, int &, int &)
Definition: eqnsys.cpp:756
void substitute_lu_crout(void)
Definition: eqnsys.cpp:456
nr_type_t householder_create_right(int)
Definition: eqnsys.cpp:1149
int * rMap
Definition: eqnsys.h:79
void solve_qrh(void)
Definition: eqnsys.cpp:803
void givens_apply_u(int, int, nr_double_t, nr_double_t)
Definition: eqnsys.cpp:1345
nr_type_t householder_right(int)
Definition: eqnsys.cpp:1132
void solve_iterative(void)
Definition: eqnsys.cpp:509
tvector< nr_type_t > * T
Definition: eqnsys.h:89