#include <string>
#include <vector>
std::vector<std::vector<size_t>> getDirectNeighbours(size_t res) {
size_t geodim = res;
std::vector<std::vector<size_t>> vec = std::vector<std::vector<size_t>>();
for (
size_t i = 0;
i < geodim;
i++) {
for (
size_t j = 0;
j < geodim-1;
j++) {
std::vector<size_t> xdir = std::vector<size_t>();
xdir.push_back(
i*geodim+
j);
xdir.push_back(
i*geodim+
j+1);
vec.push_back(xdir);
}
}
for (
size_t i = 0;
i < geodim-1;
i++) {
for (
size_t j = 0;
j < geodim;
j++) {
std::vector<size_t> ydir = std::vector<size_t>();
ydir.push_back(
i*geodim+
j);
ydir.push_back((
i+1)*geodim+
j);
vec.push_back(ydir);
}
}
for (
size_t i = 0;
i < geodim*geodim;
i++) {
std::vector<size_t>
tmp = std::vector<size_t>();
vec.push_back(tmp);
}
std::vector<size_t> empty = std::vector<size_t>();
vec.push_back(empty);
return vec;
}
std::vector<std::vector<size_t>> getConvs(size_t res) {
size_t geodim = res;
std::vector<std::vector<size_t>> vec = std::vector<std::vector<size_t>>();
for (
size_t i = 0;
i < geodim-1;
i+=2) {
for (
size_t j = 0;
j < geodim-1;
j+=2) {
std::vector<size_t> xdir1 = std::vector<size_t>();
std::vector<size_t> xdir2 = std::vector<size_t>();
std::vector<size_t> ydir1 = std::vector<size_t>();
std::vector<size_t> ydir2 = std::vector<size_t>();
xdir1.push_back(
i*geodim+
j);
ydir1.push_back(
i*geodim+
j);
xdir1.push_back(
i*geodim+
j+1);
ydir2.push_back(
i*geodim+
j+1);
xdir2.push_back((
i+1)*geodim+
j);
ydir1.push_back((
i+1)*geodim+
j);
xdir2.push_back((
i+1)*geodim+
j+1);
ydir2.push_back((
i+1)*geodim+
j+1);
vec.push_back(xdir1);
vec.push_back(xdir2);
vec.push_back(ydir1);
vec.push_back(ydir2);
}
}
for (
size_t i = 0;
i < geodim*geodim;
i++) {
std::vector<size_t> tmp = std::vector<size_t>();
vec.push_back(tmp);
}
std::vector<size_t> empty = std::vector<size_t>();
vec.push_back(empty);
return vec;
}
int lvl = 3;
for (size_t res = 28; res <= 28; res+=2) {
std::string
filename =
"mats/" + std::to_string(res) +
"x" + std::to_string(res)
+ "_ModLin_NN_Inter_lvl"+std::to_string(lvl)+"_Chol.out";
std::cout << "Setting up " << filename << std::endl;
std::cout << "# create grid config" << std::endl;
gridConfig.
dim_ = res*res;
std::cout << "# create regularization config" << std::endl;
regularizationConfig.
lambda_ = 0.01;
std::string decompType;
decompType = "Cholesky decomposition";
std::cout << "Decomposition type: " << decompType << std::endl;
std::cout << "# create adaptive refinement configuration" << std::endl;
std::string refMonitor;
refMonitor = "periodic";
std::cout << "Refinement monitor: " << refMonitor << std::endl;
std::string refType;
refType = "zero";
std::cout << "Refinement type: " << refType << std::endl;
std::unique_ptr<sgpp::base::Grid>
grid;
grid =
} else {
return 1;
}
adaptConfig,
regularizationConfig,
densityEstimationConfig);
std::cout << "Building Matrix..." << std::endl;
offline->
buildMatrix(grid.get(), regularizationConfig);
std::cout << "Matrix build.\nBegin decomposition..." << std::endl;
offline->
store(filename);
}
}