23 const double CosineDistributionFactor = 1.0 / 3.0 - 2.0 / M_PI / M_PI;
30 IFTDistribution1D::IFTDistribution1D(
const NodeMeta& meta,
const std::vector<double>& PValues)
31 :
INode(nodeMetaUnion({{
"Omega",
"nm",
"Half-width", 0, INF, 1.}}, meta), PValues),
40 FTDistribution1DCauchy::FTDistribution1DCauchy(
const std::vector<double> P)
45 FTDistribution1DCauchy::FTDistribution1DCauchy(
double omega)
57 double sum_sq = q * q * m_omega * m_omega;
58 return 1.0 / (1.0 + sum_sq);
63 return 2.0 * m_omega * m_omega;
66 std::unique_ptr<IDistribution1DSampler> FTDistribution1DCauchy::createSampler()
const
68 return std::make_unique<Distribution1DCauchySampler>(1 / m_omega);
75 FTDistribution1DGauss::FTDistribution1DGauss(
const std::vector<double> P)
80 FTDistribution1DGauss::FTDistribution1DGauss(
double omega)
92 double sum_sq = q * q * m_omega * m_omega;
93 return std::exp(-sum_sq / 2.0);
98 return m_omega * m_omega;
101 std::unique_ptr<IDistribution1DSampler> FTDistribution1DGauss::createSampler()
const
103 return std::make_unique<Distribution1DGaussSampler>(0.0, m_omega);
110 FTDistribution1DGate::FTDistribution1DGate(
const std::vector<double> P)
115 FTDistribution1DGate::FTDistribution1DGate(
double omega)
132 return m_omega * m_omega / 3.0;
135 std::unique_ptr<IDistribution1DSampler> FTDistribution1DGate::createSampler()
const
137 return std::make_unique<Distribution1DGateSampler>(-m_omega, m_omega);
144 FTDistribution1DTriangle::FTDistribution1DTriangle(
const std::vector<double> P)
149 FTDistribution1DTriangle::FTDistribution1DTriangle(
double omega)
162 return sincqw2 * sincqw2;
167 return m_omega * m_omega / 6.0;
170 std::unique_ptr<IDistribution1DSampler> FTDistribution1DTriangle::createSampler()
const
172 return std::make_unique<Distribution1DTriangleSampler>(m_omega);
179 FTDistribution1DCosine::FTDistribution1DCosine(
const std::vector<double> P)
184 FTDistribution1DCosine::FTDistribution1DCosine(
double omega)
196 double qw = std::abs(q * m_omega);
197 if (std::abs(1.0 - qw * qw / M_PI / M_PI) < std::numeric_limits<double>::epsilon())
204 return CosineDistributionFactor * m_omega * m_omega;
207 std::unique_ptr<IDistribution1DSampler> FTDistribution1DCosine::createSampler()
const
209 return std::make_unique<Distribution1DCosineSampler>(m_omega);
216 FTDistribution1DVoigt::FTDistribution1DVoigt(
const std::vector<double> P)
218 {
"FTDistribution1DVoigt",
220 {{
"Eta",
"",
"balances between Gauss (eta=0) and Cauchy (eta=1) limiting cases", -INF,
227 FTDistribution1DVoigt::FTDistribution1DVoigt(
double omega,
double eta)
239 double sum_sq = q * q * m_omega * m_omega;
240 return m_eta * std::exp(-sum_sq / 2.0) + (1.0 - m_eta) * 1.0 / (1.0 + sum_sq);
245 return (2.0 - m_eta) * m_omega * m_omega;
248 std::unique_ptr<IDistribution1DSampler> FTDistribution1DVoigt::createSampler()
const
252 std::ostringstream ostr;
253 ostr <<
"FTDistribution1DVoigt::createSampler() -> Error in class initialization";
254 ostr <<
"\n\n Has not been implemented yet...stay tuned!";
Defines many exception classes in namespace Exceptionss.
Defines interface class IFTDistribution1D, and children thereof.
Defines M_PI and some more mathematical constants.
Defines namespace MathFunctions.
Exponential IFTDistribution1D exp(-|omega*x|); its Fourier transform evaluate(q) is a Cauchy-Lorentzi...
double qSecondDerivative() const override final
Returns the negative of the second order derivative in q space around q=0.
double evaluate(double q) const override final
Returns Fourier transform of this distribution; is a decay function starting at evaluate(0)=1.
IFTDistribution1D consisting of one cosine wave [1+cos(pi*x/omega) if |x|<omega, and 0 otherwise]; it...
double evaluate(double q) const override final
Returns Fourier transform of this distribution; is a decay function starting at evaluate(0)=1.
double qSecondDerivative() const override final
Returns the negative of the second order derivative in q space around q=0.
Square gate IFTDistribution1D; its Fourier transform evaluate(q) is a sinc function starting at evalu...
double evaluate(double q) const override final
Returns Fourier transform of this distribution; is a decay function starting at evaluate(0)=1.
double qSecondDerivative() const override final
Returns the negative of the second order derivative in q space around q=0.
Gaussian IFTDistribution1D; its Fourier transform evaluate(q) is a Gaussian starting at evaluate(0)=1...
double qSecondDerivative() const override final
Returns the negative of the second order derivative in q space around q=0.
double evaluate(double q) const override final
Returns Fourier transform of this distribution; is a decay function starting at evaluate(0)=1.
Triangle IFTDistribution1D [1-|x|/omega if |x|<omega, and 0 otherwise]; its Fourier transform evaluat...
double evaluate(double q) const override final
Returns Fourier transform of this distribution; is a decay function starting at evaluate(0)=1.
double qSecondDerivative() const override final
Returns the negative of the second order derivative in q space around q=0.
IFTDistribution1D that provides a Fourier transform evaluate(q) in form of a pseudo-Voigt decay funct...
double evaluate(double q) const override final
Returns Fourier transform of this distribution; is a decay function starting at evaluate(0)=1.
double qSecondDerivative() const override final
Returns the negative of the second order derivative in q space around q=0.
Interface for a one-dimensional distribution, with normalization adjusted so that the Fourier transfo...
Base class for tree-like structures containing parameterized objects.
double sinc(double x)
sinc function: