src/matrix.hpp

Go to the documentation of this file.
00001 //
00002 // Ephi - simulation of magnetic fields and particles
00003 // Copyright (C) 2007 Indrek Mandre <indrek(at)mare.ee>
00004 // For more information please see http://www.mare.ee/indrek/
00005 //
00006 // This program 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 of the License, or
00009 // (at your option) any later version.
00010 //
00011 // This program 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 along
00017 // with this program; if not, write to the Free Software Foundation, Inc.,
00018 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00019 //
00020 
00021 #ifndef __matrix_hpp__
00022 #define __matrix_hpp__
00023 
00024 #include <list>
00025 #include <string>
00026 #include <vector>
00027 
00029 class LinearSystem
00030 {
00031 public:
00034   LinearSystem (size_t n, size_t k = 1);
00035   ~LinearSystem ();
00036 
00038   bool solveGJ ();
00039 
00041   bool solveGBS ();
00042 
00044   prec_t *getRow (size_t i) { return rows[i]; }
00045   prec_t **getRows() { return &rows[0]; }
00046   size_t getN() const { return n; }
00047   size_t getK() const { return k; }
00048 
00049   const prec_t *getResults (size_t i = 0) const { return results + i * n; }
00050 
00051   void print();
00052 
00054   void clear();
00055 
00056 private:
00057   size_t n, k, npk;
00058   prec_t *data;
00059   prec_t *results;
00060   std::vector<prec_t *> rows;
00061 
00062   LinearSystem (const LinearSystem& copy);
00063   LinearSystem& operator= (const LinearSystem& copy);
00064 };
00065 
00066 #endif // !__potential_hpp__
00067 

Generated on Thu Dec 6 20:31:14 2007 for Ephi by  doxygen 1.5.0