CHROMA
remez_rat_approx.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /*! @file
3  * @brief Remez-type rational approximation
4  */
5 
6 #ifndef __remez_rat_approx_h__
7 #define __remez_rat_approx_h__
8 
10 
11 namespace Chroma
12 {
13 
14  //! Name and registration
15  /*! @ingroup monomial */
16  namespace RemezRatApproxEnv
17  {
18  bool registerAll();
19 
20  //! Params for Remez type rational approximation
21  /*! @ingroup monomial */
22  struct Params
23  {
24  Params() {}
25  Params(XMLReader& in, const std::string& path);
26  void writeXML(XMLWriter& in, const std::string& path) const;
27 
28  int numPower; /*!< Approximate x^-(numPower/denPower) */
29  int denPower; /*!< Approximate x^-(numPower/denPower) */
30  Real lowerMin; /*!< lower bound of approximation region */
31  Real upperMax; /*!< upper bound of approximation region */
32  int degree; /*!< degree of approximation */
33  int digitPrecision; /*!< number of digits used for bigfloat calcs */
34  };
35 
36 
37  //! Remez type of rational approximations
38  /*! @ingroup monomial */
39  class RatApprox : public RationalApprox
40  {
41  public:
42  //! Full constructor
43  RatApprox(const Params& p) : params(p) {}
44 
45  //! Destructor
47 
48  //! Produce the partial-fraction-expansion (PFE) and its inverse (IPFE)
49  void operator()(RemezCoeff_t& pfe, RemezCoeff_t& ipfe) const;
50 
51  private:
52  Params params; /*!< remez params */
53  };
54 
55  } // end namespace
56 
57  //! Reader
58  /*! @ingroup monomial */
59  void read(XMLReader& xml, const std::string& path, RemezRatApproxEnv::Params& param);
60 
61  //! Reader
62  /*! @ingroup monomial */
63  void write(XMLWriter& xml, const std::string& path, const RemezRatApproxEnv::Params& params);
64 
65 } //end namespace chroma
66 
67 #endif
Base class for rational approximations.
Definition: rat_approx.h:19
Remez type of rational approximations.
void operator()(RemezCoeff_t &pfe, RemezCoeff_t &ipfe) const
Produce the partial-fraction-expansion (PFE) and its inverse (IPFE)
RatApprox(const Params &p)
Full constructor.
void read(XMLReader &xml, const std::string &path, AsqtadFermActParams &param)
Read parameters.
void write(XMLWriter &xml, const std::string &path, const AsqtadFermActParams &param)
Writer parameters.
Params params
bool registerAll()
Register all the factories.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
static QDP_ColorVector * in
::std::string string
Definition: gtest.h:1979
Base class for rational approximations.
Convenient structure to package Remez coeffs.
Definition: remez_coeff.h:19
Params for Remez type rational approximation.
void writeXML(XMLWriter &in, const std::string &path) const
Parameters for running code.