Flow123d  release_2.2.0-19-g1279b7e
mathfce.cpp
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 mathfce.cpp
15  * @brief
16  */
17 
18 #include <cmath>
20 
21 
22 bool mathfce::IsZero(double x)
23 {
24  if (fabs(x) < epsilon)
25  return true;
26  return false;
27 }
28 
29 bool mathfce::IsEqual(double x, double y)
30 {
31  if (fabs(x - y) < epsilon)
32  return true;
33  return false;
34 }
35 
36 
37 double Determinant3( double a[ 3 ][ 3 ] )
38 {
39  double rc;
40  rc = a[ 0 ][ 0 ] * a[ 1 ][ 1 ] * a[ 2 ][ 2 ]
41  + a[ 1 ][ 0 ] * a[ 2 ][ 1 ] * a[ 0 ][ 2 ]
42  + a[ 2 ][ 0 ] * a[ 0 ][ 1 ] * a[ 1 ][ 2 ]
43  - a[ 0 ][ 2 ] * a[ 1 ][ 1 ] * a[ 2 ][ 0 ]
44  - a[ 1 ][ 2 ] * a[ 2 ][ 1 ] * a[ 0 ][ 0 ]
45  - a[ 2 ][ 2 ] * a[ 0 ][ 1 ] * a[ 1 ][ 0 ];
46  return rc;
47 }
48 
bool IsZero(double)
Definition: mathfce.cpp:22
double Determinant3(double a[3][3])
Definition: mathfce.cpp:37
const double epsilon
Definition: mathfce.h:23
bool IsEqual(double, double)
Definition: mathfce.cpp:29