Skip to content
Snippets Groups Projects
Commit 78dad0a2 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

rm 2 unused util fcts

parent 27fe7526
No related branches found
No related tags found
1 merge request!2006restore coverage tool, and remove some unused code
......@@ -13,42 +13,6 @@
// ************************************************************************************************
#include "Base/Util/VectorUtil.h"
#include <cmath>
#include <stdexcept>
bool VectorUtil::is_equidistant(const std::vector<double>& vec, double tol)
{
double span = vec.back() - vec.front();
if (span == 0.) {
for (std::size_t i = 1; i < vec.size() - 1; ++i)
if (vec[i] != vec.front())
return false;
return true;
}
double step = span / vec.size();
for (std::size_t i = 1; i < vec.size() - 1; ++i)
if (fabs(vec[i]) - (vec.front() + i * step) > tol * step)
return false;
return true;
}
std::vector<double> VectorUtil::make_grid(std::size_t n, double first, double last)
{
std::vector<double> result;
result.reserve(n);
if (n == 1) {
if (first != last)
throw std::runtime_error("Cannot make grid of size 1 unless first == last");
result.push_back(first);
return result;
}
for (std::size_t i = 0; i < n; ++i)
result.push_back(first + i * (last - first) / (n - 1));
return result;
}
std::vector<double> VectorUtil::real(const std::vector<complex_t>& v)
{
......
......@@ -20,11 +20,6 @@
namespace VectorUtil {
//! Returns true if vector is equidistant within tol * bin_width.
bool is_equidistant(const std::vector<double>& vec, double tol);
std::vector<double> make_grid(std::size_t n, double first, double last);
//! Returns vector of real parts.
std::vector<double> real(const std::vector<complex_t>& v);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment