So-Bogus
A c++ sparse block matrix library aimed at Second Order cone problems
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
NumTraits.hpp
1 /*
2  * This file is part of bogus, a C++ sparse block matrix library.
3  *
4  * Copyright 2013 Gilles Daviet <gdaviet@gmail.com>
5  *
6  * This Source Code Form is subject to the terms of the Mozilla Public
7  * License, v. 2.0. If a copy of the MPL was not distributed with this
8  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 */
10 
11 
12 #ifndef BOGUS_NUMTRAITS_HPP
13 #define BOGUS_NUMTRAITS_HPP
14 
15 #include <limits>
16 #include <cmath>
17 
18 namespace bogus
19 {
20 
21 template <typename Scalar>
22 struct NumTraits
23 {
24  static Scalar epsilon()
25  { return std::numeric_limits< Scalar >::epsilon() ; }
26  static bool isZero( Scalar s )
27  { return std::fabs(s) < std::numeric_limits< Scalar >::epsilon() ; }
28  static bool isSquareZero( Scalar s )
29  { return s*s < std::numeric_limits< Scalar >::epsilon() ; }
30 } ;
31 
32 template <typename MatrixType>
33 struct MatrixTraits ;
34 
35 }
36 
37 #endif
Definition: EigenMatrixTraits.hpp:26
Definition: NumTraits.hpp:22