onod3000/include/onod3000.h

39 lines
1.3 KiB
C
Raw Normal View History

2025-08-27 21:40:35 +03:00
#pragma once
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
// Returns true on success. Writes three doubles: obs, z, p
bool onod_run(const char* test,
const uint8_t* samples,
size_t len,
double* result /* length >= 3 */);
// Health score of a sample. NaN marks values that are not available.
typedef struct {
double p_combined; // calibrated p-value of all tests combined
double score; // -log10(p_combined), capped at 12; < 2 pass, < 4 suspect
int verdict; // 0 pass, 1 suspect, 2 fail, 3 insufficient data (< 256 bytes)
int weakest; // index of the test with the lowest calibrated p, -1 if none
double depth_bits; // log2 of the bits in the longest passing prefix
bool depth_complete;// true if every prefix up to the whole sample passed
double p_cal[15]; // calibrated p-value per test, NaN if skipped
} OnodScore;
// Returns true on success. With depth, also computes the survival depth (up to 2x slower).
bool onod_score(const uint8_t* samples,
size_t len,
bool depth,
OnodScore* result);
// Name of test index 0..14 as used in OnodScore.p_cal, NULL past the last one.
const char* onod_test_name(size_t index);
2025-08-27 21:40:35 +03:00
#ifdef __cplusplus
}
#endif