constants.hpp

Go to the documentation of this file.
00001 // Copyright (C) 2009 NICTA
00002 // 
00003 // Authors:
00004 // - Conrad Sanderson (conradsand at ieee dot org)
00005 // 
00006 // This file is part of the Armadillo C++ library.
00007 // It is provided without any warranty of fitness
00008 // for any purpose. You can redistribute this file
00009 // and/or modify it under the terms of the GNU
00010 // Lesser General Public License (LGPL) as published
00011 // by the Free Software Foundation, either version 3
00012 // of the License or (at your option) any later version.
00013 // (see http://www.opensource.org/licenses for more info)
00014 
00015 
00016 //! \addtogroup constants
00017 //! @{
00018 
00019 
00020 // the long lengths of the constants are for future support of "long double"
00021 // and any smart compiler that does high-precision computation at compile-time
00022 
00023 template<typename eT>
00024 class Math
00025   {
00026   public:
00027   
00028   //! ratio of any circle's circumference to its diameter
00029   static const eT pi()     { return eT(3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679); }
00030   
00031   //! base of the natural logarithm
00032   static const eT e()      { return eT(2.7182818284590452353602874713526624977572470936999595749669676277240766303535475945713821785251664274); }
00033   
00034   //! Euler's constant, aka Euler-Mascheroni constant
00035   static const eT euler()  { return eT(0.5772156649015328606065120900824024310421593359399235988057672348848677267776646709369470632917467495); }
00036   
00037   //! golden ratio
00038   static const eT gratio() { return eT(1.6180339887498948482045868343656381177203091798057628621354486227052604628189024497072072041893911374); }
00039   
00040   //! square root of 2
00041   static const eT sqrt2()  { return eT(1.4142135623730950488016887242096980785696718753769480731766797379907324784621070388503875343276415727); }
00042   
00043   //! the difference between 1 and the least value greater than 1 that is representable
00044   static const eT eps()     { return std::numeric_limits<eT>::epsilon(); }
00045   
00046   //! log of the minimum representable value
00047   static const eT log_min() { static const eT out = std::log(std::numeric_limits<eT>::min()); return out; }
00048     
00049   //! log of the maximum representable value
00050   static const eT log_max() { static const eT out = std::log(std::numeric_limits<eT>::max()); return out; }
00051   };
00052 
00053 
00054 
00055 typedef Math<float>  fmath;
00056 typedef Math<double> math;
00057 
00058 
00059 
00060 struct arma_version
00061   {
00062   static const unsigned int major = 0;
00063   static const unsigned int minor = 6;
00064   static const unsigned int patch = 10;
00065   };
00066 
00067 
00068 
00069 struct arma_config
00070   {
00071   #if defined(ARMA_USE_ATLAS)
00072     static const bool atlas = true;
00073   #else
00074     static const bool atlas = false;
00075   #endif
00076   
00077   
00078   #if defined(ARMA_USE_LAPACK)
00079     static const bool lapack = true;
00080   #else
00081     static const bool lapack = false;
00082   #endif
00083   
00084   
00085   #if defined(ARMA_USE_BLAS)
00086     static const bool blas = true;
00087   #else
00088     static const bool blas = false;
00089   #endif
00090 
00091 
00092   #if defined(ARMA_USE_BOOST)
00093     static const bool boost = true;
00094   #else
00095     static const bool boost = false;
00096   #endif
00097   
00098   
00099   #if !defined(ARMA_NO_DEBUG) && !defined(NDEBUG)
00100     static const bool debug = true;
00101   #else
00102     static const bool debug = false;
00103   #endif
00104   
00105   
00106   #if defined(ARMA_EXTRA_DEBUG)
00107     static const bool extra_debug = true;
00108   #else
00109     static const bool extra_debug = false;
00110   #endif
00111   };
00112 
00113 //! @}
00114 
00115