<commit_before>/*
	Author <NAME> & <NAME>
	{kardac, "<EMAIL>"}<EMAIL>
	
	A sequential Jacobi iteration program
*/
 #include <stdlib.h>
 #include <stdio.h>
 
 #define GRIDSIZE 10
 #define NUMITERS 10
 
 int main(int argc, char *argv[]){
 
	/*gridSize, the grid size not including boundaries
	  numIters, the number of iterations to use
	 */
	
	int gridSize, numIters, i, j, k;
	float temp, maxdiff;
	/*Andreas! I interpret the grid size as the length of the side.
	  Otherwise we have to take the sqrt of it to get the sides when
	  malloc'ing, change it if you see it fitting. :) */
	gridSize = (argc > 1)? atoi(argv[1]) + 2 : GRIDSIZE;
	numIters = (argc > 2)? atoi(argv[2]) : NUMITERS;
	
	printf("gridSize: %d\n", gridSize);
	printf("numIters: %d\n", numIters);
	
	/*malloc the columns*/
	float **grid = (float **) malloc(gridSize * sizeof(float*));
	float **new = (float **) malloc(gridSize * sizeof(float*));
	/*malloc the rows*/
	for(i = 0; i < gridSize; i++){
		grid[i] = (float *) malloc(gridSize * sizeof(float));
		new[i] = (float *) malloc(gridSize * sizeof(float));
	}
	/*Initiation of grid boundary */
	/*Hörnen initieras 2 gånger. Går säkert att göra bättre men just nu känns det
	  inte värt*/
	for(i = 0; i < gridSize; i++){
		grid[0][i] = 1;				// upper boundary
		new[0][i] =1;
		grid[gridSize-1][i] = 1;	// lower boundary
		new[gridSize-1][i] = 1;
		grid[i][0] = 1; 			// left  boundary
		new[i][0] = 1;
		grid[i][gridSize-1] =1;		// right boundary
		new[i][gridSize-1] = 1;
	}
	/*Instantiation of grids */
	for(i = 1; i < gridSize-1; i++){
		for(j = 1; j < gridSize-1; j++){
			grid[i][j] = 0;
			//new[i][j] = 0; // behövs nog inte
		}	
	}
	
	/*Jacobi iterations*/
	/*Körde * 0.625 på andra iterationen istället för 2st * 0.25
	  fick annat resultat, måste gjort fel, låter vara såhär så länge*/
	for(k = 0; k < numIters; k++){
	
		for(i = 1; i < gridSize-1; i++){
			for(j = 1; j < gridSize-1; j++){
				new[i][j] = (grid[i-1][j] +
							 grid[i+1][j] +
							 grid[i][j-1] +
							 grid[i][j+1])* 0.25 ;
			}	
		}
		
		for(i = 1; i < gridSize-1; i++){
			for(j = 1; j < gridSize-1; j++){
				grid[i][j] = (new[i-1][j] +
							  new[i+1][j] +
							  new[i][j-1] +
							  new[i][j+1])* 0.25;
			}
		}
	}
	/*computes maximum difference*/
	maxdiff = 0;
	for(i = 1; i < gridSize-1; i++){
		for(j = 1; j < gridSize-1; j++){
			temp = grid[i][j] - new[i][j];
			if(temp < 0)
				temp = -temp;
			if(temp > maxdiff)
				maxdiff = temp;
		}
	}
	/*print the maximum difference*/
	printf("Maximum difference: %f\n", maxdiff);
	
	/*Prints the grid with boundary*/
	for(i = 0; i < gridSize; i++){
			printf("\n");
		for(j = 0; j < gridSize; j++){
			printf("%f  ", grid[i][j]);
		}	
	}
	printf("\n");
}
<commit_msg>double instead of float and removal of resolved comments<commit_after>/*
	Author <NAME> & <NAME>
	{<EMAIL>, <EMAIL>
	
	A sequential Jacobi iteration program
*/
 #include <stdlib.h>
 #include <stdio.h>
 
 #define GRIDSIZE 10
 #define NUMITERS 10
 
 int main(int argc, char *argv[]){
 
	/*gridSize, the grid size not including boundaries
	  numIters, the number of iterations to use
	 */
	
	int gridSize, numIters, i, j, k;
	double temp, maxdiff;
	
	gridSize = (argc > 1)? atoi(argv[1]) + 2 : GRIDSIZE;
	numIters = (argc > 2)? atoi(argv[2]) : NUMITERS;
	
	printf("gridSize: %d\n", gridSize);
	printf("numIters: %d\n", numIters);
	
	/*malloc the columns*/
	double **grid = (double **) malloc(gridSize * sizeof(double*));
	double **new = (double **) malloc(gridSize * sizeof(double*));
	/*malloc the rows*/
	for(i = 0; i < gridSize; i++){
		grid[i] = (double *) malloc(gridSize * sizeof(double));
		new[i] = (double *) malloc(gridSize * sizeof(double));
	}
	
	/*Initiation of grid boundary */
	for(i = 0; i < gridSize; i++){
		grid[0][i] = 1;				// upper boundary
		new[0][i] = 1;
		grid[gridSize-1][i] = 1;	// lower boundary
		new[gridSize-1][i] = 1;
		grid[i][0] = 1; 			// left  boundary
		new[i][0] = 1;
		grid[i][gridSize-1] = 1;	// right boundary
		new[i][gridSize-1] = 1;
	}
	
	/*Instantiation of grids */
	for(i = 1; i < gridSize-1; i++){
		for(j = 1; j < gridSize-1; j++){
			grid[i][j] = 0;
		}	
	}
	
	/*Jacobi iterations*/
	for(k = 0; k < numIters; k++) {
	
		for(i = 1; i < gridSize-1; i++) {
			for(j = 1; j < gridSize-1; j++) {
				new[i][j] = (grid[i-1][j] +
							 grid[i+1][j] +
							 grid[i][j-1] +
							 grid[i][j+1]) * 0.25;
			}
		}
		for(i = 1; i < gridSize-1; i++) {
			for(j = 1; j < gridSize-1; j++) {
				grid[i][j] = (new[i-1][j] +
							  new[i+1][j] +
							  new[i][j-1] +
							  new[i][j+1]) * 0.25;
			}
		}
	}
	
	/*computation of the maximum difference*/
	maxdiff = 0;
	for(i = 1; i < gridSize-1; i++){
		for(j = 1; j < gridSize-1; j++){
			temp = grid[i][j] - new[i][j];
			if(temp < 0)
				temp = -temp;
			if(temp > maxdiff)
				maxdiff = temp;
		}
	}
	/*print the maximum difference*/
	printf("Maximum difference: %f\n", maxdiff);
	
	/*Prints the grid with boundary*/
	for(i = 0; i < gridSize; i++){
			printf("\n");
		for(j = 0; j < gridSize; j++){
			printf("%f  ", grid[i][j]);
		}	
	}
	printf("\n");
	exit(0);
}

{'fraction_non_alphanumeric': 0.2047553546865789, 'fraction_numerical': 0.026920809589310278, 'mean_word_length': 2.809880239520958, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '858706', 'n_tokens_mistral': 2441, 'n_tokens_neox': 2081, 'n_words': 556}