1#ifndef SCRAN_BLOCKS_BLOCK_WEIGHTS_HPP
2#define SCRAN_BLOCKS_BLOCK_WEIGHTS_HPP
8#include "sanisizer/sanisizer.hpp"
89template<
typename Size_,
typename Weight_>
91 if (policy == WeightPolicy::NONE) {
92 std::copy_n(sizes, num_blocks, weights);
93 }
else if (policy == WeightPolicy::EQUAL) {
94 for (
decltype(num_blocks) s = 0; s < num_blocks; ++s) {
95 weights[s] = sizes[s] > 0;
98 for (
decltype(num_blocks) s = 0; s < num_blocks; ++s) {
116template<
typename Weight_ =
double,
typename Size_>
118 auto output = sanisizer::create<std::vector<Weight_> >(sizes.size());
119 compute_weights(sizes.size(), sizes.data(), policy, variable, output.data());
Blocking utilities for libscran.
Definition average_vectors.hpp:18
double compute_variable_weight(double s, const VariableWeightParameters ¶ms)
Definition block_weights.hpp:63
void compute_weights(std::size_t num_blocks, const Size_ *sizes, WeightPolicy policy, const VariableWeightParameters &variable, Weight_ *weights)
Definition block_weights.hpp:90
WeightPolicy
Definition block_weights.hpp:28
Parameters for compute_variable_weight().
Definition block_weights.hpp:33
double lower_bound
Definition block_weights.hpp:38
double upper_bound
Definition block_weights.hpp:44