12 #include "libmesh/int_range.h" 21 computeSTD(
const std::vector<Real> & data,
const unsigned int & start_index)
23 if (data.size() < start_index)
29 std::accumulate(data.begin() + start_index,
32 [&mean](
Real x,
Real y) {
return x + (
y - mean) * (
y - mean); });
33 return std::sqrt(sq_diff / (data.size() - start_index));
38 computeMean(
const std::vector<Real> & data,
const unsigned int & start_index)
40 if (data.size() < start_index)
43 return std::accumulate(data.begin() + start_index, data.end(), 0.0) /
44 (data.size() - start_index);
47 std::vector<std::vector<Real>>
48 sortInput(
const std::vector<std::vector<Real>> & inputs,
49 const std::vector<Real> & outputs,
50 const unsigned int samplessub,
51 const Real subset_prob)
53 std::vector<size_t> ind;
56 std::vector<std::vector<Real>>
out(inputs.size(), std::vector<Real>(samplessub * subset_prob));
57 const size_t offset = std::ceil(samplessub * (1 - subset_prob));
60 out[
j][i] = inputs[
j][ind[i + offset]];
66 sortOutput(
const std::vector<Real> & outputs,
const unsigned int samplessub,
const Real subset_prob)
68 std::vector<size_t> ind;
71 std::vector<Real>
out(samplessub * subset_prob);
72 const size_t offset = std::round(samplessub * (1 - subset_prob));
74 out[i] = outputs[ind[i + offset]];
82 return *std::min_element(data.begin(), data.end());
88 std::vector<Real> data_abs(data.size());
89 for (
unsigned int i = 0; i < data.size(); ++i)
90 data_abs[i] = std::abs(data[i]);
97 unsigned int req_index = 0;
98 for (
unsigned int i = 0; i < weights.size(); ++i)
100 if (rnd < weights[i])
unsigned int weightedResample(const std::vector< Real > &weights, Real rnd)
return a resampled vector from a population given a weight vector.
std::vector< Real > computeVectorABS(const std::vector< Real > &data)
return the absolute values in a vector.
void indirectSort(RandomAccessIterator beg, RandomAccessIterator end, std::vector< size_t > &b)
const std::vector< double > y
Real computeMean(const std::vector< Real > &data, const unsigned int &start_index)
compute the mean of a data vector by only considering values from a specific index.
Real computeMin(const std::vector< Real > &data)
return the minimum value in a vector.
const std::vector< double > x
Real computeSTD(const std::vector< Real > &data, const unsigned int &start_index)
compute the standard deviation of a data vector by only considering values from a specific index...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
std::vector< std::vector< Real > > sortInput(const std::vector< std::vector< Real >> &inputs, const std::vector< Real > &outputs, const unsigned int samplessub, const Real subset_prob)
return input values corresponding to the largest po percentile output values.
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
auto index_range(const T &sizable)
std::vector< Real > sortOutput(const std::vector< Real > &outputs, const unsigned int samplessub, const Real subset_prob)
return the largest po percentile output values.