28 const std::vector<OutType>
values = this->computeBootstrapEstimates(data, is_distributed);
31 std::vector<OutType> output;
32 if (this->processor_id() == 0)
33 for (
const Real & level : this->_levels)
35 long unsigned int index = std::lrint(level * (this->_replicates - 1));
36 output.push_back(
values[index]);
48 const std::vector<OutType>
values = this->computeBootstrapEstimates(data, is_distributed);
51 const OutType value = this->_calc.compute(data, is_distributed);
52 const Real
count = std::count_if(
55 [&value](Real
v) { return v < value; });
59 const OutType acc = data.empty() ? OutType() : acceleration(data, is_distributed);
62 std::vector<OutType> output;
63 for (
const Real & level : this->_levels)
66 const Real
x = bias + (bias + (bias + z) / (1 - acc * (bias + z)));
69 long unsigned int index = std::lrint(alpha * (this->_replicates - 1));
70 output.push_back(
values[index]);
78 const bool is_distributed)
80 const std::size_t local_size = data.size();
81 std::vector<std::size_t> local_sizes = {local_size};
83 this->_communicator.allgather(local_sizes);
84 const std::size_t
count = std::accumulate(local_sizes.begin(), local_sizes.end(), 0);
85 const processor_id_type rank = is_distributed ? this->processor_id() : 0;
88 std::vector<OutType> theta_i(local_size);
91 for (processor_id_type r = 0; r < local_sizes.size(); ++r)
92 for (std::size_t i = 0; i < local_sizes[r]; ++i)
94 this->_calc.initializeCalculator();
95 for (std::size_t il = 0; il < local_size; ++il)
96 if (i != il || r != rank)
97 this->_calc.updateCalculator(data[il]);
98 this->_calc.finalizeCalculator(is_distributed);
100 theta_i[i] = this->_calc.getValue();
104 OutType theta_dot = std::accumulate(theta_i.begin(), theta_i.end(), OutType());
106 this->_communicator.sum(theta_dot);
110 std::vector<OutType> num_den(2);
111 for (
const auto & jk : theta_i)
117 this->_communicator.sum(num_den);
119 mooseAssert(num_den[1] != OutType(),
"The acceleration denomenator must not be zero.");
120 return num_den[0] / (6 * std::pow(num_den[1], 3. / 2.));
128 const std::vector<Real> & levels,
129 unsigned int replicates,
133 std::unique_ptr<BootstrapCalculator<InType, OutType>> ptr =
nullptr;
134 if (item ==
"percentile")
136 std::make_unique<Percentile<InType, OutType>>(other, item, levels, replicates, seed, calc);
137 else if (item ==
"bca")
138 ptr = std::make_unique<BiasCorrectedAccelerated<InType, OutType>>(
139 other, item, levels, replicates, seed, calc);
142 ::mooseError(
"Failed to create Statistics::BootstrapCalculator object for ", item);