hmpdf
One- and two-point PDFs within the halo model.
hmpdf_covariance.h File Reference
#include "hmpdf_object.h"

Functions

int hmpdf_get_cov (hmpdf_obj *d, int Nbins, double binedges[Nbins+1], double cov[Nbins *Nbins], int noisy)
 
int hmpdf_get_cov_diagnostics (hmpdf_obj *d, int *Nphi, double **phi, double **phiweights, double **corr_diagn)
 

Function Documentation

◆ hmpdf_get_cov()

int hmpdf_get_cov ( hmpdf_obj d,
int  Nbins,
double  binedges[Nbins+1],
double  cov[Nbins *Nbins],
int  noisy 
)

Returns the covariance matrix of the one-point PDF.

Parameters
[in,out]dhmpdf_init() must have been called on d
[in]Nbinsnumber of bins the covariance matrix will be binned into
[in]binedgesmonotonically increasing array of length Nbins+1
[out]covthe binned covariance matrix will be written into the first Nbins*Nbins elements of this output array
[in]noisyif set to non-zero, the covariance matrix will include Gaussian noise with power spectrum hmpdf_noise_pwr.
Returns
error code
Remarks
If the covariance matrix has already been computed and since then no hmpdf_init() has been called on d, the pre-computed result is used and only the binning is performed.
If hmpdf_verbosity is set to a positive value, status updates with estimated remaining time will be given during execution.
The covariance matrix is normalized for a hypothetical all-sky survey. You will have to divide by your sky coverage fsky to get the correct one on your specific application.

◆ hmpdf_get_cov_diagnostics()

int hmpdf_get_cov_diagnostics ( hmpdf_obj d,
int *  Nphi,
double **  phi,
double **  phiweights,
double **  corr_diagn 
)

Returns diagnostic outputs for the covariance matrix computation. The main use of this function is to identify numerical instability at small pixel separations.

Parameters
[in,out]dhmpdf_init() must have been called on d
[out]Nphithe number of pixel separations will be written into the return value
[out]phipointer will be set to an array of length Nphi, containing the pixel separations used internally (in radians)
[out]phiweightspointer will be set to an array of length Nphi, containing the weights assigned to each pixel separation in the summation. This can occasionally be used to tune the hmpdf_pixelexact_max option.
[out]corr_diagnpointer will be set to an array of length Nphi, containing the correlation function at the pixel separation sample points. Noisy behaviour at small phi is a sign of numerical instability.
Returns
error code
Remarks
the values in the phi-array are not ordered
you can pass NULL for any of the arguments (apart from the first of course), if you are not interested in that specific output
if the covariance matrix has not already been computed [hmpdf_get_cov() has not been called before], this function will do it
while the code does perform the memory allocation for phi, phiweights, and corr_diagn (so that the user does not have to figure out Nphi beforehand), the user is responsible for freeing these arrays, i.e. to call
free(*phi); free(*phiweights); free(*corr_diagn);
after use.