Qucs-core  0.0.19
tridiag.h
Go to the documentation of this file.
00001 /*
00002  * tridiag.h - tridiagonal matrix template class definitions
00003  *
00004  * Copyright (C) 2005 Stefan Jahn <stefan@lkcc.org>
00005  *
00006  * This is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2, or (at your option)
00009  * any later version.
00010  *
00011  * This software is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this package; see the file COPYING.  If not, write to
00018  * the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
00019  * Boston, MA 02110-1301, USA.
00020  *
00021  * $Id$
00022  *
00023  */
00024 
00025 #ifndef __TRIDIAG_H__
00026 #define __TRIDIAG_H__
00027 
00028 #include <vector>
00029 //#include "tvector.h"
00030 
00031 namespace qucs {
00032 
00033 // Types of tridiagonal matrices.
00034 enum tridiag_type {
00035   TRIDIAG_UNKNOWN = -1,
00036   TRIDIAG_NONSYM,
00037   TRIDIAG_SYM,
00038   TRIDIAG_NONSYM_CYCLIC,
00039   TRIDIAG_SYM_CYCLIC
00040 };
00041 
00042 template <class nr_type_t>
00043 class tridiag
00044 {
00045  public:
00046   tridiag ();
00047   tridiag (const tridiag &);
00048   const tridiag& operator = (const tridiag &);
00049   ~tridiag ();
00050 
00051   void setDiagonal (::std::vector<nr_type_t> *);
00052   void setOffDiagonal (std::vector<nr_type_t> *);
00053   void setA (::std::vector<nr_type_t> *);
00054   void setB (::std::vector<nr_type_t> *);
00055   void setRHS (::std::vector<nr_type_t> *);
00056   void setType (int t) { type = t; }
00057 
00058   void solve (void);
00059   void solve_ns (void);
00060   void solve_ns_cyc (void);
00061   void solve_s (void);
00062   void solve_s_cyc (void);
00063 
00064  private:
00065   ::std::vector<nr_type_t> * abov;
00066   ::std::vector<nr_type_t> * belo;
00067   ::std::vector<nr_type_t> * diag;
00068   ::std::vector<nr_type_t> * offdiag;
00069   ::std::vector<nr_type_t> * rhs;
00070 
00071   nr_type_t * d;
00072   nr_type_t * e;
00073   nr_type_t * f;
00074   nr_type_t * z;
00075   nr_type_t * c;
00076   nr_type_t * b;
00077   nr_type_t * x;
00078   nr_type_t * al;
00079   nr_type_t * be;
00080   nr_type_t * ga;
00081   nr_type_t * de;
00082   nr_type_t * ep;
00083 
00084   int type;
00085 };
00086 
00087 } // namespace qucs
00088 
00089 #include "tridiag.cpp"
00090 
00091 #endif /* __TRIDIAG_H__ */