Skip to content

Commit

Permalink
Moved iteration variable initialization outside of the for loops to a…
Browse files Browse the repository at this point in the history
…llow for gcc-4.8 compatability
  • Loading branch information
matthewkirby committed Jul 31, 2019
1 parent e7a5b90 commit ee5352d
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 ee5352d

Please sign in to comment.