Flow123d  release_2.2.0-914-gf1a3a4f
matrix.h
Go to the documentation of this file.
1 /*!
2  *
3  * Copyright (C) 2015 Technical University of Liberec. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License version 3 as published by the
7  * Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12  *
13  *
14  * @file matrix.h
15  * @brief
16  */
17 
18 #ifndef matrixH
19 #define matrixH
20 
21 #include <iostream>
22 
23 
24 namespace ngh {
25 
26 typedef enum {
32 } TNSolutions;
33 
34 class TMatrix {
35 private:
36  int nc;
37  int nr;
38 
39  double* elm;
40 
41 public:
42  TMatrix(int);
43  TMatrix(const TMatrix &);
44  TMatrix(int, int);
45  ~TMatrix();
46 
47  int NRows() const;
48  int NCols() const;
49 
50  void Set(int, int, double);
51  double Get(int, int) const;
52 
53  void SwapRows(int, int);
54 
55  friend std::ostream & operator <<(std::ostream&, const TMatrix&);
56 };
57 
58 class TMVector {
59 private:
60  int size;
61 
62  double* elm;
63 
64 public:
65  TMVector(int);
66  TMVector(const TMVector &);
67  ~TMVector();
68 
69  void Set(int, double);
70  double Get(int);
71  void SwapElements(int, int);
72 
73  friend std::ostream & operator <<(std::ostream&, const TMVector&);
74 };
75 
76 TNSolutions Gauss(const TMatrix&, TMVector*, const TMVector&);
77 
78 } //namespace ngh
79 
80 #endif
TMatrix(int)
Definition: matrix.cpp:28
void Set(int, int, double)
Definition: matrix.cpp:85
int nr
Definition: matrix.h:37
friend std::ostream & operator<<(std::ostream &, const TMatrix &)
Definition: matrix.cpp:68
Definition: abscissa.h:25
int NRows() const
Definition: matrix.cpp:144
TNSolutions
Definition: matrix.h:26
void SwapRows(int, int)
Definition: matrix.cpp:102
int nc
Definition: matrix.h:36
double * elm
Definition: matrix.h:39
TNSolutions Gauss(const TMatrix &, TMVector *, const TMVector &)
Definition: matrix.cpp:152
int NCols() const
Definition: matrix.cpp:148
double * elm
Definition: matrix.h:62
double Get(int, int) const
Definition: matrix.cpp:94
int size
Definition: matrix.h:60