Grid 0.7.0
MultiShiftFunction.h
Go to the documentation of this file.
1 /*************************************************************************************
2
3 Grid physics library, www.github.com/paboyle/Grid
4
5 Source file: ./lib/algorithms/approx/MultiShiftFunction.h
6
7 Copyright (C) 2015
8
9Author: Azusa Yamaguchi <ayamaguc@staffmail.ed.ac.uk>
10Author: Peter Boyle <paboyle@ph.ed.ac.uk>
11
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
16
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
21
22 You should have received a copy of the GNU General Public License along
23 with this program; if not, write to the Free Software Foundation, Inc.,
24 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25
26 See the full license in the file "LICENSE" in the top level distribution directory
27 *************************************************************************************/
28 /* END LEGAL */
29#ifndef MULTI_SHIFT_FUNCTION
30#define MULTI_SHIFT_FUNCTION
31
33
35public:
36 int order;
37 std::vector<RealD> poles;
38 std::vector<RealD> residues;
39 std::vector<RealD> tolerances;
42
43 MultiShiftFunction(int n,RealD _lo,RealD _hi): poles(n), residues(n), tolerances(n), lo(_lo), hi(_hi) {;};
45 void csv(std::ostream &out);
46 void gnuplot(std::ostream &out);
47
48 void Init(AlgRemez & remez,double tol,bool inverse)
49 {
50 order=remez.getDegree();
51 tolerances.resize(remez.getDegree(),tol);
52 poles.resize(remez.getDegree());
53 residues.resize(remez.getDegree());
54 remez.getBounds(lo,hi);
55 if ( inverse ) remez.getIPFE (&residues[0],&poles[0],&norm);
56 else remez.getPFE (&residues[0],&poles[0],&norm);
57 }
58 // Allow deferred initialisation
60 MultiShiftFunction(AlgRemez & remez,double tol,bool inverse)
61 {
62 Init(remez,tol,inverse);
63 }
64
65};
67#endif
#define NAMESPACE_BEGIN(A)
Definition Namespace.h:35
#define NAMESPACE_END(A)
Definition Namespace.h:36
double RealD
Definition Simd.h:61
int getDegree(void)
Definition Remez.h:136
int getPFE(double *res, double *pole, double *norm)
Definition Remez.cc:179
void getBounds(double &lower, double &upper)
Definition Remez.h:143
int getIPFE(double *res, double *pole, double *norm)
Definition Remez.cc:218
void gnuplot(std::ostream &out)
MultiShiftFunction(AlgRemez &remez, double tol, bool inverse)
void Init(AlgRemez &remez, double tol, bool inverse)
std::vector< RealD > poles
std::vector< RealD > tolerances
void csv(std::ostream &out)
MultiShiftFunction(int n, RealD _lo, RealD _hi)
std::vector< RealD > residues