float neuron::randomize(const float& Minimum,const float& Maximum) { random_device RandomDevice; //Initializes random engine mt19937 Generator(RandomDevice()); //Mersenne Twister 19937 generator, rng uniform_real_distribution<float> Distribution(Minimum, Maximum); //uniform probability distribution between Minimum and Maximum return Distribution(Generator); //Generate random weights }
int32 URandomEngine::GenerateRandomSeed() { std::random_device RandomDevice; std::uniform_int_distribution<int32> Distribution( std::numeric_limits<int32>::lowest(), std::numeric_limits<int32>::max()); return Distribution(RandomDevice); }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------ std::vector<int> GenerateLandingSpots( const int NumberOfLandingSpots, const int WindowWidth) { std::vector<int> LandingSpots; std::default_random_engine Generator( std::chrono::high_resolution_clock::now().time_since_epoch().count()); std::uniform_int_distribution<int> Distribution(0, WindowWidth - 8); auto Random = [&] { LandingSpots.emplace_back(Distribution(Generator)); }; for (int i = 0; i < NumberOfLandingSpots; ++i) { Random(); } return LandingSpots; }
void RandomGenerator::init() { typedef std::chrono::high_resolution_clock Clock; Clock::duration distance = Clock::now().time_since_epoch(); __initGenerator = Generator(distance.count()); __initDistrib = Distribution(0, distance.count()); }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------ sf::VertexArray GenerateLunarSurface( const unsigned WindowWidth, const unsigned WindowHeight) { sf::VertexArray Lines(sf::LinesStrip, 0); auto LandingSpots = GenerateLandingSpots(4, WindowWidth); std::default_random_engine Generator( std::chrono::high_resolution_clock::now().time_since_epoch().count()); std::uniform_int_distribution<int> Distribution(0, 1); auto Random = [&Generator, &Distribution] { return Distribution(Generator); }; auto InLandingSpot = [&LandingSpots] (const int Width) { return std::any_of( LandingSpots.begin(), LandingSpots.end(), [Width] (int Value) { return Width >= Value && Width < Value + 40;}); }; auto Height = WindowHeight * .75; for (auto Width = 0u; Width < WindowWidth; Width += 4) { if (!InLandingSpot(Width)) { if (Random()) { Height += 18; } else { Height -= 18; } if (Height <= 0) { Height = 1; } } Lines.append(sf::Vector2f(Width, Height)); } return Lines; }
CCMSDIntegrator::CCMSDIntegrator(void) : resources((std::vector<IObjectPtr>&) Resource().objects()), cells((std::vector<IObjectPtr>&) Cell().objects()), parts((std::vector<IObjectPtr>&) Part().objects()), processplans((std::vector<IObjectPtr>&) ProcessPlan().objects()), jobs((std::vector<IObjectPtr>&) Job().objects()), distributions((std::vector<IObjectPtr>&) Distribution().objects()), calendars((std::vector<IObjectPtr>&) Calendar().objects()), layouts((std::vector<IObjectPtr>&) Layout().objects()) { }
//Windows Firewall Test inline size_t __fastcall FirewallTest(uint16_t Protocol) { SYSTEM_SOCKET FirewallSocket = 0; sockaddr_storage SockAddr = {0}; //Ramdom number generator initialization std::random_device RamdomDevice; std::mt19937 RamdomEngine(RamdomDevice()); //Mersenne Twister Engine std::uniform_int_distribution<int> Distribution(1, U16_MAXNUM); auto RamdomGenerator = std::bind(Distribution, RamdomEngine); //Socket initialization if (Protocol == AF_INET6) //IPv6 { FirewallSocket = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP); SockAddr.ss_family = AF_INET6; ((PSOCKADDR_IN6)&SockAddr)->sin6_addr = in6addr_any; ((PSOCKADDR_IN6)&SockAddr)->sin6_port = htons((uint16_t)RamdomGenerator()); //Bind local socket. if (FirewallSocket == INVALID_SOCKET || bind(FirewallSocket, (PSOCKADDR)&SockAddr, sizeof(sockaddr_in6)) == SOCKET_ERROR) { closesocket(FirewallSocket); return EXIT_FAILURE; } } else { //IPv4 FirewallSocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); SockAddr.ss_family = AF_INET; ((PSOCKADDR_IN)&SockAddr)->sin_addr.S_un.S_addr = INADDR_ANY; ((PSOCKADDR_IN)&SockAddr)->sin_port = htons((uint16_t)RamdomGenerator()); //Bind local socket. if (FirewallSocket == INVALID_SOCKET || bind(FirewallSocket, (PSOCKADDR)&SockAddr, sizeof(sockaddr_in)) == SOCKET_ERROR) { closesocket(FirewallSocket); return EXIT_FAILURE; } } closesocket(FirewallSocket); return EXIT_SUCCESS; }
static size_t randomIndex(size_t Size) { assert(Size > 0); std::uniform_int_distribution<> Distribution(0, Size - 1); return Distribution(randomGenerator()); }
void InitializeDistribution(Output minimum, Output maximum) { distribution = Distribution(minimum, maximum); }
void InitializeDistribution() { distribution = Distribution(std::numeric_limits<Output>::min(), std::numeric_limits<Output>::max()); }
double GetRandomReal(double Min, double Max) { std::uniform_real_distribution<double> Distribution(Min, Max); return Distribution(RandomGenerator); }
uint64_t GetRandomInt(uint64_t Min, uint64_t Max) { std::uniform_int_distribution<uint64_t> Distribution(Min, Max); return Distribution(RandomGenerator); }
int GetRandomInt(int Min, int Max) { std::uniform_int_distribution<int> Distribution(Min, Max); return Distribution(RandomGenerator); }
void FNeuralNetLMBase::TrainLM(const string &validationfile, const string &outbase, bool nce_ppl) { // ============= // Prepare for the training // Equivalent to ReadLM word_vocab_.ReadVocabFromTxt(word_vocab_filename_); if (word_vocab_.empty()) { cerr << "empty word vocabulary!" << endl; exit(EXIT_FAILURE); } factor_vocab_.ReadVocabFromTxt(factor_vocab_filename_); if (factor_vocab_.empty()) { cerr << "empty factor vocabulary!" << endl; exit(EXIT_FAILURE); } ReadDecompFromTxt(decomp_filename_); PrintParams(); CheckParams(); AllocateModel(); InitializeNeuralNet(); // ==== END ==== // Read the data FNNLMDataReader train_data(train_filenames_, &word_vocab_, &factor_vocab_, shuffle_datafiles_, shuffle_sentences_); vector<string> validation_filenames = { validationfile }; FNNLMDataReader validation_data(validation_filenames, &word_vocab_, &factor_vocab_, false, false); // Set NCE sampling. if (nce_) { // TODO: flatten noise_distribution_? vector<int> word_count(word_vocab_.size(), 0); int num_word_tokens = 0; const size_t eos_widx = word_vocab().eos_idx(); vector<int> factor_count(factor_vocab_.size(), 0); int num_factor_tokens = 0; const size_t eos_fidx = factor_vocab().eos_idx(); vector<pair<size_t, vector<size_t>>> sentence; train_data.StartEpoch(); while(train_data.GetSentence(sentence)) { for (vector<pair<size_t, vector<size_t>>>::const_iterator it = sentence.begin(); it != sentence.end(); ++it) { word_count[it->first]++; num_word_tokens++; if (weight_factor_output_ > 0) { for (size_t p = 0; p < it->second.size(); p++) { factor_count[it->second[p]]++; num_factor_tokens++; } } } word_count[eos_widx]++; num_word_tokens++; if (weight_factor_output_ > 0) { factor_count[eos_fidx]++; num_factor_tokens++; } } word_noise_distribution_ = Distribution(word_count.begin(), word_count.end()); word_noise_pdf_ = word_noise_distribution_.param().probabilities(); if (weight_factor_output_ > 0) { factor_noise_distribution_ = Distribution(factor_count.begin(), factor_count.end()); factor_noise_pdf_ = factor_noise_distribution_.param().probabilities(); } NCECheckSampling(); log_num_negative_samples_ = log(num_negative_samples_); } BatchSGDTrain(train_data, validation_data, outbase, nce_ppl); cout << "================================================================================" << endl; cout << "Log-likelihood (base e) on validation is: " \ << EvalLM(validation_data, false) << endl; }
int main(int argc,char *argv[]) { char *listfile,*inputfile; char choose= ' '; string operate=" "; double temperature=300; string output=" "; string segment="all"; int segment_b=0; int segment_e=0; // 读取当前的时间 time_t t = time( 0 ); char TIME[64]; strftime( TIME, sizeof(TIME), "%Y/%m/%d %X ",localtime(&t) ); // switch(argc) { case 1: cout<<"Usage:CurAnalysis -f listfile.txt -i inputfile.txt"<<endl; exit(0); case 2: if(string(argv[1])=="-a") { Printversion(); exit(0); } if(string(argv[1])=="-h") { Printhelp(); exit(0); } case 5: if(string(argv[1])=="-f"&&string(argv[3])=="-i") { listfile=argv[2]; inputfile=argv[4]; } break; default: cout<<"Usage:CurAnalysis -f listfile.txt -i inputfile.txt"<<endl; exit(0); } ReadInput(inputfile,operate,choose,output,temperature,segment,segment_b,segment_e); /* average部分已经完成,经测试可以使用,主要的问题是读文件的异常 比如说文件残缺,文件丢失等的情况的处理的过程没有完成。 */ if(operate=="average") { if(choose=='E'||choose=='F'||choose=='G'||choose=='H') { double ***totaldata; struct Filelist *fl; struct Paramater *spt; int N=0; ofstream outfile(output.c_str(),ios::app); fl=Readlist(listfile); switch(choose) { case 'E': spt=E_part(fl->file); break; case 'F': spt=F_part(fl->file); break; case 'G': spt=G_part(fl->file); break; case 'H': spt=H_part(fl->file); break; } int filesize=Getfilelen(fl); int size=GetParamaterlen(spt); if(segment!="all") { size=segment_e - segment_b+1; } if(segment=="all") { segment_b=1; segment_e=size; } totaldata=f3tensor(0,5,0,size-1,0,filesize-1); outfile<<"******************************************************************"<<endl; //output the input file! ifstream infile(inputfile); string s; getline(infile,s); while(!infile.fail()) { outfile<<"#"<<s<<endl; getline(infile,s); } outfile<<TIME<<endl; //输出当前时间 infile.close(); // while(fl!=NULL) { struct Paramater *sp; switch(choose) { case 'E': sp=E_part(fl->file); break; case 'F': sp=F_part(fl->file); break; case 'G': sp=G_part(fl->file); break; case 'H': sp=H_part(fl->file); break; } // int size=GetParamaterlen(sp); double **data; data=dmatrix(0,5,0,size-1); struct Namelist *name; name=(struct Namelist *)malloc(sizeof(struct Namelist)); Paramater2double(sp,data,name,segment_b,segment_e); for(int i=0;i<6;i++) { for(int j=0;j<size;j++) { totaldata[i][j][N]=data[i][j]; } } free_dmatrix(data,0,5,0,size-1); cout<<"Read file "<<fl->file<<" finished!"<<endl;//输出提示 fl=fl->next; N++; } double **aveg; aveg=dmatrix(0,5,0,size-1); for(int i=0;i<6;i++) { for(int j=0;j<size;j++) { aveg[i][j]=0; } } outfile<<endl; outfile<<"******************************************************************"<<endl; outfile<<"\t"<<"rise"<<"\t"<<"roll"<<"\t"<<"shift"<<"\t"<<"slide"<<"\t"<<"tilt"<<"\t"<<"twist"<<endl; outfile<<endl; for(int i=0;i<size;i++) { outfile<<i+segment_b<<"\t"; for(int j=0;j<6;j++) { for(int k=0;k<filesize;k++) { aveg[j][i]+=totaldata[j][i][k]; } aveg[j][i]=aveg[j][i]/filesize; outfile<<fixed<<showpoint; outfile<<setprecision(2)<<aveg[j][i]<<"\t"; } outfile<<endl; } outfile<<endl; outfile<<"******************************************************************"<<endl; cout<<"finished the calculation of average !"<<endl; cout<<"the output write in the file "<<output<<" !"<<endl; outfile.close(); free_f3tensor(totaldata,0,5,0,size-1,0,filesize-1); } //average for J if(choose=='J') { double ***totaldata; struct Filelist *fl; struct Backbone *spt; int N=0; fl=Readlist(listfile); spt=J_part(fl->file); int filesize=Getfilelen(fl); int size=GetBackbonelen(spt); if(segment!="all") { size=segment_e - segment_b+1; } if(segment=="all") { segment_b=1; segment_e=size; } totaldata=f3tensor(0,13,0,size-1,0,filesize-1); ofstream outfile(output.c_str(),ios::app); outfile<<"******************************************************************"<<endl; //output the input file! ifstream infile(inputfile); string s; getline(infile,s); while(!infile.fail()) { outfile<<"#"<<s<<endl; getline(infile,s); } outfile<<TIME<<endl; //输出当前时间 infile.close(); // while(fl!=NULL) { struct Backbone *sp; sp=J_part(fl->file); // int size=GetBackbonelen(sp); double **data; data=dmatrix(0,13,0,size-1); struct Namelist *name; name=(struct Namelist *)malloc(sizeof(struct Namelist)); Backbone2double(sp,data,name,segment_b,segment_e); for(int i=0;i<14;i++) { for(int j=0;j<size;j++) { totaldata[i][j][N]=data[i][j]; } } free_dmatrix(data,0,13,0,size-1); cout<<"Read file "<<fl->file<<" finished!"<<endl;//输出提示 fl=fl->next; N++; } double **aveg; aveg=dmatrix(0,13,0,size-1); for(int i=0;i<14;i++) { for(int j=0;j<size;j++) { aveg[i][j]=0; } } outfile<<endl; outfile<<"******************************************************************"<<endl; outfile<<"\t"<<"alpha"<<"\t"<<"ampli"<<"\t"<<"beta"<<"\t"<<"c1"<<"\t"<<"c1c2"<<"\t"<<"c2"<<"\t"<<"c2c3"<<"\t"<<"c3"<<"\t"<<"chi"<<"\t"<<"delta"<<"\t"<<"epsil"<<"\t"<<"gamma"<<"\t"<<"phase"<<"\t"<<"zeta"<<endl; outfile<<endl; for(int i=0;i<size;i++) { outfile<<i+segment_b<<"\t"; for(int j=0;j<14;j++) { for(int k=0;k<filesize;k++) { aveg[j][i]+=totaldata[j][i][k]; } aveg[j][i]=aveg[j][i]/filesize; outfile<<fixed<<showpoint; outfile<<setprecision(2)<<aveg[j][i]<<"\t"; } outfile<<endl; } outfile<<endl; outfile<<"******************************************************************"<<endl; cout<<"finished the calculation of average !"<<endl; cout<<"the output write in the file "<<output<<" !"<<endl; outfile.close(); free_f3tensor(totaldata,0,13,0,size-1,0,filesize-1); } } //计算某一数据的分布 if(operate=="distribution") { //part 1: get the data if(choose=='E'||choose=='F'||choose=='G'||choose=='H') { double ***totaldata; struct Filelist *fl; struct Paramater *spt; int N=0; ofstream outfile(output.c_str(),ios::app); fl=Readlist(listfile); switch(choose) { case 'E': spt=E_part(fl->file); break; case 'F': spt=F_part(fl->file); break; case 'G': spt=G_part(fl->file); break; case 'H': spt=H_part(fl->file); break; } int filesize=Getfilelen(fl); int size=GetParamaterlen(spt); if(segment!="all") { size=segment_e - segment_b+1; } if(segment=="all") { segment_b=1; segment_e=size; } totaldata=f3tensor(0,5,0,size-1,0,filesize-1); outfile<<"******************************************************************"<<endl; //output the input file! ifstream infile(inputfile); string s; getline(infile,s); while(!infile.fail()) { outfile<<"#"<<s<<endl; getline(infile,s); } outfile<<TIME<<endl; //输出当前时间 infile.close(); // while(fl!=NULL) { struct Paramater *sp; switch(choose) { case 'E': sp=E_part(fl->file); break; case 'F': sp=F_part(fl->file); break; case 'G': sp=G_part(fl->file); break; case 'H': sp=H_part(fl->file); break; } // int size=GetParamaterlen(sp); double **data; data=dmatrix(0,5,0,size-1); struct Namelist *name; name=(struct Namelist *)malloc(sizeof(struct Namelist)); Paramater2double(sp,data,name,segment_b,segment_e); for(int i=0;i<6;i++) { for(int j=0;j<size;j++) { totaldata[i][j][N]=data[i][j]; } } free_dmatrix(data,0,5,0,size-1); cout<<"Read file "<<fl->file<<" finished!"<<endl;//输出提示 fl=fl->next; N++; } // finished the input data //calculate the distribution! double *vect; vect=dvector(0, size*filesize-1) ; for(int i=0;i<6;i++) { outfile<<"******************************************************************"<<endl; switch(i) { case 0: outfile<<"the distribution of RISE"<<endl; break; case 1: outfile<<"the distribution of ROLL"<<endl; break; case 2: outfile<<"the distribution of SHIFT"<<endl; break; case 3: outfile<<"the distribution of SLIDE"<<endl; break; case 4: outfile<<"the distribution of TILT"<<endl; break; case 5: outfile<<"the distribution of TWIST"<<endl; break; } outfile<<"******************************************************************"<<endl; // for(int m=0;m<size;m++) { for(int n=0;n<filesize;n++) { vect[m*filesize+n]=totaldata[i][m][n]; } } //把二维的数据转化为一维的数据! Distribution(vect,size*filesize,output); outfile<<"******************************************************************"<<endl; } cout<<"finished the calculation of distribution !"<<endl; cout<<"the output write in the file "<<output<<" !"<<endl; outfile.close(); free_f3tensor(totaldata,0,5,0,size-1,0,filesize-1); // finished the calculation ! } if(choose=='J') { double ***totaldata; struct Filelist *fl; struct Backbone *spt; int N=0; fl=Readlist(listfile); spt=J_part(fl->file); int filesize=Getfilelen(fl); int size=GetBackbonelen(spt); if(segment!="all") { size=segment_e - segment_b+1; } if(segment=="all") { segment_b=1; segment_e=size; } totaldata=f3tensor(0,13,0,size-1,0,filesize-1); ofstream outfile(output.c_str(),ios::app); outfile<<"******************************************************************"<<endl; //output the input file! ifstream infile(inputfile); string s; getline(infile,s); while(!infile.fail()) { outfile<<"#"<<s<<endl; getline(infile,s); } outfile<<TIME<<endl; //输出当前时间 infile.close(); // while(fl!=NULL) { struct Backbone *sp; sp=J_part(fl->file); // int size=GetBackbonelen(sp); double **data; data=dmatrix(0,13,0,size-1); struct Namelist *name; name=(struct Namelist *)malloc(sizeof(struct Namelist)); Backbone2double(sp,data,name,segment_b,segment_e); for(int i=0;i<14;i++) { for(int j=0;j<size;j++) { totaldata[i][j][N]=data[i][j]; } } free_dmatrix(data,0,13,0,size-1); cout<<"Read file "<<fl->file<<" finished!"<<endl;//输出提示 fl=fl->next; N++; } double *vect; vect=dvector(0, size*filesize-1) ; for(int i=0;i<14;i++) { outfile<<"******************************************************************"<<endl; switch(i) { case 0: outfile<<"the distribution of ALPHA"<<endl; break; case 1: outfile<<"the distribution of AMPLI"<<endl; break; case 2: outfile<<"the distribution of BETA"<<endl; break; case 3: outfile<<"the distribution of C1'"<<endl; break; case 4: outfile<<"the distribution of C1'-C2'"<<endl; break; case 5: outfile<<"the distribution of C2'"<<endl; break; case 6: outfile<<"the distribution of C2'-C3'"<<endl; break; case 7: outfile<<"the distribution of C3'"<<endl; break; case 8: outfile<<"the distribution of CHI"<<endl; break; case 9: outfile<<"the distribution of DELTA"<<endl; break; case 10: outfile<<"the distribution of ESPIL"<<endl; break; case 11: outfile<<"the distribution of GAMMA"<<endl; break; case 12: outfile<<"the distribution of PHASE"<<endl; break; case 13: outfile<<"the distribution of ZETA"<<endl; break; } outfile<<"******************************************************************"<<endl; // for(int m=0;m<size;m++) { for(int n=0;n<filesize;n++) { vect[m*filesize+n]=totaldata[i][m][n]; } } //把二维的数据转化为一维的数据! Distribution(vect,size*filesize,output); outfile<<"******************************************************************"<<endl; } cout<<"finished the calculation of distribution !"<<endl; cout<<"the output write in the file "<<output<<" !"<<endl; outfile.close(); free_f3tensor(totaldata,0,13,0,size-1,0,filesize-1); // finished the calculation ! } } /*计算刚性*/ if(operate=="stiffness") { /*get the data*/ if(choose=='E'||choose=='F'||choose=='G'||choose=='H') { double ***totaldata; struct Filelist *fl; struct Paramater *spt; int N=0; ofstream outfile(output.c_str(),ios::app); fl=Readlist(listfile); switch(choose) { case 'E': spt=E_part(fl->file); break; case 'F': spt=F_part(fl->file); break; case 'G': spt=G_part(fl->file); break; case 'H': spt=H_part(fl->file); break; } int filesize=Getfilelen(fl); int size=GetParamaterlen(spt); if(segment!="all") { size=segment_e - segment_b+1; } if(segment=="all") { segment_b=1; segment_e=size; } totaldata=f3tensor(0,5,0,size-1,0,filesize-1); outfile<<"******************************************************************"<<endl; //output the input file! ifstream infile(inputfile); string s; getline(infile,s); while(!infile.fail()) { outfile<<"#"<<s<<endl; getline(infile,s); } outfile<<TIME<<endl; //输出当前时间 infile.close(); // while(fl!=NULL) { struct Paramater *sp; switch(choose) { case 'E': sp=E_part(fl->file); break; case 'F': sp=F_part(fl->file); break; case 'G': sp=G_part(fl->file); break; case 'H': sp=H_part(fl->file); break; } // int size=GetParamaterlen(sp); double **data; data=dmatrix(0,5,0,size-1); struct Namelist *name; name=(struct Namelist *)malloc(sizeof(struct Namelist)); Paramater2double(sp,data,name,segment_b,segment_e); for(int i=0;i<6;i++) { for(int j=0;j<size;j++) { totaldata[i][j][N]=data[i][j]; } } free_dmatrix(data,0,5,0,size-1); cout<<"Read file "<<fl->file<<" finished!"<<endl;//输出提示 fl=fl->next; N++; } // finished the input data /*calculate the stiffness! */ double **stiff; double **matrix; double **inve_matrix; /*output the title */ outfile<<"******************************************************************"<<endl; outfile<<"calculate the stiffness of part "<<choose<<endl; outfile<<"******************************************************************"<<endl; for(int x=segment_b-1;x<segment_e;x++) /* the loop for segment */ { stiff=dmatrix(0,5,0, filesize-1) ; /* hold the space!*/ matrix=dmatrix(0,5,0,5); inve_matrix=dmatrix(0,5,0,5); for(int i=0;i<6;i++) { for(int n=0;n<filesize;n++) { stiff[i][n]=totaldata[i][x][n]; } } Getmatrix(stiff,matrix,filesize); /*cteate the helical matrix!*/ free_dmatrix(stiff,0,5,0,filesize-1); inverse_matrix(matrix, inve_matrix,6); free_dmatrix(matrix,0,5,0,5); outfile<<"the stiffness of segment "<<x+1<<endl; outfile<<"******************************************************************"<<endl; outfile<<"\t"<<"rise"<<"\t"<<"roll"<<"\t"<<"shift"<<"\t"<<"slide"<<"\t"<<"tilt"<<"\t"<<"twist"<<endl; outfile<<fixed<<showpoint; for(int i=0;i<6;i++) { switch(i) { case 0: outfile<<"rise"<<"\t"; break; case 1: outfile<<"roll"<<"\t"; break; case 2: outfile<<"shift"<<"\t"; break; case 3: outfile<<"slide"<<"\t"; break; case 4: outfile<<"tilt"<<"\t"; break; case 5: outfile<<"twist"<<"\t"; break; } for(int j=0;j<6;j++) { outfile<<setprecision(2)<<R*temperature*inve_matrix[i][j]<<"\t"; } outfile<<endl; } outfile<<"******************************************************************"<<endl; } cout<<"finished the calculation of stiffness !"<<endl; cout<<"the output write in the file "<<"\""<<output<<"\" !"<<endl; outfile.close(); free_f3tensor(totaldata,0,5,0,size-1,0,filesize-1); // finished the calculation ! } else { cout<<"wrong input, please check!"<<endl; exit(0); } } if(operate!="stiffness"&&operate!="average"&&operate!="distribution") { cout<<"Input a wrong operate. the correct oprtate is 'average/distribution/stiffness'"<<endl; exit(0); } return 0; }