Flow123d  release_2.1.0-87-gfbc1563
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 typedef enum {
29 } TNSolutions;
30 
31 class TMatrix {
32 private:
33  int nc;
34  int nr;
35 
36  double* elm;
37 
38 public:
39  TMatrix(int);
40  TMatrix(const TMatrix &);
41  TMatrix(int, int);
42  ~TMatrix();
43 
44  int NRows() const;
45  int NCols() const;
46 
47  void Set(int, int, double);
48  double Get(int, int) const;
49 
50  void SwapRows(int, int);
51 
52  friend std::ostream & operator <<(std::ostream&, const TMatrix&);
53 };
54 
55 class TMVector {
56 private:
57  int size;
58 
59  double* elm;
60 
61 public:
62  TMVector(int);
63  TMVector(const TMVector &);
64  ~TMVector();
65 
66  void Set(int, double);
67  double Get(int);
68  void SwapElements(int, int);
69 
70  friend std::ostream & operator <<(std::ostream&, const TMVector&);
71 };
72 
73 TNSolutions Gauss(const TMatrix&, TMVector*, const TMVector&);
74 
75 #endif
double * elm
Definition: matrix.h:36
TNSolutions
Definition: matrix.h:23
int NCols() const
Definition: matrix.cpp:145
int NRows() const
Definition: matrix.cpp:141
double Get(int, int) const
Definition: matrix.cpp:91
~TMatrix()
Definition: matrix.cpp:45
void SwapRows(int, int)
Definition: matrix.cpp:99
Definition: matrix.h:31
TMatrix(int)
Definition: matrix.cpp:25
void Set(int, int, double)
Definition: matrix.cpp:82
int nc
Definition: matrix.h:33
double * elm
Definition: matrix.h:59
friend std::ostream & operator<<(std::ostream &, const TMatrix &)
Definition: matrix.cpp:65
int nr
Definition: matrix.h:34
TNSolutions Gauss(const TMatrix &, TMVector *, const TMVector &)
Definition: matrix.cpp:149
int size
Definition: matrix.h:57