#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <map>
#include <cmath>
Go to the source code of this file.
|
template<typename T > |
void | linspace (double start, double stop, T *bin_edges, int n_bins) |
|
template<typename T > |
void | logspace (double start, double stop, T *bin_edges, int n_bins) |
|
template<typename T > |
int | search_bin_idx (T value, T *bin_edges, int n_bins) |
|
template<typename T > |
int | calc_bin_idx (T begin, T bin_width, T value) |
|
◆ calc_bin_idx()
template<typename T >
int calc_bin_idx |
( |
T | begin, |
|
|
T | bin_width, |
|
|
T | value ) |
|
inline |
Calculates for a linear axis the bin index for a particular value.
- Template Parameters
-
- Parameters
-
- Returns
◆ linspace()
template<typename T >
void linspace |
( |
double | start, |
|
|
double | stop, |
|
|
T * | bin_edges, |
|
|
int | n_bins ) |
|
inline |
◆ logspace()
template<typename T >
void logspace |
( |
double | start, |
|
|
double | stop, |
|
|
T * | bin_edges, |
|
|
int | n_bins ) |
|
inline |
◆ search_bin_idx()
template<typename T >
int search_bin_idx |
( |
T | value, |
|
|
T * | bin_edges, |
|
|
int | n_bins ) |
|
inline |
Searches for the bin index of a value within a list of bin edges
If a value is inside the bounds find the bin. The search partitions the bin_edges in upper and lower ranges and adapts the edge for the upper and lower range depending if the target value is bigger or smaller than the bin in the middle.
- Template Parameters
-
- Parameters
-
- Returns
- negative value if the search value is out of the bounds. Otherwise the bin number is returned.