7 #ifndef ALPSCORE_GRID_HPP 8 #define ALPSCORE_GRID_HPP 32 double step = (emax_ - emin_)/
double(n_-1);
33 for(
int i = 0; i<n_; i++) {
34 points[i] = emin_ + step*i;
53 throw std::invalid_argument(
"the parameter tmin must be greater than 0");
55 throw std::invalid_argument(
"the parameter tmax must be greater than tmin");
59 throw std::invalid_argument(
"the parameter tmin must be greater than 0");
61 throw std::invalid_argument(
"the parameter tmax must be greater than tmin");
64 points.resize(nfreq_);
65 double scale =
std::log(t_max_ / t_min_) / ((float) ((nfreq_ / 2 - 1)));
66 points[nfreq_ / 2] = c_;
67 for (
int i = 0; i < nfreq_ / 2; ++i) {
70 points[nfreq_ / 2 + i + 1] = c_ + t_min_ *
std::exp(((
float) (i)) * scale);
71 points[nfreq_ / 2 - i - 1] = c_ - t_min_ *
std::exp(((
float) (i)) * scale);
75 points[nfreq_ / 2 + nfreq_ / 2] = c_ + t_min_ *
std::exp(((
float) (nfreq_/2 - 1)) * scale);
88 throw std::invalid_argument(
"the parameter spread must be greater than 1");
92 points.resize(nfreq_);
93 std::vector<double> temp(nfreq_);
95 for (
int i = 0; i < nfreq_; ++i) {
96 double a = double(i) / (nfreq_ - 1);
97 double factor = 4 * (spread_ - 1) * (a * a - a) + spread_;
98 factor /= double(nfreq_ - 1) / (3. * (nfreq_ - 2))
99 * ((nfreq_ - 1) * (2 + spread_) - 4 + spread_);
100 double delta_t = factor;
104 points[nfreq_/2] = 0.;
105 for (
int i = 1; i <= nfreq_/2; ++i) {
107 points[i + nfreq_ / 2] = temp[i - 1] / temp[nfreq_ / 2 - 1];
108 points[nfreq_ / 2 - i] = -temp[i - 1] / temp[nfreq_ / 2 - 1];
112 points[nfreq_ / 2 + nfreq_ / 2] = temp[nfreq_/2 - 1] / temp[nfreq_ / 2 - 1];
119 #endif //ALPSCORE_GRID_HPP void compute_points(std::vector< double > &points) const
boost::array< T, N > log(boost::array< T, N > arg)
quadratic_real_frequency_grid(double spread, int n)
Linear grid in real frequency.
Logarithmic grid in real frequency.
boost::array< T, N > exp(boost::array< T, N > arg)
Quadratic grid in real frequency.
linear_real_frequency_grid(double emin, double emax, int n)
void compute_points(std::vector< double > &points) const
logarithmic_real_frequency_grid(double tmin, double tmax, double c, int n)
void compute_points(std::vector< double > &points) const
logarithmic_real_frequency_grid(double tmin, double tmax, int n)