当前位置: 首页>>代码示例>>C++>>正文


C++ Distribution::ascii_print方法代码示例

本文整理汇总了C++中Distribution::ascii_print方法的典型用法代码示例。如果您正苦于以下问题:C++ Distribution::ascii_print方法的具体用法?C++ Distribution::ascii_print怎么用?C++ Distribution::ascii_print使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Distribution的用法示例。


在下文中一共展示了Distribution::ascii_print方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(void) {

  int var, i, j, nb_variable, nb_component;
  const int nb_vector = 500;
  double *pweight = NULL;
  bool *fparam = NULL;
  int* perm;
  StatError error;
  const char * mixpath= "./tmp.mix", * spmixpath= "./tmp_sp.mix";
  const char * gnupath = "./tmp_mix", * gnu_datapath = "./tmp_mix_data";
  const char * margpath= "./marg_mix", * gnu_tmppath = "./tmp_mix_d";
  const char * np_modelpath= "./np_model.mix", * gnu_tmpnppath = "./tmp_mix_d";
  const char * entropy_data= "cluster_vectors.vec";
  const char * output_path = "tmp_entropy_output.vec";
  Distribution *marginal = NULL;
  DiscreteDistributionData *marginal_histo = NULL;
  Vectors *vec = NULL;
  MultivariateMixture *mv1 = NULL, *mv_cp = NULL;
  MultivariateMixture *mv_np1 = NULL, *mv_np_estim = NULL;
  MultivariateMixture *mv_estim = NULL;
  MultivariateMixtureData *mv_data = NULL, *cluster = NULL;
  DiscreteParametric **dt1 = NULL, **dt2 = NULL;
  DiscreteParametricProcess **ppcomponent = NULL;


  // constructors of Mv_Mixture
  mv1 = new MultivariateMixture();

  // destructor of MultivariateMixture
  delete mv1;
  mv1= NULL;

  nb_variable = 2;
  nb_component = 3;

  dt1 = new DiscreteParametric*[nb_component];
  dt2 = new DiscreteParametric*[nb_component];
  pweight = new double[nb_component];
  ppcomponent = new DiscreteParametricProcess*[nb_variable];

  pweight[0] = 0.1;
  pweight[1] = 0.2;
  pweight[2] = 0.7;



  dt1[0] = new DiscreteParametric(0, BINOMIAL, 2, 12, D_DEFAULT, 0.1);
  dt1[1] = new DiscreteParametric(0, BINOMIAL, 0, 10, D_DEFAULT, 0.5);
  dt1[2] = new DiscreteParametric(0, BINOMIAL, 3, 10, D_DEFAULT, 0.8);

  dt2[0] = new DiscreteParametric(0, POISSON, 2, I_DEFAULT, 8.0, D_DEFAULT);
  dt2[1] = new DiscreteParametric(0, POISSON, 4, I_DEFAULT, 5.0, D_DEFAULT);
  dt2[2] = new DiscreteParametric(0, POISSON, 0, I_DEFAULT, 2.0, D_DEFAULT);

  cout << "Observation distributions for variable 1:" << endl;
  for (i = 0; i < nb_component; i++) {
    dt1[i]-> ascii_print(cout);
  }

  ppcomponent[0] = new DiscreteParametricProcess(nb_component, dt1);
  ppcomponent[1] = new DiscreteParametricProcess(nb_component, dt2);

  for (i = 0; i < nb_component; i++) {
    delete dt1[i];
    dt1[i] = NULL;
    delete dt2[i];
    dt2[i] = NULL;
  }

  cout << endl;

  mv1 = new MultivariateMixture(nb_component, pweight, nb_variable, ppcomponent, NULL);

  cout << "Mixture of " << nb_component << " components with " <<
    nb_variable << " variables:" << endl;

  mv1->ascii_write(cout, true);
  cout << endl;

  // copy
  mv_cp = new MultivariateMixture(*mv1);
  cout << "Copy constructor of MultivariateMixture: " << endl;
  mv_cp->ascii_write(cout);
  cout << endl;

  // destructor of MultivariateMixture
  delete mv_cp;
  mv_cp= NULL;

  delete mv1;
  mv1= NULL;

  cout << "MultivariateMixture_building (print into file " << mixpath << "): " << endl;

  mv1 = multivariate_mixture_building(error , nb_component ,
                                      nb_variable, pweight, ppcomponent, NULL);

  if (mv1 == NULL)
    cout << error;
  else {
//.........这里部分代码省略.........
开发者ID:VirtualPlants,项目名称:StructureAnalysis,代码行数:101,代码来源:test_multivariate_mixture.cpp


注:本文中的Distribution::ascii_print方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。