⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tools.cc

📁 一种聚类算法,名字是cocluster
💻 CC
📖 第 1 页 / 共 5 页
字号:
    cout << "  !!! Invalid # of run(s): " << *(argv+1) << " !!!" << endl << endl;    validCLA = false;  }  if (validCLA){    myCLA.numRun = atoi(*(++argv));    if (myCLA.numRun <= 0){      cout << " !!! Invalid # of run(s): " << myCLA.numRun << " !!!" << endl << endl;      validCLA = false;    }  }  if (!validCLA){    printRunNum();    myCLA.numInvalidCLA++;  }  return argv;}// get output file information from command-line...char **getOutputFileInformation(int argc, char **argv, commandLineArgument &myCLA){  bool validCLA = true;  char tempOutputFileType = toupper((*(++argv))[0]);  switch (tempOutputFileType){    case OUTPUT_COCLUSTER_FILE:      switch (toupper((*(++argv))[0])){        case BLOCK_OUT:          myCLA.coclusterLabelType = BLOCK_FORMAT;          break;        case SIMPLE_OUT:          myCLA.coclusterLabelType = SIMPLE_FORMAT;          break;        default:          cout << "  !!! Invalid cocluster label type: " << *argv << " !!!" << endl << endl;          validCLA = false;          break;      }       switch ((*(++argv))[0]){        case LABEL_FROM_0:          myCLA.coclusterOffsetType = START_FROM_0;          break;        case LABEL_FROM_1:          myCLA.coclusterOffsetType = START_FROM_1;          break;        default:          cout << "  !!! Invalid cocluster label offset type: " << *argv << " !!!" << endl << endl;          validCLA = false;          break;      }	      	            break;    case OUTPUT_OBJECTIVE_FILE:      break;    case OUTPUT_STATISTICS_FILE:        break;    default:      cout << "  !!! Invalid output file type: " << *argv << " !!!" << endl << endl;      validCLA = false;      break;  }  int tempFileAccessMode = 0;  if (validCLA){    switch (toupper((*(++argv))[0])){      case APPEND_OUT:        tempFileAccessMode = APPEND_MODE;        break;      case OUTPUT_OUT:        tempFileAccessMode = OUTPUT_MODE;        break;      default:        cout << "  !!! Invalid file access mode: " << *argv << " !!!" << endl << endl;        validCLA = false;        break;    }    switch (tempOutputFileType){      case OUTPUT_COCLUSTER_FILE:        myCLA.coclusterAccessMode = tempFileAccessMode;        break;      case OUTPUT_OBJECTIVE_FILE:        myCLA.objectiveAccessMode = tempFileAccessMode;        break;      case OUTPUT_STATISTICS_FILE:        myCLA.statisticsAccessMode = tempFileAccessMode;        break;      default:        validCLA = false;        break;    }  }  if (validCLA && (*(argv+1) == NULL)){    cout << "  !!! Invalid output filename: (output filename should be specified.) !!!" << endl << endl;    validCLA = false;  }  if (validCLA && (isdigit((*(argv+1))[0]) || ((*(argv+1))[0] == '-'))){    cout << "  !!! Invalid output filename: " << *(argv+1) << " !!!" << endl << endl;    validCLA = false;  }  if (validCLA){    switch (tempOutputFileType){      case OUTPUT_COCLUSTER_FILE:        strcpy(myCLA.coclusterFilename, *(++argv));        break;      case OUTPUT_OBJECTIVE_FILE:        strcpy(myCLA.objectiveFilename, *(++argv));        break;      case OUTPUT_STATISTICS_FILE:        strcpy(myCLA.statisticsFilename, *(++argv));        break;      default:        validCLA = false;	break;    }  }  if (!validCLA){    printOutputLabelType();    myCLA.numInvalidCLA++;  }  return argv;}// get number of row clusters from command-line...char **getRowClusterNum(int argc, char **argv, commandLineArgument &myCLA){  bool validCLA = true;  if (*(argv+1) == NULL){    cout << "  !!! Invalid # of row cluster(s): (# of row cluster(s) should be specified.) !!!" << endl << endl;    validCLA = false;  }  if (validCLA && !isdigit((*(argv+1))[0])){    cout << "  !!! Invalid # of row cluster(s): " << *(argv+1) << " !!!" << endl << endl;    validCLA = false;  }  int tempNum = atoi(*(argv+1));  if (tempNum <= 0){    cout << "  !!! Invalid # of row clusters(s): (# of row clsuter(s) should be a positive integer.): " << tempNum << " !!!" << endl;    validCLA = false;  }  if (validCLA)    myCLA.numRowCluster = atoi(*(++argv));  if (!validCLA){    printRowClusterNum();    myCLA.numInvalidCLA++;  }  return argv;}// get seeding (i.e., initialization) information from command-line...char **getSeedingInformation(int argc, char **argv, commandLineArgument &myCLA){  bool validCLA = true;  int tempNum;  switch (toupper((*(++argv))[0])){    case FARTHEST_SEEDING:      switch (toupper((*(++argv))[0])){        case BOTH_LABEL:	  myCLA.rowInitializationMethod = FARTHEST_INIT;	  myCLA.colInitializationMethod = FARTHEST_INIT;	  break;        case COL_LABEL:	  myCLA.colInitializationMethod = FARTHEST_INIT;	  break;        case ROW_LABEL:	  myCLA.rowInitializationMethod = FARTHEST_INIT;	  break;        default:	  cout << "  !!! Invalid farthest apart seeding label type: " << *argv << " !!!" << endl << endl;          validCLA = false;	  break;      }      break;    case PERTURBATION_SEEDING:      switch (toupper((*(++argv))[0])){        case BOTH_LABEL:	  myCLA.rowInitializationMethod = PERTURBATION_INIT;	  myCLA.colInitializationMethod = PERTURBATION_INIT;	  break;        case COL_LABEL:	  myCLA.colInitializationMethod = PERTURBATION_INIT;	  break;        case ROW_LABEL:	  myCLA.rowInitializationMethod = PERTURBATION_INIT;	  break;        default:	  cout << "  !!! Invalid perturbation seeding label type: " << *argv << " !!!" << endl << endl;          validCLA = false;	  break;      }      if (validCLA && (!isdigit((*(argv+1))[0]) && ((*(argv+2))[0] != '.'))){        cout << "  !!! Invalid perturbation magnitude: " << *argv << " !!!" << endl << endl;	validCLA = false;      }      if (validCLA)        myCLA.perturbationMagnitude = atoi(*(++argv));      break;    case RANDOM_SEEDING:      switch (toupper((*(++argv))[0])){        case BOTH_LABEL:	  myCLA.rowInitializationMethod = RANDOM_INIT;	  myCLA.colInitializationMethod = RANDOM_INIT;	  break;        case COL_LABEL:	  myCLA.colInitializationMethod = RANDOM_INIT;	  break;        case ROW_LABEL:	  myCLA.rowInitializationMethod = RANDOM_INIT;	  break;        default:	  cout << "  !!! Invalid random seeding label type: " << *argv << " !!!" << endl << endl;          validCLA = false;	  break;      }      break;    case SEEDING_SEEDING:      switch (toupper((*(++argv))[0])){        case BOTH_LABEL:          myCLA.rowInitializationMethod = SEEDING_INIT;	  myCLA.colInitializationMethod = SEEDING_INIT;	  break;        case COL_LABEL:	  myCLA.colInitializationMethod = SEEDING_INIT;	  break;        case ROW_LABEL:	  myCLA.rowInitializationMethod = SEEDING_INIT;	  break;        default:	  cout << "  !!! Invalid seeding file seeding label type: " << *argv << " !!!" << endl << endl;          validCLA = false;	  break;      }      if (validCLA){        switch ((*(++argv))[0]){          case LABEL_FROM_0:	    switch (toupper((*(argv-1))[0])){	      case BOTH_LABEL:	        myCLA.rowSeedingOffsetType = START_FROM_0;	        myCLA.colSeedingOffsetType = START_FROM_0;	        break;	      case COL_LABEL:	        myCLA.colSeedingOffsetType = START_FROM_0;	        break;	      case ROW_LABEL:	        myCLA.rowSeedingOffsetType = START_FROM_0;	        break;	      default:	        break;	    }	    break;          case LABEL_FROM_1:	    switch (toupper((*(argv-1))[0])){	      case BOTH_LABEL:	        myCLA.rowSeedingOffsetType = START_FROM_1;	        myCLA.colSeedingOffsetType = START_FROM_1;	        break;	      case COL_LABEL:	        myCLA.colSeedingOffsetType = START_FROM_1;	        break;	      case ROW_LABEL:	        myCLA.rowSeedingOffsetType = START_FROM_1;	        break;	      default:	        break;	    }	    break;          default:            cout << "  !!! Invalid seeding file seeding offset type: " << *argv << " !!!" << endl << endl;            validCLA = false;	    break;        }      }      if (validCLA){        if (*(argv+1) == NULL){          cout << "  !!! Invalid # of row/col seeding set(s): (# of row/col seeding set(s) should be specified.) !!!" << endl << endl;          validCLA = false;        }        if (validCLA && !isdigit((*(argv+1))[0])){          cout << "  !!! Invalid # of row/col seeding set(s): " << *(argv+1) << " !!!" << endl << endl;          validCLA = false;        }        if (validCLA){          tempNum = atoi(*(argv+1));	  if (tempNum <= 0){	    cout << "  !!! Invalid # of seeding set(s): (# of seeding set(s) should be a positive integer.): " << tempNum << " !!!" << endl;	    validCLA = false;	  } else {	    switch (toupper((*(argv-1))[0])){	      case BOTH_LABEL:	        myCLA.numRowSeedingSet = atoi(*(++argv));	        myCLA.numColSeedingSet = myCLA.numRowSeedingSet;	        myCLA.rowSeedingAccessMode = BOTH_INPUT_MODE;	        myCLA.colSeedingAccessMode = NO_OPEN_MODE;	        break;	      case COL_LABEL:	        myCLA.numColSeedingSet = atoi(*(++argv));	        myCLA.colSeedingAccessMode = ONE_INPUT_MODE;	        break;	      case ROW_LABEL:	        myCLA.numRowSeedingSet = atoi(*(++argv));	        myCLA.rowSeedingAccessMode = ONE_INPUT_MODE;	        break;	      default:	        cout << "  !!! Invalid seeding file seeding label type: " << *(argv-1) << " !!!" << endl << endl;                validCLA = false;	        break;	    }	  }        }            }	      	            if (validCLA && (*(argv+1) == NULL)){        cout << "  !!! Invalid seeding filename: (seeding filename should be specified.) !!!" << endl << endl;        validCLA = false;      }      if (validCLA && (isdigit((*(argv+1))[0]) || ((*(argv+1))[0] == '-'))){        cout << "  !!! Invalid seeding filename: " << *(argv+1) << " !!!" << endl << endl;        validCLA = false;      }      if (validCLA){        switch (toupper((*(argv-2))[0])){          case BOTH_LABEL:            strcpy(myCLA.rowSeedingFilename, *(++argv));	    strcpy(myCLA.colSeedingFilename, myCLA.rowSeedingFilename);	    strcpy(myCLA.bothSeedingFilename, myCLA.rowSeedingFilename);            break;          case COL_LABEL:            strcpy(myCLA.colSeedingFilename, *(++argv));            break;          case ROW_LABEL:            strcpy(myCLA.rowSeedingFilename, *(++argv));            break;          default:	    cout << "  !!! Invalid seeding file seeding label type: " << *(argv-2) << " !!!" << endl << endl;	    validCLA = false;            break;        }      }      break;          case PERMUTATION_SEEDING:      switch (toupper((*(++argv))[0])){        case BOTH_LABEL:          if (*(argv+1) == NULL){            cout << "  !!! Invalid row permutation number: (row permutation number should be specified.) !!!" << endl << endl;            validCLA = false;          }          if (validCLA && !isdigit((*(argv+1))[0])){            cout << "  !!! Invalid row permutation number: " << *(argv+1) << " !!!" << endl << endl;            validCLA = false;          }          tempNum = atoi(*(argv+1));	  if (tempNum <= 0){	    cout << "  !!! Invalid row permutation number: (row permutation number should be a positive integer.): " << tempNum << " !!!" << endl;	    validCLA = false;	  }          if (validCLA && (*(argv+2) == NULL)){            cout << "  !!! Invalid col permutation number: (col permutation number should be specified.) !!!" << endl << endl;            validCLA = false;          }          if (validCLA && !isdigit((*(argv+2))[0])){            cout << "  !!! Invalid col permutation number: " << *(argv+2) << " !!!" << endl << endl;            validCLA = false;          }	  tempNum = atoi(*(argv+2));	  if (tempNum <= 0){	    cout << "  !!! Invalid col permutation number: (col permutation number should be a positive integer.): " << tempNum << " !!!" << endl;	    validCLA = false;	  }          if (validCLA){            myCLA.numRowPermutation = atoi(*(++argv));            myCLA.numColPermutation = atoi(*(++argv));	    myCLA.rowInitializationMethod = PERMUTATION_INIT;	    myCLA.colInitializationMethod = PERMUTATION_INIT;          }	  break;        case COL_LABEL:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -