Added possibility to do partial normalization

This commit is contained in:
Guilhem Lavaux 2015-02-24 14:48:08 +01:00
parent 535f25d710
commit b7392204ad
3 changed files with 10 additions and 6 deletions

View file

@ -262,12 +262,16 @@ double CosmoPower::integrandNormalize(double x)
return power(k)*k*k*f*f/(x*x);
}
void CosmoPower::normalize()
void CosmoPower::normalize(double k_max)
{
double normVal = 0;
double abserr;
gsl_integration_workspace *w = gsl_integration_workspace_alloc(NUM_ITERATION);
gsl_function f;
double x_min = 0;
if (k_max > 0)
x_min = 1/(1+k_max);
f.function = gslPowSpecNorm;
f.params = this;
@ -282,7 +286,7 @@ void CosmoPower::normalize()
}
// gsl_integration_qagiu(&f, 0, 0, TOLERANCE, NUM_ITERATION, w, &normVal, &abserr);
gsl_integration_qag(&f, 0, 1, 0, TOLERANCE, NUM_ITERATION, GSL_INTEG_GAUSS61, w, &normVal, &abserr);
gsl_integration_qag(&f, x_min, 1, 0, TOLERANCE, NUM_ITERATION, GSL_INTEG_GAUSS61, w, &normVal, &abserr);
gsl_integration_workspace_free(w);
normVal /= (2*M_PI*M_PI);

View file

@ -92,7 +92,7 @@ namespace CosmoTool {
void updateCosmology();
void updatePhysicalCosmology();
void normalize();
void normalize(double k_max = -1);
void setNormalization(double A_K);
void updateHuWigglesConsts();