Flow123d  release_2.2.0-26-ge868538
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:146
int NRows() const
Definition: matrix.cpp:142
double Get(int, int) const
Definition: matrix.cpp:92
~TMatrix()
Definition: matrix.cpp:46
void SwapRows(int, int)
Definition: matrix.cpp:100
Definition: matrix.h:31
TMatrix(int)
Definition: matrix.cpp:26
void Set(int, int, double)
Definition: matrix.cpp:83
int nc
Definition: matrix.h:33
double * elm
Definition: matrix.h:59
friend std::ostream & operator<<(std::ostream &, const TMatrix &)
Definition: matrix.cpp:66
int nr
Definition: matrix.h:34
TNSolutions Gauss(const TMatrix &, TMVector *, const TMVector &)
Definition: matrix.cpp:150
int size
Definition: matrix.h:57