13template<
typename Functor>
15 const int resolution,
const float from,
const float to, Functor functor,
vector<float> &cdf)
17 const int cdf_count = resolution + 1;
19 cdf.resize(cdf_count);
22 for (
int i = 0; i < resolution; ++i) {
23 float x =
from +
range * (float)i / (resolution - 1);
25 cdf[i + 1] = cdf[i] +
fabsf(
y);
28 const float fac = (cdf[resolution] == 0.0f) ? 0.0f : 1.0f / cdf[resolution];
29 for (
int i = 0; i <= resolution; i++) {
32 cdf[resolution] = 1.0f;
40 const bool make_symmetric,
44template<
typename Functor>
49 const bool make_symmetric,
#define CCL_NAMESPACE_END
CCL_NAMESPACE_BEGIN void util_cdf_evaluate(const int resolution, const float from, const float to, Functor functor, vector< float > &cdf)
void util_cdf_invert(const int resolution, const float from, const float to, const vector< float > &cdf, const bool make_symmetric, vector< float > &inv_cdf)
void util_cdf_inverted(const int resolution, const float from, const float to, Functor functor, const bool make_symmetric, vector< float > &inv_cdf)