How florents-tselai/pgxicor works
pgxicor is a PostgreSQL extension that exposes XI correlation as the xicor(X, Y) aggregate. The main workflow collects input pairs in aggregate state, converts the accumulated arrays into an XI problem, computes the score using sorted X ranks and Y ranks, and returns a float. Optional tie handling and reproducibility settings are configured through PostgreSQL variables. The score implementation and helper declarations share the two core source files; edges below follow visible calls, while PostgreSQL’s aggregate dispatch is documented in the README but its SQL registration was not sampled.
Main entry points: pgxicor.c Aggregate finalizer · pgxicor.h Input problem types
Components 8
Aggregate workflow
- State transition
src/pgxicor.c - Aggregate finalizer
src/pgxicor.c - XI settings
src/pgxicor.c
XI calculation
- Input problem types
src/pgxicor.h - Array input builder
src/pgxicor.c - XI score
src/pgxicor.c - Argsort helpers
src/pgxicor.c
Other components
- SQL caller
Connections 7
- SQL caller → State transition: aggregates pairs
README.md - State transition → Aggregate finalizer: returns state
src/pgxicor.c - Aggregate finalizer → XI settings: reads settings
src/pgxicor.c - Aggregate finalizer → Array input builder: builds problem
src/pgxicor.c - Array input builder → Input problem types: fills arrays
src/pgxicor.c - Aggregate finalizer → XI score: computes score
src/pgxicor.c - XI score → Argsort helpers: sorts X
src/pgxicor.c