#include<stdio.h>
#include <gsl/gsl_matrix.h>

 int main()
{
  int i=0,j=0,k=1; 
 
  int count1=0, count2=0, count3=0, count4=0,count5=0, count6=0, count7=0, count8=0,count9=0;
  int sum=0;
  gsl_matrix *s =gsl_matrix_alloc(205,1920);
 
  /* read the file in*/
  FILE *fp;
  fp =fopen("newcode reantt.dat","r");
  gsl_matrix_fscanf (fp,s);
  fclose(fp);
 
  FILE *f;
  f =fopen("adj ant my.tab.dat","w");

	/*declare the storage*/

 
  for (j=0;j<1919;j++){
	
		 	   	printf("%d\n",j);
	
				 for(k=j+1;k<=j+1;k++)  
				 {
							printf("%d\n",k);
						  if (k !=j && k>j)
					   
						  {

   					for (i=0;i<205;i++)
	
					{  
	
   
		if((gsl_matrix_get(s,i,j)==1) && (gsl_matrix_get(s,i,k)==1))
			count1 =count1+1;
      
		if((gsl_matrix_get(s,i,j)==1) && (gsl_matrix_get(s,i,k)==2))
        	count2 =count2+1;
   
	   if((gsl_matrix_get(s,i,j)==1) && (gsl_matrix_get(s,i,k)==3))
			count3 =count3+1;
      
	   if((gsl_matrix_get(s,i,j)==2) && (gsl_matrix_get(s,i,k)== 1))
			count4 =count4+1;
      
	   if((gsl_matrix_get(s,i,j)==2) && (gsl_matrix_get(s,i,k)==2))
        	count5 =count5+1;
   
	   if((gsl_matrix_get(s,i,j)==2) && (gsl_matrix_get(s,i,k)==3))
			count6=count6+1;
       if((gsl_matrix_get(s,i,j)==3) && (gsl_matrix_get(s,i,k)== 1))
			count7 =count7+1;
      
		if((gsl_matrix_get(s,i,j)==3) && (gsl_matrix_get(s,i,k)==2))
        	count8 =count8+1;
   
	   if((gsl_matrix_get(s,i,j)==3) && (gsl_matrix_get(s,i,k)==3))
			count9 =count9+1;
   		 
					}
							 }
  				
	sum=count1+count2+count3+count4+count5+count6+count7+count8+count9;
  
	fprintf(f," %d %d %d %d %d %d %d %d %d %d\n", count1, count2, count3, count4,count5,count6, count7, count8, count9,sum);
  	
	count1=0, count2=0, count3=0, count4=0,count5=0, count6=0, count7=0, count8=0,count9=0;	   
 
						  }
		}
 
			return(0);
			fclose(f);
}
 

	

 



