Skip to content

Commit

Permalink
Merge pull request #21 from matthewkirby/master
Browse files Browse the repository at this point in the history
(alleged) gcc 4.8 compatibility - remove initialization from inside for loop expression
  • Loading branch information
tmcclintock committed Jul 31, 2019
2 parents e7a5b90 + ee5352d commit f3afeda
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/C_averaging.c
Expand Up @@ -52,7 +52,8 @@ int average_profile_in_bins(double*Redges, int Nedges, double*R, int NR,
F.function = &ave_integrand;

//Loop over bins and compute the average
for(int i = 0; i < Nedges-1; i++){
int i;
for(i = 0; i < Nedges-1; i++){
gsl_integration_qag(&F, log(Redges[i]), log(Redges[i+1]), ABSERR, RELERR,
workspace_size, 6, ws, &result, &err);
ave_profile[i] = 2*result/(Redges[i+1]*Redges[i+1]-Redges[i]*Redges[i]);
Expand Down
7 changes: 4 additions & 3 deletions src/C_sigma_reconstruction.c
Expand Up @@ -35,12 +35,13 @@ int Sigma_REC_from_DeltaSigma(double dlnR, double*DeltaSigma, int N,
1/2s on the edges and 1s in the middle)
*/
//Loop over Sigma elements; i.e. rows
for(int i = 0; i < N-1; i++){
int i, j;
for(i = 0; i < N-1; i++){
Sigma[i] = -DeltaSigma[i]; //Not sure if this is positive or negative

//Loop over DeltaSigma elements; i.e. columns
//for(int j = N-2-i; j < N; j++){
for(int j = i; j < N; j++){
//for(j = N-2-i; j < N; j++){
for(j = i; j < N; j++){
Sigma[i] -= 2*dlnR*DeltaSigma[j];
//Downweight the first and last contributions (midpoint formula)
//if ((j == N-2-i) || (j == N-1)){
Expand Down

0 comments on commit f3afeda

Please sign in to comment.