Mercurial > hg > audiodb
view xthresh.c @ 496:8fb85fbcaba6 api-inversion
Mostly disentangle API from command-line binary.
Now audioDB.cpp doesn't need to be included in the library, because
nothing the library does creates an audioDB instance. Hooray. We can't
disentangle the other way, because there's still plenty in the
command-line binary that isn't implemented in terms of the API, so the
audioDB binary code needs to know naughty stuff about the library's
internals (e.g. what the file header looks like).
Remove liszt.o and sample.o from the library, even though they'll
probably make a reapparance soon (for scare-quoted values of "soon")
Remove cmdline.o and common.o from the library, not scheduled to make a
reapparence ever (hooray!). Separate out the bits that are used in the
library -- locks and PointPairs -- into their own files.
author | mas01cr |
---|---|
date | Sat, 10 Jan 2009 15:33:25 +0000 |
parents | 3be15407e814 |
children |
line wrap: on
line source
#include <gsl/gsl_sf.h> #include <stdio.h> #include <stdlib.h> #include <math.h> int main(int argc, char *argv[]) { if(argc != 4) { fprintf(stderr, "Wrong number of arguments: %d\n", argc); exit(1); } long int meanN = strtol(argv[1], NULL, 10); double d = strtod(argv[2], NULL); double sigma2 = strtod(argv[3], NULL); double logw = (2 / d) * gsl_sf_log(-gsl_sf_log(0.99)); double logxthresh = gsl_sf_log(sigma2) + logw - (2 / d) * gsl_sf_log(meanN) - gsl_sf_log(d/2) - (2 / d) * gsl_sf_log(2 / d) + (2 / d) * gsl_sf_lngamma(d / 2); printf("w: %f\n", exp(logw)); printf("x_thresh: %f\n", exp(logxthresh)); exit(0); }