1#ifndef SCRAN_BLOCKS_BLOCK_WEIGHTS_HPP
2#define SCRAN_BLOCKS_BLOCK_WEIGHTS_HPP
8#include "sanisizer/sanisizer.hpp"
96template<
typename Size_,
typename Weight_>
98 if (policy == WeightPolicy::NONE || policy == WeightPolicy::SIZE) {
99 std::copy_n(sizes, num_blocks, weights);
100 }
else if (policy == WeightPolicy::EQUAL) {
101 for (
decltype(I(num_blocks)) s = 0; s < num_blocks; ++s) {
102 weights[s] = sizes[s] > 0;
105 for (
decltype(I(num_blocks)) s = 0; s < num_blocks; ++s) {
123template<
typename Weight_ =
double,
typename Size_>
125 auto output = sanisizer::create<std::vector<Weight_> >(sizes.size());
126 compute_weights(sizes.size(), sizes.data(), policy, variable, output.data());
Blocking utilities for libscran.
Definition average_vectors.hpp:20
void compute_weights(const std::size_t num_blocks, const Size_ *const sizes, const WeightPolicy policy, const VariableWeightParameters &variable, Weight_ *const weights)
Definition block_weights.hpp:97
double compute_variable_weight(const double s, const VariableWeightParameters ¶ms)
Definition block_weights.hpp:67
WeightPolicy
Definition block_weights.hpp:31
Parameters for compute_variable_weight().
Definition block_weights.hpp:36
double lower_bound
Definition block_weights.hpp:41
double upper_bound
Definition block_weights.hpp:47