quantiles: add function to get minimum k
This commit is contained in:
parent
bb2d68ddf9
commit
df80274644
3 changed files with 11 additions and 0 deletions
|
@ -185,6 +185,14 @@ QNT_Accumulate(QNT_Instance inst, double value)
|
||||||
|
|
||||||
/* ================================================== */
|
/* ================================================== */
|
||||||
|
|
||||||
|
int
|
||||||
|
QNT_GetMinK(QNT_Instance inst)
|
||||||
|
{
|
||||||
|
return inst->min_k;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ================================================== */
|
||||||
|
|
||||||
double
|
double
|
||||||
QNT_GetQuantile(QNT_Instance inst, int k)
|
QNT_GetQuantile(QNT_Instance inst, int k)
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,6 +35,7 @@ extern void QNT_DestroyInstance(QNT_Instance inst);
|
||||||
|
|
||||||
extern void QNT_Reset(QNT_Instance inst);
|
extern void QNT_Reset(QNT_Instance inst);
|
||||||
extern void QNT_Accumulate(QNT_Instance inst, double value);
|
extern void QNT_Accumulate(QNT_Instance inst, double value);
|
||||||
|
extern int QNT_GetMinK(QNT_Instance inst);
|
||||||
extern double QNT_GetQuantile(QNT_Instance inst, int k);
|
extern double QNT_GetQuantile(QNT_Instance inst, int k);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -42,6 +42,8 @@ test_unit(void)
|
||||||
|
|
||||||
inst = QNT_CreateInstance(min_k, max_k, q, r, 1e-9);
|
inst = QNT_CreateInstance(min_k, max_k, q, r, 1e-9);
|
||||||
|
|
||||||
|
TEST_CHECK(min_k == QNT_GetMinK(inst));
|
||||||
|
|
||||||
for (j = 0; j < 3000; j++) {
|
for (j = 0; j < 3000; j++) {
|
||||||
x = TST_GetRandomDouble(0.0, 2e-6);
|
x = TST_GetRandomDouble(0.0, 2e-6);
|
||||||
QNT_Accumulate(inst, x);
|
QNT_Accumulate(inst, x);
|
||||||
|
|
Loading…
Reference in a new issue