src/training/common/commontraining.cpp
CLUSTERER *SetUpForClustering(const FEATURE_DEFS_STRUCT &FeatureDefs, LABELEDLIST char_sample,
                              const char *program_feature_type) {
  uint16_t N;
  CLUSTERER *Clusterer;
  LIST FeatureList = nullptr;
  FEATURE_SET FeatureSet = nullptr;

  int32_t desc_index = ShortNameToFeatureType(FeatureDefs, program_feature_type);
  N = FeatureDefs.FeatureDesc[desc_index]->NumParams;
  Clusterer = MakeClusterer(N, FeatureDefs.FeatureDesc[desc_index]->ParamDesc);

  FeatureList = char_sample->List;
  uint32_t CharID = 0;
  std::vector<float> Sample;
  iterate(FeatureList) {
    FeatureSet = reinterpret_cast<FEATURE_SET>(FeatureList->first_node());
    for (int i = 0; i < FeatureSet->MaxNumFeatures; i++) {
      if (Sample.empty()) {
        Sample.resize(N);
      }
      for (int j = 0; j < N; j++) {
        Sample[j] = FeatureSet->Features[i]->Params[j];
      }
      MakeSample(Clusterer, &Sample[0], CharID);
    }
    CharID++;
  }
  return Clusterer;

}
/*---------------------------------------------------------------------------*/
/**
 * This routine reads samples from a LABELEDLIST and enters
 * those samples into a clusterer data structure.  This
 * data structure is then returned to the caller.
 * @param char_sample: LABELEDLIST that holds all the feature information for a
 * @param FeatureDefs
 * @param program_feature_type
 * given character.
 * @return Pointer to new clusterer data structure.
 * @note Globals: None
 */
This routine reads samples from a LABELEDLIST and enters
those samples into a clusterer data structure.  This
data structure is then returned to the caller.
@param char_sample: LABELEDLIST that holds all the feature information for a
@param FeatureDefs
@param program_feature_type
given character.
@return Pointer to new clusterer data structure.
@note Globals: None
This routine reads samples from a LABELEDLIST and enters those samples into a clusterer data structure . This data structure is then returned to the caller . @param char_sample : LABELEDLIST that holds all the feature information for a @param FeatureDefs @param program_feature_type given character . @return Pointer to new clusterer data structure . @note Globals : None
CLUSTERER *SetUpForClustering(const FEATURE_DEFS_STRUCT &FeatureDefs, LABELEDLIST char_sample,
                              const char *program_feature_type) {
  uint16_t N;
  CLUSTERER *Clusterer;
  LIST FeatureList = nullptr;
  FEATURE_SET FeatureSet = nullptr;
  int32_t desc_index = ShortNameToFeatureType(FeatureDefs, program_feature_type);
  N = FeatureDefs.FeatureDesc[desc_index]->NumParams;
  Clusterer = MakeClusterer(N, FeatureDefs.FeatureDesc[desc_index]->ParamDesc);
  FeatureList = char_sample->List;
  uint32_t CharID = 0;
  std::vector<float> Sample;
  iterate(FeatureList) {
    FeatureSet = reinterpret_cast<FEATURE_SET>(FeatureList->first_node());
    for (int i = 0; i < FeatureSet->MaxNumFeatures; i++) {
      if (Sample.empty()) {
        Sample.resize(N);
      }
      for (int j = 0; j < N; j++) {
        Sample[j] = FeatureSet->Features[i]->Params[j];
      }
      MakeSample(Clusterer, &Sample[0], CharID);
    }
    CharID++;
  }
  return Clusterer;
}
CLUSTERER * SetUpForClustering ( const FEATURE_DEFS_STRUCT & FeatureDefs , LABELEDLIST char_sample , const char * program_feature_type ) { uint16_t N ; CLUSTERER * Clusterer ; LIST FeatureList = nullptr ; FEATURE_SET FeatureSet = nullptr ; int32_t desc_index = ShortNameToFeatureType ( FeatureDefs , program_feature_type ) ; N = FeatureDefs . FeatureDesc [ desc_index ] -> NumParams ; Clusterer = MakeClusterer ( N , FeatureDefs . FeatureDesc [ desc_index ] -> ParamDesc ) ; FeatureList = char_sample -> List ; uint32_t CharID = 0 ; std :: vector < float > Sample ; iterate ( FeatureList ) { FeatureSet = reinterpret_cast < FEATURE_SET > ( FeatureList -> first_node ( ) ) ; for ( int i = 0 ; i < FeatureSet -> MaxNumFeatures ; i ++ ) { if ( Sample . empty ( ) ) { Sample . resize ( N ) ; } for ( int j = 0 ; j < N ; j ++ ) { Sample [ j ] = FeatureSet -> Features [ i ] -> Params [ j ] ; } MakeSample ( Clusterer , & Sample [ 0 ] , CharID ) ; } CharID ++ ; } return Clusterer ; }
This routine reads samples from a LABELEDLIST and enters
 those samples into a clusterer data structure.
This routine reads samples from a LABELEDLIST and enters those samples into a clusterer data structure .