From 2b141278c7751d00cd25bc787caf829560010a9a Mon Sep 17 00:00:00 2001 From: mtzikara Date: Fri, 14 Sep 2018 11:35:15 +0200 Subject: [PATCH] Update filterMARP.c --- filterMARP.c | 121 +++++++++++++-------------------------------------- 1 file changed, 30 insertions(+), 91 deletions(-) diff --git a/filterMARP.c b/filterMARP.c index aeba1b7..ea19112 100644 --- a/filterMARP.c +++ b/filterMARP.c @@ -1,6 +1,4 @@ - - //ALGORITHM 6 //p_1 is period 1, p_2 is period 2 in no. of iterations float** filterMARP(int** A, float* x, float e, int max_iterations, float a, int p_1, int p_2, int size){ @@ -42,7 +40,7 @@ float** filterMARP(int** A, float* x, float e, int max_iterations, float a, int if(count%p_1==0){ N = N_new; //might not be needed C = C_new; - detect_Converged(N_new, C_new, x_new, x, e); //sinthiki stin prwti selida toy prwtou kefalaiou + detect_Converged(N_new, C_new, x_new, x, e, size); //sinthiki stin prwti selida toy prwtou kefalaiou filterA(A, Ann, Acn, C_new, N_new, size); // y = compy(Acn, x, size);//Acn*x ; x_c = filterx(x_new, C, size); @@ -55,6 +53,22 @@ float** filterMARP(int** A, float* x, float e, int max_iterations, float a, int return x_new; } +void detect_Converged(int* N_new, int* C_new, float* x_new, float* x, float e, int size){ + int i; + for( i=0; i -#include - - -void main(){ - printf("Hello I am maria \n"); - - //Read from file of adjacency matrix - FILE *adjm; - - int x; - adjm = fopen("adj_matrix.txt", "r+"); - if(!adjm){ - printf("Error opening file \n"); - exit(0); - } - - //Read dimensions of file (square) - int m, count=0; - while((m=fgetc(adjm))) { - // break if end of file - if(m == EOF) break; - // otherwise add one to the count of that particular character - if(m=='\n'){ - count+=1; - } - } - printf("Line count of matrix is %d \n", count); - int d = count; - int i,j; - - // Put values in matrix A - int** A = malloc(d*sizeof(int *)); - for( i=0; i