43 lines
No EOL
982 B
C++
43 lines
No EOL
982 B
C++
#include <utk/utils/PointsetIO.hpp>
|
|
#include <utk/utils/Pointset.hpp>
|
|
#include <utk/samplers/SamplerStep.hpp>
|
|
#include <utk/metrics/RadialSpectrum.hpp>
|
|
|
|
#define DIMENSION 1025
|
|
#define NSAMPLES 4096
|
|
|
|
int main()
|
|
{
|
|
utk::Pointset<long double> points;
|
|
|
|
//sample points using heck
|
|
utk::SamplerStep sampler{
|
|
0.606,
|
|
8,
|
|
};
|
|
|
|
std::cout << "generating samples…" << std::endl;
|
|
|
|
if(sampler.generateSamples(points, NSAMPLES))
|
|
{
|
|
std::cout << "computing spectrum…" << std::endl;
|
|
auto result = utk::Spectrum{DIMENSION, true}.compute(points);
|
|
|
|
std::ofstream pointFile;
|
|
pointFile.open("points.txt");
|
|
pointFile << NSAMPLES << std::endl;
|
|
|
|
write_text_pointset("points.txt", points);
|
|
|
|
std::ofstream file;
|
|
file.open("spectrum.txt");
|
|
|
|
file << DIMENSION << std::endl;
|
|
|
|
for(auto freq : result)
|
|
{
|
|
file << std::setprecision(std::numeric_limits<long double>::digits10 + 2) << std::fixed;
|
|
file << freq << std::endl;
|
|
}
|
|
}
|
|
} |