Commit ef8bd619 authored by niklas.baumgarten's avatar niklas.baumgarten
Browse files

refactored covariance function

parent 7783383e
...@@ -39,7 +39,7 @@ MainVerbose = 1 ...@@ -39,7 +39,7 @@ MainVerbose = 1
MCVerbose = 2 MCVerbose = 2
MLMCVerbose = 2 MLMCVerbose = 2
PDEVerbose = 1 PDEVerbose = 1
GeneratorVerbose = 0 GeneratorVerbose = 1
GeneratorPlotting = 4 GeneratorPlotting = 4
MCPlotting = 3 MCPlotting = 3
...@@ -51,7 +51,7 @@ sigma = 1.0 ...@@ -51,7 +51,7 @@ sigma = 1.0
norm_p = 2 norm_p = 2
lambda1 = 0.15 lambda1 = 0.15
lambda2 = 0.15 lambda2 = 0.15
alpha = 1.0 smoothing = 1.0
evtol = 1e-10 evtol = 1e-10
# Other # Other
......
...@@ -3,18 +3,18 @@ ...@@ -3,18 +3,18 @@
class CovarianceFunction { class CovarianceFunction {
public: public:
double sigma; double sigma = 1.0;
int norm_p; int norm_p = 2;
double lambda1; double lambda1 = 0.15;
double lambda2; // Has no influence on 1D double lambda2 = 0.15; // Has no influence on 1D
double alpha; double smoothing = 1.0;
CovarianceFunction() { CovarianceFunction() {
ReadConfig(Settings, "sigma", sigma); config.get("sigma", sigma);
ReadConfig(Settings, "norm_p", norm_p); config.get("norm_p", norm_p);
ReadConfig(Settings, "lambda1", lambda1); config.get( "lambda1", lambda1);
ReadConfig(Settings, "lambda2", lambda2); config.get( "lambda2", lambda2);
ReadConfig(Settings, "alpha", alpha); config.get( "smoothing", smoothing);
} }
virtual double covariance_fct(double *tau) = 0; virtual double covariance_fct(double *tau) = 0;
...@@ -26,7 +26,7 @@ class CovarianceFunction1D : CovarianceFunction { ...@@ -26,7 +26,7 @@ class CovarianceFunction1D : CovarianceFunction {
public: public:
double covariance_fct(double *tau) override { double covariance_fct(double *tau) override {
tau[0] /= lambda1; tau[0] /= lambda1;
return pow(sigma, 2) * exp(-pow(norm(tau), alpha)); return pow(sigma, 2) * exp(-pow(norm(tau), smoothing));
} }
double norm(const double *x) override { double norm(const double *x) override {
...@@ -39,7 +39,7 @@ public: ...@@ -39,7 +39,7 @@ public:
double covariance_fct(double *tau) override { double covariance_fct(double *tau) override {
tau[0] /= lambda1; tau[0] /= lambda1;
tau[1] /= lambda2; tau[1] /= lambda2;
return pow(sigma, 2) * exp(-pow(norm(tau), alpha)); return pow(sigma, 2) * exp(-pow(norm(tau), smoothing));
} }
double norm(const double *x) override { double norm(const double *x) override {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment