Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)

app-bholger/gfem/bernoulliPol.h
Go to the documentation of this file.
00001 #pragma once
00002 #include "basics/typedefs.hh"
00003 #include <map>
00004 #include <vector>
00005 
00006 
00007 namespace concepts {
00008 
00009 
00010 class BernoulliPol {
00011 private:
00012   // you probably don't want to create a copy of this class
00013   BernoulliPol& operator=(BernoulliPol& other);
00014   BernoulliPol(BernoulliPol& other);
00015 public:
00016   //typedef std::vector<Cmplx> VC;
00017   //typedef std::pair<Real, Real> PRR;
00018   typedef std::pair<int, Real> CacheKey;
00019   typedef std::map<CacheKey, Real> Cache;
00020 
00021   BernoulliPol() {
00022 
00023   }
00024 
00025   ~BernoulliPol() {
00026   }
00027 
00028   static BernoulliPol& getInstance() {
00029     return g_instance;
00030   }
00031 
00033   Real eval(int k, Real x); 
00034 
00036   Real binom(int a, int b);
00037 
00038   template<typename Real>
00039   static inline Real powi(Real x, int power) {
00040 #if 0
00041     Real res(1);
00042     for(int i = 0; i < power; ++i) {
00043       res *= x;
00044     }
00045     return res;
00046 #else
00047     return pow(x, power);
00048 #endif
00049   }
00050 
00051 private:
00052   static BernoulliPol g_instance;
00053 
00054   Cache cache;
00055 };
00056 
00057 } // namespace

Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)