My Project  0.0.16
QUCS Mapping
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
tridiag.h
Go to the documentation of this file.
1 /*
2  * tridiag.h - tridiagonal matrix template class definitions
3  *
4  * Copyright (C) 2005 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: tridiag.h 1825 2011-03-11 20:42:14Z ela $
22  *
23  */
24 
25 #ifndef __TRIDIAG_H__
26 #define __TRIDIAG_H__
27 
28 #include "tvector.h"
29 
30 // Types of tridiagonal matrices.
37 };
38 
39 template <class nr_type_t>
40 class tridiag
41 {
42  public:
43  tridiag ();
44  tridiag (const tridiag &);
45  const tridiag& operator = (const tridiag &);
46  ~tridiag ();
47 
50  void setA (tvector<nr_type_t> *);
51  void setB (tvector<nr_type_t> *);
52  void setRHS (tvector<nr_type_t> *);
53  void setType (int t) { type = t; }
54 
55  void solve (void);
56  void solve_ns (void);
57  void solve_ns_cyc (void);
58  void solve_s (void);
59  void solve_s_cyc (void);
60 
61  private:
62  tvector<nr_type_t> * abov;
63  tvector<nr_type_t> * belo;
64  tvector<nr_type_t> * diag;
65  tvector<nr_type_t> * offdiag;
66  tvector<nr_type_t> * rhs;
67 
68  nr_type_t * d;
69  nr_type_t * e;
70  nr_type_t * f;
71  nr_type_t * z;
72  nr_type_t * c;
73  nr_type_t * b;
74  nr_type_t * x;
75  nr_type_t * al;
76  nr_type_t * be;
77  nr_type_t * ga;
78  nr_type_t * de;
79  nr_type_t * ep;
80 
81  int type;
82 };
83 
84 #include "tridiag.cpp"
85 
86 #endif /* __TRIDIAG_H__ */