Fast C++ implementation with caching for repeated df values. This can significantly speed up analyses where the same df values are used repeatedly (e.g., df=1,2,3 across thousands of genes).

getGFishercoef_cached_cpp(D, M, p_type)

Arguments

D

Vector of degrees of freedom for a GFisher statistic.

M

Correlation matrix of the input Z-scores.

p_type

String: "two" for two-sided, "one" for one-sided input p-values.

Value

A list of 4 vectors of integrals:

  • For two-sided: list(coeff2, coeff4, coeff6, coeff8)

  • For one-sided: list(coeff1, coeff2, coeff3, coeff4)

Details

This function provides cached computation of coefficients using the same integration routines as getGFishercoef_cpp but with an efficient caching layer at the individual coefficient level. When the same df value is requested multiple times, the cached result is returned immediately without recomputing expensive integrals. The cache has a size limit to prevent unbounded memory growth.

Cache efficiency: For genome-wide analyses where df values are reused across many tests, this caching can provide significant speedups by avoiding redundant numerical integration.