Commit 3b79f992 authored by niklas.baumgarten's avatar niklas.baumgarten
Browse files

adapted to no namespace std

parent 3a4f0ee1
......@@ -58,28 +58,28 @@ void CirculantEmbedding1D::generateCoarseSample(SampleID id,
l - 1, "CellData");
}
vector<complex<double>> CirculantEmbedding1D::generateField() {
vector<complex<double>> Xf_;
vector<complex<double>> normallyDistributed;
ComplexField1D CirculantEmbedding1D::generateField() {
ComplexField1D Xf;
ComplexField1D normallyDistributed;
normallyDistributed.resize(numberOfCellsEmbedded);
fineComplexField.clear();
Xf_.resize(numberOfCellsEmbedded);
Xf.resize(numberOfCellsEmbedded);
double z1, z2;
for (int i = 0; i < numberOfCellsEmbedded; i++) {
rnmg->get_normal_rn(z1, z2);
normallyDistributed[i] = {z1, z2};
}
vector<complex<double>> product;
ComplexField1D product;
product.resize(numberOfCellsEmbedded);
for (int i = 0; i < numberOfCellsEmbedded; i++) {
product[i] = sqrtEigenvalues[i] * normallyDistributed[i];
}
fft(product, Xf_);
fft(product, Xf);
double divisor = sqrt(numberOfCellsEmbedded);
for (int i = 0; i < numberOfCellsEmbedded; i++)
Xf_[i] /= divisor;
return Xf_;
Xf[i] /= divisor;
return Xf;
}
void CirculantEmbedding1D::createCovarianceMatrix(
......@@ -211,23 +211,23 @@ void CirculantEmbedding2D::generateCoarseSample(SampleID id,
1, l - 1, "CellData");
}
vector<vector<complex<double>>> CirculantEmbedding2D::generateField() {
vector<vector<complex<double>>> Xf_;
vector<vector<complex<double>>> Z;
ComplexField2D CirculantEmbedding2D::generateField() {
ComplexField2D Xf;
ComplexField2D Z;
Z.resize(numberOfCellsEmbedded[1]);
fineComplexField.clear();
Xf_.resize(numberOfCellsEmbedded[1]);
Xf.resize(numberOfCellsEmbedded[1]);
double z1, z2;
for (int i = 0; i < numberOfCellsEmbedded[1]; i++) {
Z[i].resize(numberOfCellsEmbedded[0]);
Xf_[i].resize(numberOfCellsEmbedded[0]);
Xf[i].resize(numberOfCellsEmbedded[0]);
for (int j = 0; j < numberOfCellsEmbedded[0]; j++) {
rnmg->get_normal_rn(z1, z2);
Z[i][j] = {z1, z2};
}
}
vector<vector<complex<double>>> product;
ComplexField2D product;
product.resize(numberOfCellsEmbedded[1]);
for (int i = 0; i < numberOfCellsEmbedded[1]; i++) {
product[i].resize(numberOfCellsEmbedded[0]);
......@@ -235,12 +235,12 @@ vector<vector<complex<double>>> CirculantEmbedding2D::generateField() {
product[i][j] = sqrtEigenvalues[i][j] * Z[i][j];
}
}
fft2(product, Xf_);
fft2(product, Xf);
double divisor = sqrt(numberOfCellsEmbedded[0] * numberOfCellsEmbedded[1]);
for (int i = 0; i < numberOfCellsEmbedded[0]; i++)
for (int j = 0; j < numberOfCellsEmbedded[1]; j++)
Xf_[i][j] /= divisor;
return Xf_;
Xf[i][j] /= divisor;
return Xf;
}
void CirculantEmbedding2D::createCovarianceMatrix(vector<vector<double>> &ar,
......
......@@ -8,6 +8,11 @@
#include "SampleGenerator.hpp"
typedef std::vector<std::complex<double>> ComplexField1D;
typedef std::vector<std::vector<std::complex<double>>> ComplexField2D;
class CirculantEmbedding : public SampleGenerator<Vector> {
protected:
int internalCounter = 0;
......@@ -32,7 +37,7 @@ public:
class CirculantEmbedding1D : public CirculantEmbedding, public CovarianceFunction1D {
public:
vector<complex<double>> fineComplexField;
ComplexField1D fineComplexField;
vector<double> sqrtEigenvalues;
int numberOfCellsEmbedded = 0;
int numberOfCells = 0;
......@@ -56,7 +61,7 @@ public:
Vector *&coarseSample) override;
private:
vector<complex<double>> generateField();
ComplexField1D generateField();
void createCovarianceMatrix(vector<double> &ar, vector<double> &ac);
......@@ -91,7 +96,7 @@ public:
Vector *&coarseSample) override;
private:
vector<vector<complex<double>>> fineComplexField;
ComplexField2D fineComplexField;
vector<vector<double>> sqrtEigenvalues;
int numberOfCellsEmbedded[2] = {0, 0};
int numberOfCells[2] = {0, 0};
......@@ -101,7 +106,7 @@ private:
double domain2_start = 0;
double domain2_end = 1;
vector<vector<complex<double>>> generateField();
ComplexField2D generateField();
void createCovarianceMatrix(vector<vector<double>> &ar, vector<vector<double>> &ac);
......
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