13 namespace SigmaTransform {
21 std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now();
22 double diff = std::chrono::duration_cast<std::chrono::microseconds>(end-
_tic).count();
23 std::cout << std::fixed << std::showpoint << std::setw(60) << std::setfill(
'.') << std::setprecision(2)
24 << (diff?diff:1000.0)/1000.0 <<
" ms elapsed \r["<<str<<
"]\n"<<std::flush;
36 std::ifstream is(filename);
38 throw std::runtime_error(
"Error opening File.");
43 return std::move( out );
47 cxVec
loadAscii2D( std::string
const& filename ,
int &x ,
int &y ) {
54 std::ifstream is(filename);
56 throw std::runtime_error(
"Error opening File.");
59 while( std::getline(is, line,
'\n') ) {
62 std::stringstream ss(line);
70 return std::move( out );
75 std::ofstream( filename , std::ios::binary ).write((
char*)out.data(),
sizeof(double)*2*out.size());
79 std::vector<double>
linspace(
const double &L ,
const double &R ,
const int &N ) {
80 std::vector<double> out(N);
81 double delta = (R-L) / (N-1);
83 for(
auto &val : out ) {
91 std::vector<double>
FourierAxis(
const double &fs ,
const unsigned &len ) {
92 std::vector<double> domain =
linspace( 0 , fs , len );
93 double offset = fs + domain[1];
94 std::for_each( domain.begin() + ceil( len / 2 ) , domain.end() , [&](
double& x){ x -= offset; } );
99 void StartRecursiveLoop(
const std::vector<int>& max , std::function<
void(
const std::vector<int>&)> toDo ) {
100 std::vector<int> index; index.resize( max.size() , 0 );
105 void recursiveLoop( std::vector<int> &index,
const std::vector<int>& max ,
const int& curr_ind ,
106 std::function<
void(
const std::vector<int>&)> toDo ) {
107 for( index[curr_ind] = 0 ; index[curr_ind] < max[curr_ind] ; ++index[curr_ind] ) {