亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? compression11.cpp

?? 對流數據的壓縮
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
// compression11.cpp : Defines the entry point for the console application.
//


//**************************PROGRAM***********************


#include "stdafx.h"
#include "iostream.h"
#include "stdio.h"
#include "math.h"


//function pronouncement

void patternfmat(char *,char *,int,int,int);

int compgraphset(char *,int *,int,int);
int maxcliquegreedy(FILE *,int *,int *,int,int);
int comppatdelete(char *,int *,int,int,int);
int rowcompalg(FILE *,char *,int,int);//first compression

void matrixoutput(FILE *,char *,int,int);

void distgraphset(char *,int *,int,int);
void patternsort(char *,char *,int *,int,int);
void firstpattern(char *,char *,int,int);
int maxdistfind(char *,char *,int,int);
int log2upl(int);
int positioncao(FILE *,char *,char *,int,int,int,int);
int positionmarkalg(FILE *,FILE *,char *,int,int);//second compression




//***********************main function*************************


int main(int argc, char* argv[])
{

	char sourcename[35];       //filename for input
	char destinationname[35];  //filename for output(related information)
	char resultname[35];       //filename for result
    int width = 0;             //the width of test patterns
    int number = 0;            //the number of test patterns
    int m=0;                   //the number of the scan chains
	int l=0;                   //the length of the subvectors
    int wfmp=0;                //the width of the formatted test data
	int tm=0;                  //the number of the vectors in the array in which the compatible patterns have been deleted
	int nw=0;                  //the width of the new test patterns
	int total;                 //the size of the compressed test set
	int i,j;
	FILE *fpp,*fp,*fr;         //the point of the input file and the output file


//open the file

    cout << "Filename input:";
    cin >> sourcename;
	fpp=fopen(sourcename,"r");
	if (!fpp)
	{
		cout << sourcename << " could not be opened" << endl;
		return 1;
	} 
	
    cout << "Filename output:";
    cin >> destinationname;
    fp=fopen(destinationname,"w");
    if (!fp)
    {
	     cout<< destinationname << "not created" << endl;
         return 1;
	}

	cout << "Filename for result:";
    cin >> resultname;
    fr=fopen(resultname,"w");
    if (!fr)
    {
	     cout<< resultname << "not created" << endl;
         return 1;
	}
 
	
//read the width and the number of the patterns

	fscanf(fpp,"%d", &width);
    if (width==0)
    {
         cout << "no patterns!";
         return 1;
    }
    fscanf(fpp,"%d", &number);
	fprintf(fp,"%s","the width and number of test patterns : ");
    fprintf(fp,"%d ",width);
	fprintf(fp,"%d\n",number);
	fprintf(fp,"%s\n","");

	
//read and output the number of the scan chains

    cout << "please input the number of the scan chains m(<width):";
    cin >> m;
    fprintf(fp,"%s","the number of the scan chains m:");
    fprintf(fp,"%d\n",m);
	fprintf(fp,"%s\n","");


//calculate l and wfmp

    if ( width%m==0 )    	l=width/m;
    else            		l=width/m+1;
    wfmp=number*l;



    char *patterns=new char[width*number];  //the heap for the original patterns
                                            //many times we use the heap as two dimensions array
    char *ptemp;                            //the point of the array patterns
	char *fmatpat=new char[wfmp*m];         //the heap for the formatted test data
	char *tfmat=new char[wfmp*m];           //temp fmatpat
    ptemp=patterns;

   
//read the original patterns

    while(!feof(fpp))
    {
	    fscanf(fpp,"%c",ptemp);
        if(*ptemp!='\n') ptemp++;
    }
    fclose(fpp);
  

//first compression

	patternfmat(patterns,fmatpat,width,number,m);
    tm=rowcompalg(fp,fmatpat,wfmp,m);
    fprintf(fp,"%s ","the number of the vectors after the compatible vectors have been deleted:");
    fprintf(fp,"%d\n",tm);
    fprintf(fp,"%s\n","");


//rearrange the array fmatpat to tfmat(nw,number)

    for ( i=0;i<wfmp;i++ )
	    for ( j=0;j<tm;j++ )
		    tfmat[i*tm+j]=fmatpat[j*wfmp+i];

    nw=tm*l;        //the width of the tfmat,and also the length of the CSR
    fprintf(fp,"%s ","the length of the CSR (the width of the new patterns): ");
    fprintf(fp,"%d\n",nw);
    fprintf(fp,"%s\n","");
/*	fprintf(fp,"%s\n","the rearranged fmatpat:");
    matrixoutput(fp,tfmat,nw,number);*/

   
//second compression.process the new patterns and output the result using position-mark method
	
	total=positionmarkalg(fp,fr,tfmat,nw,number);
	delete[]tfmat;
	total=total+nw;
	fprintf(fp,"%s","the total size of the compressed test set: ");
	fprintf(fp,"%d\n",total);
    

//close the file

    fclose(fp);
	fclose(fr);

	return 0;


}



//**********************function patternfmat********************


//this function formats the test patterns according to the number of scan chains m
//the formatting details refer to lilei's dictionary-based test data compression
//the meaning of the function's parameters as follows:
//      patterns--the test patterns will be formatted
//      fmatpat--the heap room used to save the formatted test patterns
//      width,number--the width and the number of the patterns
//      m--the number of the scan chains


void patternfmat(char *patterns,char *fmatpat,int width,int number,int m)
{

	int i,j,k,p,l,t=0;
	int flag=0;  //here the flag show whether need or not to pad the don't care in the end.if flag=1,it means needing    
    int wfmp=0;  //the width of the fmatpat

	if ( width%m==0 )    l=width/m;
    else
	{
		l=width/m+1;
		flag=1;
	}
    wfmp=number*l;

	p=width/l;
	if ( flag==0 )
	{
		 for ( i=0;i<number;i++ )
		 {
			  for ( j=0;j<m;j++ )
			      for ( k=0;k<l;k++ )
				  {
			            fmatpat[j*wfmp+(k+i*l)]=patterns[t];
			            t++;
				  }
		 }
	}
	else
	{
		for ( i=0;i<number;i++ )
		{
		    for ( j=0;j<p;j++ )
		        for ( k=0;k<l;k++ )
				{
			         fmatpat[j*wfmp+(k+i*l)]=patterns[t];
			         t++;
				}
		    for ( k=0;k<(width-p*l);k++ )
			{
			    fmatpat[j*wfmp+(k+i*l)]=patterns[t];
			    t++;
			}
		    for ( k=(width-p*l);k<l;k++ )
			    fmatpat[j*wfmp+(k+i*l)]='-';
		    for ( j=p+1;j<m;j++ ) //do while width%m>l
			    for ( k=0;k<l;k++ )
					fmatpat[j*wfmp+(k+i*l)]='-';
		}
	}
}




//********************function compgraphset*********************


//this function sets up the compatible graph G of the test patterns
//if the two patterns are compatible,the corresponding position in the graph G equals 1;otherwise 0.
//we think the pattern is not compatible to itself
//the meaning of the function's parameters as follows:
//      patterns--the test patterns will be set up the compatible graph G
//      graphg--the heap room used to save the compatible graph G
//      width,number--the width and the number of the patterns
//this function will return the number of 1 in the graph G


int compgraphset(char *patterns,int *graphg,int width,int number)
{

	int i,j,k,flag;
    int total=0;
	
	for ( i=0;i<number;i++ )
    {
		for ( j=0;j<number;j++ )
		{
			flag=0;//the flag of the compatible;if flag=1;it means the patterns are not compatible
		    k=0;
		    while ( k<width )
			{
			    if ((patterns[i*width+k]!='-')&&(patterns[j*width+k]!='-'))
				{
				    if (patterns[i*width+k]==patterns[j*width+k])  k++;
				    else
					{
					    graphg[i*number+j]=0;
					    flag=1;
					    break;
					}
				}
			    else k++;
			}
		    if ((flag==0)&&(i!=j))
			{
			    graphg[i*number+j]=1;
			    total++;//the total number of the compatible relationship
			}
		    if (i==j) graphg[i*number+j]=0;
		}
	}

	return total;
}




//*******************function maxcliquegreedy********************


//this fuction is the greedy algorithm to find the maximal clique in graph G.

//the first cycle is used to confirm the group of compatible vectors(clique).
//cycle one time comfirms a group of compatible vectors
//here we will output the positions of the compatible vectors(the positions of the shanchu lines)
//the meaning of the function's parameters as follows:
//      f--the point of the file to output the position value
//      graphg--the graph G show the compatible relationship
//      rcomp--a heap room to save compatible mark of every pattern
//      n--the number of the vertices in graph G
//      total--the number of 1 in the graph G
//this function will return the number of the cliques

   
int maxcliquegreedy(FILE *f,int *graphg,int *rcomp,int n,int total)
{

   int *scl=new int[n];   //the temp array used to save the original position value
   int *tscl=new int[n];  //the temp array usd to save the changed position value
   int *gg=new int[n*n];  //G'
   int *tgg=new int[n*n]; //temp G'
   int *ncomp=new int[n]; //the degree of every vertex 
   int i,j,t,t1,t2,tmax,flag,pgg1,pgg2;

   if(gg==NULL)       cout<<"allocate error1"<<endl;
   if(tgg==NULL)      cout<<"allocate error2"<<endl;

   fprintf(f,"%s\n","the positions of the shanchu lines:");

   flag=0;//count the number of the groups(cliques)   
   while(total!=0)
   {
	   for ( i=0;i<(n*n);i++ )
	       gg[i]=graphg[i];
           pgg2=n;
	   for ( i=0;i<n;i++ )
	       scl[i]=i;
	   flag++;
	   do
	   {
            for ( i=0;i<pgg2;i++ )
				ncomp[i]=0;
			for ( i=0;i<pgg2;i++ )
				for ( j=0;j<pgg2;j++ )
				{
					if( gg[i*pgg2+j]==1)
						ncomp[i]++;
				}
		    t2=ncomp[0];
            tmax=0;
            for( t1=1;t1<pgg2;t1++ )
			{
	            if( t2<ncomp[t1] )
				{
		            t2=ncomp[t1];
		            tmax=t1;
				}
			}
			t=scl[tmax];            //the position of the vector in graphg
			fprintf(f,"%d ",t);     //output the position of the shanchu line
			rcomp[t]=flag;          //the compatible vectors have the same value in the corresponding positions in the array rcomp.this can be used later.
			for ( i=0;i<n;i++ )
			{
				if(graphg[i*n+t]==1)
				{
					graphg[i*n+t]=0;
					total--;
				}
				if(graphg[t*n+i]==1)
				{
					graphg[t*n+i]=0;
					total--;
				}
			}
			pgg1=pgg2;
			pgg2=0;
			for ( i=0;i<pgg1;i++ )
			{
				if( gg[tmax*pgg1+i]==1 )
				{
					tscl[pgg2]=i;
					pgg2++;
				}
			}
			for ( i=0;i<pgg2;i++ )
			{
				t1=tscl[i];
				scl[i]=scl[t1];      //t1 increases progressively
				for ( j=0;j<pgg2;j++ )
				{
					t2=tscl[j];
					tgg[i*pgg2+j]=gg[t1*pgg1+t2];
				}
					
			}
			for ( i=0;i<(pgg2*pgg2);i++ )
					gg[i]=tgg[i];			

	   }while(pgg2!=0);
	   
	   fprintf(f,"%s\n","");
   }
   fprintf(f,"%s\n","");

   delete[]gg;
   delete[]tgg;
   delete[]ncomp;
   delete[]scl;
   delete[]tscl;

   return flag;
}




//********************function comppatdelete*******************


//this fuction will delete the compatible vectors in the test patterns according to the rcomp

//first the compatible vectors belong to same clique will be resave to the heap(array) tfmat in order to process easily
//then we will specify the bits that can be specified in a clique
//and rewrite the specified vector to the first appeared position in the original array 
//and char 2 is rewited to the first cells of the other patterns
//at last,scan the array.if the first cell of the vector in array is char 2,delete this vector

//the meaning of the function's parameters as follows:
//      patterns--the test patterns will be processed
//      rcomp--compatible mark array(as above)
//      width,number--the width and the number of the patterns
//      n--the number of the cliques
//this function will return the number of the patterns in which the compatible ones have been deleted.


int comppatdelete(char *patterns,int *rcomp,int width,int number,int n)
{

	int i,j,k,t,t1;
	char *temp1=new char[width*number];   
	int *temp2=new int[number];

	for ( i=1;i<=n;i++ )
    {
	    t=0;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩精品免费专区| 国产精品一级在线| 国产日韩欧美精品一区| 色婷婷久久久综合中文字幕| 日韩av中文在线观看| 中文字幕日本乱码精品影院| 69成人精品免费视频| av中文字幕不卡| 国内精品免费**视频| 五月天一区二区| 国产精品久久久久久亚洲毛片 | 亚洲欧美综合在线精品| 欧美一级欧美三级在线观看 | 粗大黑人巨茎大战欧美成人| 日韩黄色免费电影| 日韩毛片在线免费观看| 久久精品在线免费观看| 欧美日韩成人在线一区| 在线免费观看日韩欧美| 国产成人av影院| 国产一区二区免费看| 久久综合综合久久综合| 亚洲在线中文字幕| 亚洲欧美偷拍三级| 国产欧美一区二区精品忘忧草| 欧美一三区三区四区免费在线看| 91影视在线播放| 不卡视频在线观看| 成人污视频在线观看| 国产精品中文字幕日韩精品 | 激情综合色综合久久综合| 爽爽淫人综合网网站| 亚洲国产sm捆绑调教视频| 亚洲精品一二三区| 亚洲欧美二区三区| 亚洲精品日产精品乱码不卡| 中文字幕一区二区三区色视频| 久久久久久久久久久久久久久99| 久久在线观看免费| 久久综合久久99| 国产区在线观看成人精品| 久久久精品欧美丰满| 久久香蕉国产线看观看99| 久久久www成人免费毛片麻豆| 2020国产精品自拍| 久久精子c满五个校花| 国产欧美精品一区二区色综合| 精品福利二区三区| 精品成人免费观看| 国产拍欧美日韩视频二区| 中文字幕av一区二区三区高| 国产精品欧美一级免费| 亚洲人123区| 天天影视色香欲综合网老头| 天天综合日日夜夜精品| 国内国产精品久久| 成人aa视频在线观看| 99国产精品久| 欧美日韩在线免费视频| 6080国产精品一区二区| 欧美v日韩v国产v| 国产欧美精品国产国产专区| 亚洲欧洲日韩在线| 亚洲一区二区三区四区不卡| 免费观看久久久4p| 岛国一区二区在线观看| 91精品福利在线| 欧美成人伊人久久综合网| 久久久国际精品| 一区二区成人在线观看| 美国欧美日韩国产在线播放| 成人国产精品免费网站| 欧美精三区欧美精三区| 国产亚洲一区二区三区在线观看| 亚洲视频一区二区免费在线观看| 亚洲午夜久久久久久久久电影院| 青青草一区二区三区| 成人深夜在线观看| 精品视频在线看| 精品国产免费视频| 亚洲三级电影全部在线观看高清| 日韩精品成人一区二区在线| 国产成人免费高清| 欧美日韩成人综合| 欧美激情在线免费观看| 亚洲gay无套男同| 成人美女在线视频| 欧美一区二区三区啪啪| 国产精品色婷婷久久58| 日韩高清不卡一区| 99精品欧美一区二区蜜桃免费| 91精品国产综合久久福利软件| 国产精品丝袜一区| 日本sm残虐另类| 色哟哟国产精品| 国产亚洲福利社区一区| 日韩激情视频网站| 色综合久久66| 久久久亚洲欧洲日产国码αv| 亚洲午夜av在线| 成人的网站免费观看| 精品久久国产字幕高潮| 亚洲一区二区三区中文字幕| 国产成人免费9x9x人网站视频| 欧美日本在线看| 亚洲欧美色综合| 岛国精品一区二区| 精品国精品自拍自在线| 偷偷要91色婷婷| 色8久久精品久久久久久蜜| 国产欧美一区二区三区鸳鸯浴| 日韩高清在线观看| 欧美日韩三级视频| 亚洲精品视频在线观看免费| 国产91在线观看| 久久久噜噜噜久久中文字幕色伊伊| 丝袜亚洲另类欧美| 精品视频在线看| 亚洲午夜三级在线| 在线影院国内精品| 亚洲日本欧美天堂| 波多野洁衣一区| 欧美激情综合在线| 国产精品1区2区3区在线观看| 日韩欧美一区二区三区在线| 亚洲国产综合91精品麻豆| 9人人澡人人爽人人精品| 国产亚洲欧美在线| 国产·精品毛片| 中文字幕第一区第二区| 国产成人综合视频| 国产精品美女久久久久久2018| 国产毛片精品国产一区二区三区| 日韩免费高清电影| 国产综合成人久久大片91| 久久这里只精品最新地址| 国产麻豆日韩欧美久久| 久久久久久免费网| 成人免费的视频| 亚洲欧洲日产国产综合网| 成人aaaa免费全部观看| 亚洲人成网站影音先锋播放| 色综合久久九月婷婷色综合| 亚洲欧美日韩在线不卡| 在线亚洲+欧美+日本专区| 樱桃视频在线观看一区| 欧美无砖砖区免费| 日韩不卡一二三区| 精品福利二区三区| www.亚洲在线| 一区二区三区四区在线免费观看| 在线国产电影不卡| 日本一不卡视频| 久久亚洲二区三区| 99久久99久久精品国产片果冻| 亚洲男人的天堂网| 在线播放欧美女士性生活| 麻豆成人久久精品二区三区红| 精品福利av导航| 91在线免费播放| 天天影视涩香欲综合网| 久久一区二区视频| 一本一道综合狠狠老| 日日夜夜免费精品| 久久久久久久久99精品| 97久久精品人人做人人爽50路| 亚洲一区二区三区四区在线| 欧美一区二区美女| 国产成人久久精品77777最新版本| 亚洲丝袜美腿综合| 欧美一区二区三区免费观看视频 | 欧美男同性恋视频网站| 精品无人码麻豆乱码1区2区| 中文字幕一区二区在线播放 | 26uuu亚洲综合色| gogogo免费视频观看亚洲一| 午夜精品一区二区三区免费视频 | 欧美视频在线播放| 精品一区二区三区的国产在线播放| 国产精品色在线观看| 7777精品伊人久久久大香线蕉的 | 亚洲美女视频在线观看| 日韩精品在线看片z| 9l国产精品久久久久麻豆| 丝瓜av网站精品一区二区| 中文一区在线播放| 91精品国产综合久久久蜜臀图片| 国产精品一区二区在线看| 亚洲超碰精品一区二区| 欧美经典一区二区| 91精品国产91久久久久久最新毛片 | 国产三级一区二区| 欧美日韩国产天堂| 不卡一区二区中文字幕| 美女视频黄 久久| 一区二区三区鲁丝不卡| 欧美激情一区二区在线| 日韩一级完整毛片| 欧美在线视频不卡| 成人av电影观看|