LSSTApplications  8.0.0.0+107,8.0.0.1+13,9.1+18,9.2,master-g084aeec0a4,master-g0aced2eed8+6,master-g15627eb03c,master-g28afc54ef9,master-g3391ba5ea0,master-g3d0fb8ae5f,master-g4432ae2e89+36,master-g5c3c32f3ec+17,master-g60f1e072bb+1,master-g6a3ac32d1b,master-g76a88a4307+1,master-g7bce1f4e06+57,master-g8ff4092549+31,master-g98e65bf68e,master-ga6b77976b1+53,master-gae20e2b580+3,master-gb584cd3397+53,master-gc5448b162b+1,master-gc54cf9771d,master-gc69578ece6+1,master-gcbf758c456+22,master-gcec1da163f+63,master-gcf15f11bcc,master-gd167108223,master-gf44c96c709
LSSTDataManagementBasePackage
PowFast.h
Go to the documentation of this file.
1 /*------------------------------------------------------------------------------
2 
3  HXA7241 General library.
4  Harrison Ainsworth / HXA7241 : 2004-2011
5 
6  http://www.hxa.name/
7 
8 ------------------------------------------------------------------------------*/
9 
10 
11 #ifndef LSST_UTILS_POWFAST_H
12 #define LSST_UTILS_POWFAST_H
13 
14 namespace lsst { namespace utils {
15 
16 
42 class PowFast;
43 template<int> const PowFast& getPowFast(); // forward declaration
44 
45 class PowFast {
46 public:
47  template<int> friend const PowFast& getPowFast();
48 
49 
51  float two(float x
52  ) const;
53 
55  float exp(float x
56  ) const;
57 
59  float ten(float x
60  ) const;
61 
65  float r(float logr,
66  float x
67  )const;
68 
72  unsigned int getPrecision() const;
73 
74 private:
75  explicit PowFast( unsigned int precision = 11
76  );
77  ~PowFast();
78  PowFast(const PowFast&);
79  PowFast& operator=(const PowFast&);
80 
81  unsigned int precision_m;
82  unsigned int* pTable_m;
83 };
84 
88 template<int precision /* = 11 */> // Default values for functions are new in C++11
90 {
91  static const PowFast k(precision);
92  return k;
93 }
98 }}
99 #endif
unsigned int getPrecision() const
Return this PowFast&#39;s precision.
Definition: PowFast.cc:178
friend const PowFast & getPowFast()
return a singleton PowFast with the specified precision in its lookup tables
unsigned int precision_m
Definition: PowFast.h:81
float r(float logr, float x) const
Evaluate r^x.
Definition: PowFast.cc:169
const PowFast & getPowFast()
return a singleton PowFast with the specified precision in its lookup tables
Definition: PowFast.h:89
PowFast(unsigned int precision=11)
Definition: PowFast.cc:125
float exp(float x) const
Evaluate exp(x). (x must be in (-87.3ish, 88.7ish))
Definition: PowFast.cc:151
int x
unsigned int * pTable_m
Definition: PowFast.h:82
float ten(float x) const
Evaluate 10^x. (x must be in (-37.9ish, 38.5ish))
Definition: PowFast.cc:160
PowFast & operator=(const PowFast &)
float two(float x) const
Evaluate 2^x . (x must be in (-125, 128))
Definition: PowFast.cc:142