// // Created by dominik on 8/14/24. // #include #include #include #include "ranges.h" std::vector arange(const int size, const double spacing=1.) { std::vector out(size); std::generate(out.begin(), out.end(), [n = 0, spacing]() mutable { return n++ * spacing; }); return out; } std::vector linspace(const double start, const double stop, const int steps) { std::vector range; if (steps == 0) { return range; } if (steps == 1) { range.push_back(start); return range; } const double stepsize = (stop-start) / (steps-1); for (int i=0; i logspace(const double start, const double stop, const int steps) { std::vector range; if (steps == 0) { return range; } if (steps == 1) { range.push_back(start); return range; } const double logstart = std::log10(start); const double logstop = std::log10(stop); const double stepsize = (logstop-logstart) / (steps-1); for (int i=0; i