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

📄 digraphdiagnose.h

📁 这是一个从音频信号里提取特征参量的程序
💻 H
📖 第 1 页 / 共 5 页
字号:
    triple = new TopoTriple(pair_02, float_02, bool_02);    arcs.insert(triple);    delete triple;        Float float_03(0.7);    Boolean bool_03(false);    Pair<Long, Long> pair_03(1, 1);    triple = new TopoTriple(pair_03, float_03, bool_03);    arcs.insert(triple);    delete triple;        Float float_04(0.0);    Boolean bool_04(true);    Pair<Long, Long> pair_04(1, DiGraph<Char>::TERM_INDEX);    triple = new TopoTriple(pair_04, float_04, bool_04);    arcs.insert(triple);    delete triple;          // create the list of data elements    //    SingleLinkedList<Char> dlist;    dlist.insert(a);    dlist.insert(b);          // create the graph using the lists    //    DiGraph<Char> assgn_graph;    assgn_graph.assign(dlist, arcs);    // retrieve the lists from the graph    //    SingleLinkedList<Char> test_dlist;    SingleLinkedList<TopoTriple> test_arcs;    ((DiGraph<Char>)assgn_graph).get(test_dlist, test_arcs);    // test for quuality of the lists    //    if (!test_dlist.eq(dlist)) {      return Error::handle(name(), L"get", Error::TEST,			   __FILE__, __LINE__);    }    if (!test_arcs.eq(arcs)) {      return Error::handle(name(), L"get", Error::TEST,			   __FILE__, __LINE__);    }    // clean up    //    delete a;    delete b;    // test the graph get method in USER-allocation mode    //        {      // -------------------------------------------------      // START -(epi) -> a      // a     -(0.1) -> a      // a     -(0.5) -> b      // b     -(0.7) -> b      // b     -(epi) -> TERM       // -------------------------------------------------          // create the graph items      //                Char* a = new Char('a');      Char* b = new Char('b');      TopoTriple* triple;            // create the list of arcs      //      SingleLinkedList<TopoTriple> arcs;            Float float_00(0.0);      Boolean bool_00(true);      Pair<Long, Long> pair_00(DiGraph<Char>::START_INDEX, 0);      triple = new TopoTriple(pair_00, float_00, bool_00);      arcs.insert(triple);      delete triple;          Float float_01(0.1);      Boolean bool_01(false);      Pair<Long, Long> pair_01(0, 0);      triple = new TopoTriple(pair_01, float_01, bool_01);      arcs.insert(triple);      delete triple;            Float float_02(0.5);      Boolean bool_02(false);      Pair<Long, Long> pair_02(0, 1);      triple = new TopoTriple(pair_02, float_02, bool_02);      arcs.insert(triple);      delete triple;            Float float_03(0.7);      Boolean bool_03(false);      Pair<Long, Long> pair_03(1, 1);      triple = new TopoTriple(pair_03, float_03, bool_03);      arcs.insert(triple);      delete triple;            Float float_04(0.0);      Boolean bool_04(true);      Pair<Long, Long> pair_04(1, DiGraph<Char>::TERM_INDEX);      triple = new TopoTriple(pair_04, float_04, bool_04);      arcs.insert(triple);      delete triple;              // create the list of data elements      //      SingleLinkedList<Char> dlist;      dlist.insert(a);      dlist.insert(b);              // create the graph using the lists      //      DiGraph<Char> assgn_graph(USER);      assgn_graph.assign(dlist, arcs);            // retrieve the lists from the graph      //      SingleLinkedList<Char> test_dlist;      SingleLinkedList<TopoTriple> test_arcs;      assgn_graph.get(test_dlist, test_arcs);            // test for quuality of the lists      //      if (!test_dlist.eq(dlist)) {	return Error::handle(name(), L"get", Error::TEST,			     __FILE__, __LINE__);      }            if (!test_arcs.eq(arcs)) {	return Error::handle(name(), L"get", Error::TEST,			     __FILE__, __LINE__);      }            // clean up      //      delete a;      delete b;      }  }    // declare a new graph  //  DiGraph<TObject>* graph_04 = new  DiGraph<TObject>();    // weight methods in SYSTEM-allocation mode  //  if (!graph_04->isWeighted()) {    return Error::handle(name(), L"isWeighted", Error::TEST,			 __FILE__, __LINE__);  }  graph_04->setWeighted(false);  if (graph_04->isWeighted()) {    return Error::handle(name(), L"setWeighted", Error::TEST,			 __FILE__, __LINE__);  }  graph_04->setWeighted(true);    A = new Char('A');  VA = graph_04->insertVertex(A);  graph_04->insertArc(graph_04->getStart(), VA, false, 0.1);  graph_04->insertArc(VA, graph_04->getStart(), false, 0.1);    graph_04->insertArc(VA, graph_04->getTerm(), false, 0.3);  graph_04->insertArc(graph_04->getTerm(), VA, false, 0.3);  // the start vertex should a weighted arc to VA  //  my_arc = graph_04->getStart()->getFirst();      if ((my_arc->getVertex() != VA) &&     (!Integral::almostEqual((double)my_arc->getWeight(), 0.1))) {    return Error::handle(name(), L"insertArc", Error::TEST,			 __FILE__, __LINE__);  }      more_nodes = graph_04->gotoFirst();    while (more_nodes) {        // VA should a weighted arc to the term vertex    //    GraphVertex<TObject>* my_vertex =      (GraphVertex<TObject>*)graph_04->getCurr();    my_vertex->setMark();        my_vertex->gotoFirst();    GraphArc<TObject>* my_arc = my_vertex->getCurr();        if (my_vertex == VA) {      if ((my_arc->getVertex() == graph_04->getStart()) &&	  (!Integral::almostEqual((double)my_arc->getWeight(), 0.1))) {	return Error::handle(name(), L"insertArc", Error::TEST,			     __FILE__, __LINE__);      }          }    my_vertex->gotoNext();    my_arc = my_vertex->getCurr();        if (my_vertex == VA) {          if ((my_arc->getVertex() == graph_04->getTerm()) &&	  (!Integral::almostEqual((double)my_arc->getWeight(), 0.3))) {	return Error::handle(name(), L"insertArc", Error::TEST,			     __FILE__, __LINE__);      }    }    my_vertex->gotoMark();        more_nodes = graph_04->gotoNext();  }  // the end vertex should a weighted arc to VA  //  my_arc = graph_04->getTerm()->getFirst();      if ((my_arc->getVertex() != VA) &&     (!Integral::almostEqual((double)my_arc->getWeight(), 0.3))) {    return Error::handle(name(), L"insertArc", Error::TEST,			 __FILE__, __LINE__);  }    // clean up memory  //  graph_04->clear(Integral::FREE);  delete A;  delete graph_04;    {    // declare a new graph    //    DiGraph<TObject>* graph_04 = new  DiGraph<TObject>(USER);        // weight methods in USER-allocation mode    //    if (!graph_04->isWeighted()) {      return Error::handle(name(), L"isWeighted", Error::TEST,			   __FILE__, __LINE__);    }    graph_04->setWeighted(false);    if (graph_04->isWeighted()) {      return Error::handle(name(), L"setWeighted", Error::TEST,			   __FILE__, __LINE__);    }    graph_04->setWeighted(true);        // check the directed methods in USER-allocation mode    //    // weight methods in USER-allocation mode    //    A = new Char('A');    VA = graph_04->insertVertex(A);    graph_04->insertArc(graph_04->getStart(), VA, false, 0.1);      graph_04->insertArc(VA, graph_04->getStart(), false, 0.1);      graph_04->insertArc(VA, graph_04->getTerm(), false, 0.3);    graph_04->insertArc(graph_04->getTerm(), VA, false, 0.3);        // the start vertex should a weighted arc to VA    //    my_arc = graph_04->getStart()->getFirst();        if ((my_arc->getVertex() != VA) &&	(!Integral::almostEqual((double)my_arc->getWeight(), 0.1))) {      return Error::handle(name(), L"insertArc", Error::TEST,			   __FILE__, __LINE__);    }        more_nodes = graph_04->gotoFirst();        while (more_nodes) {            // VA should a weighted arc to the term vertex      //      GraphVertex<TObject>* my_vertex =	(GraphVertex<TObject>*)graph_04->getCurr();            my_vertex->setMark();          my_vertex->gotoFirst();      GraphArc<TObject>* my_arc = my_vertex->getCurr();            if (my_vertex == VA) {	if ((my_arc->getVertex() == graph_04->getStart()) &&	    (!Integral::almostEqual((double)my_arc->getWeight(), 0.1))) {	  return Error::handle(name(), L"insertArc", Error::TEST,			       __FILE__, __LINE__);	}            }            my_vertex->gotoNext();      my_arc = my_vertex->getCurr();            if (my_vertex == VA) {    	if ((my_arc->getVertex() == graph_04->getTerm()) &&	    (!Integral::almostEqual((double)my_arc->getWeight(), 0.3))) {	  return Error::handle(name(), L"insertArc", Error::TEST,			       __FILE__, __LINE__);	}      }      my_vertex->gotoMark();          more_nodes = graph_04->gotoNext();    }        // the end vertex should a weighted arc to VA    //    my_arc = graph_04->getTerm()->getFirst();        if ((my_arc->getVertex() != VA) &&	(!Integral::almostEqual((double)my_arc->getWeight(), 0.3))) {      return Error::handle(name(), L"insertArc", Error::TEST,			   __FILE__, __LINE__);    }        // clean up memory    //    graph_04->clear(Integral::FREE);    delete graph_04;  }    // reset indentation  //  if (level_a > Integral::NONE) {    Console::decreaseIndention();  }  // --------------------------------------------------------------------  //  // 4. class-specific public methods:  //     graph ordering methods  //  // --------------------------------------------------------------------  // set indentation  //  if (level_a > Integral::NONE) {    Console::put(L"testing class-specific public methods: graph ordering methods...\n");    Console::increaseIndention();   }  // test topological sort in SYSTEM-allocation mode  //  //  T. Cormen, C. Leiserson, R. Rivest, "Exercise 23.4-1", Introduction to  //  Algorithms, MIT Press, Boston, Massachusetts, USA, pp. 487, 1998.  //  DiGraph<Char> dag_00;  // create the graph to be topologically sorted  //  Char* my_chr;  my_chr = new Char(L'm');  GraphVertex<Char>* ptr_m = dag_00.insertVertex(my_chr);  delete my_chr;    my_chr = new Char(L'n');  GraphVertex<Char>* ptr_n = dag_00.insertVertex(my_chr);  delete my_chr;    my_chr = new Char(L'o');  GraphVertex<Char>* ptr_o = dag_00.insertVertex(my_chr);  delete my_chr;    my_chr = new Char(L'p');  GraphVertex<Char>* ptr_p = dag_00.insertVertex(my_chr);  delete my_chr;    my_chr = new Char(L'q');  GraphVertex<Char>* ptr_q = dag_00.insertVertex(my_chr);  delete my_chr;    my_chr = new Char(L'r');  GraphVertex<Char>* ptr_r = dag_00.insertVertex(my_chr);  delete my_chr;    my_chr = new Char(L's');  GraphVertex<Char>* ptr_s = dag_00.insertVertex(my_chr);  delete my_chr;    my_chr = new Char(L't');  GraphVertex<Char>* ptr_t = dag_00.insertVertex(my_chr);  delete my_chr;    my_chr = new Char(L'u');  GraphVertex<Char>* ptr_u = dag_00.insertVertex(my_chr);  delete my_chr;    my_chr = new Char(L'v');  GraphVertex<Char>* ptr_v = dag_00.insertVertex(my_chr);  delete my_chr;    my_chr = new Char(L'w');  GraphVertex<Char>* ptr_w = dag_00.insertVertex(my_chr);  delete my_chr;    my_chr = new Char(L'x');  GraphVertex<Char>* ptr_x = dag_00.insertVertex(my_chr);  delete my_chr;    my_chr = new Char(L'y');  GraphVertex<Char>* ptr_y = dag_00.insertVertex(my_chr);  delete my_chr;    my_chr = new Char(L'z');  GraphVertex<Char>* ptr_z = dag_00.insertVertex(my_chr);  delete my_chr;    // insert all the arcs  //  dag_00.insertArc(ptr_m, ptr_q);  dag_00.insertArc(ptr_m, ptr_r);  dag_00.insertArc(ptr_m, ptr_x);  dag_00.insertArc(ptr_n, ptr_o);  dag_00.insertArc(ptr_n, ptr_q);  dag_00.insertArc(ptr_n, ptr_u);  dag_00.insertArc(ptr_o, ptr_r);  dag_00.insertArc(ptr_o, ptr_s);  dag_00.insertArc(ptr_o, ptr_v);  dag_00.insertArc(ptr_p, ptr_o);  dag_00.insertArc(ptr_p, ptr_s);  dag_00.insertArc(ptr_p, ptr_z);  dag_00.insertArc(ptr_q, ptr_t);  dag_00.insertArc(ptr_r, ptr_u);  dag_00.insertArc(ptr_r, ptr_y);  dag_00.insertArc(ptr_s, ptr_r);  dag_00.insertArc(ptr_u, ptr_t);  dag_00.insertArc(ptr_v, ptr_w);  dag_00.insertArc(ptr_v, ptr_x);  dag_00.insertArc(ptr_w, ptr_z);  dag_00.insertArc(ptr_y, ptr_v);  // create a color hash table  //  dag_00.makeColorHash();    // create the solution vector - in SYSTEM mode  //  SingleLinkedList<Char> topo_sorted_result;  topo_sorted_result.insert(ptr_p->getItem());  topo_sorted_result.insert(ptr_n->getItem());  topo_sorted_result.insert(ptr_o->getItem());  topo_sorted_result.insert(ptr_s->getItem());  topo_sorted_result.insert(ptr_m->getItem());  topo_sorted_result.insert(ptr_r->getItem());  topo_sorted_result.insert(ptr_y->getItem());  topo_sorted_result.insert(ptr_v->getItem());  topo_sorted_result.insert(ptr_x->getItem());  topo_sorted_result.insert(ptr_w->getItem());  topo_sorted_result.insert(ptr_z->getItem());  topo_sorted_result.insert(ptr_u->getItem());  topo_sorted_result.insert(ptr_q->getItem());  topo_sorted_result.insert(ptr_t->getItem());    // run a topological sort  //  SingleLinkedList<Char> sorted_list(USER);  dag_00.topologicalSort(sorted_list);  if (!sorted_list.eq(topo_sorted_result)) {    topo_sorted_res

⌨️ 快捷键说明

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