• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ sequence类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中sequence的典型用法代码示例。如果您正苦于以下问题:C++ sequence类的具体用法?C++ sequence怎么用?C++ sequence使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: process_atomic_values

/*
 * Helper for element and docuemnt constructors to insert sequence
 * of atomic values. Returns true if node was actually inserted.
 * In this case left pointer is changed to the last inserted indirection.
 * In any case at_vals sequence is cleared.
 */
static inline bool
process_atomic_values(xptr& left, const xptr& parent, sequence& at_vals) {
    if (at_vals.size() > 0)
    {
        executor_globals::tmp_op_str_buf.clear();
        tuple_cell tcc;
        sequence::iterator it = at_vals.begin();
        do {
            tcc = tuple_cell::make_sure_light_atomic((*it).cells[0]);
            tcc = cast(tcc, xs_string);
            executor_globals::tmp_op_str_buf.append(tcc);
            it++;
        }
        while (it != at_vals.end());

        at_vals.clear();
        if(executor_globals::tmp_op_str_buf.get_size() > 0) {
            insert_text(indirectionDereferenceCP(left),
                        XNULL,
                        indirectionDereferenceCP(parent),
                        text_source_strbuf(&(executor_globals::tmp_op_str_buf)));
            left = get_last_mo_inderection();
            return true;
        }
    }
    return false;
}
开发者ID:bitkeeper,项目名称:sedna,代码行数:33,代码来源:PPConstructors.cpp


示例2: checkLegalRegister

SequenceStatus GestureSeqRecorder::registerSequence(midasMode mode, sequence seq, CommandData seqResponse, std::string name)
{
    sequenceInfo seqInfo;
    seqInfo.seq = seq;
    seqInfo.sequenceResponse = seqResponse;
    seqInfo.sequenceName = name;
    SequenceStatus status = checkLegalRegister(mode, seqInfo);
    if (status != SequenceStatus::SUCCESS)
    {
        return status;
    }

    sequenceList *seqList = (*seqMapPerMode)[mode];
    seqList->push_back(seqInfo);

    seqList = NULL;

    std::vector<int> ids;
    std::vector<PoseLength> lengths;
    sequence::iterator it;

    for (it = seq.begin(); it != seq.end(); ++it)
    {
        ids.push_back(it->type);
        lengths.push_back(it->poseLen);
    }

    std::vector<sequenceImageSet> images = imageManager.formSequenceSetFromIds(ids, lengths);

    gestureSignaller.emitRegisterSequence(seqInfo.id, QString(seqInfo.sequenceName.c_str()), images);

    return SequenceStatus::SUCCESS;
}
开发者ID:jordenh,项目名称:ProjectMidas,代码行数:33,代码来源:GestureSeqRecorder.cpp


示例3: lexicographical_compare

  bool
  operator > (const sequence<Iter2, Comp2>& seq) const
  {
    return std::lexicographical_compare (seq.begin(), seq.end(),
					 begin(), end(),
					 compare);
  }
开发者ID:boost-vault,项目名称:Algorithms,代码行数:7,代码来源:combination_test_btb.cpp


示例4:

viterbi_trellis crf::viterbi_scorer::viterbi(const sequence& seq)
{
    // we only need the scores for the states as the transition scores, set
    // up during construction, will never change between sequences
    scorer_.state_scores(*model_, seq);

    viterbi_trellis table{seq.size(), model_->num_labels()};

    // initialize first column of trellis. We use the original state() and
    // trans() matrices because we are working in the log domain.
    for (label_id lbl{0}; lbl < model_->num_labels(); ++lbl)
        table.probability(0, lbl, scorer_.state(0, lbl));

    // compute remaining columns of trellis using recursive formulation
    for (uint64_t t = 1; t < seq.size(); ++t)
    {
        for (label_id lbl{0}; lbl < model_->num_labels(); ++lbl)
        {
            double max_score = std::numeric_limits<double>::lowest();
            for (label_id in{0}; in < model_->num_labels(); ++in)
            {
                auto score = table.probability(t - 1, in)
                             + scorer_.trans(in, lbl);

                if (score > max_score)
                {
                    max_score = score;
                    table.previous_tag(t, lbl, in);
                }
            }
            table.probability(t, lbl, max_score + scorer_.state(t, lbl));
        }
    }
    return table;
}
开发者ID:MGKhKhD,项目名称:meta,代码行数:35,代码来源:viterbi_scorer.cpp


示例5: decode

string decode(const sequence& s)
{
	string result(s.length(), 0);
	for (unsigned int i = 0; i < s.length(); ++i)
		result[i] = s[i] >= 23 ? '.' : kResidues[s[i]];
	return result;
}
开发者ID:uQlust,项目名称:uQlust-ver1.0,代码行数:7,代码来源:mas.cpp


示例6: if

// is end of a chunk (IOB1)?
int evaluation::is_end_of_chunk_iob1(int human_model, int i, sequence & seq, 
					string b_tag, string i_tag) {
    if (human_model == 1) {
	if (seq[i].label == atoi(b_tag.c_str())) {
	    if (i >= seq.size() - 1) {
		return 1;
	    } else {
		if (seq[i + 1].label != atoi(i_tag.c_str())) {
		    return 1;
		} else {
		    return 0;
		}
	    }
	    
	} else if (seq[i].label == atoi(i_tag.c_str())) {
	    if (i >= seq.size() - 1) {
		return 1;
	    } else {
		if (seq[i + 1].label != atoi(i_tag.c_str())) {
		    return 1;
		} else {
		    return 0;
		}
	    }
	
	} else {
	    return 0;
	}	
    
    } else if (human_model == 2) {
	if (seq[i].model_label == atoi(b_tag.c_str())) {
	    if (i >= seq.size() - 1) {
		return 1;
	    } else {
		if (seq[i + 1].model_label != atoi(i_tag.c_str())) {
		    return 1;
		} else {
		    return 0;
		}
	    }
	    
	} else if (seq[i].model_label == atoi(i_tag.c_str())) {
	    if (i >= seq.size() - 1) {
		return 1;
	    } else {
		if (seq[i + 1].model_label != atoi(i_tag.c_str())) {
		    return 1;
		} else {
		    return 0;
		}
	    }
	
	} else {
	    return 0;
	}	
    
    } else {
	return 0;
    }
}
开发者ID:earthwu,项目名称:crf,代码行数:61,代码来源:evaluation.cpp


示例7: is_end_of_chunk_iob1

// is end of a chunk (IOB1)?
int is_end_of_chunk_iob1(int human_model, int i, sequence & seq, 
					string b_tag, string i_tag) {
    if (human_model == 1) {
	if (seq[i][seq[i].size() - 2] == b_tag) {
	    if (i >= seq.size() - 1) {
		return 1;
	    } else {
		if (seq[i + 1][seq[i + 1].size() - 2] != i_tag) {
		    return 1;
		} else {
		    return 0;
		}
	    }
	    
	} else if (seq[i][seq[i].size() - 2] == i_tag) {
	    if (i >= seq.size() - 1) {
		return 1;
	    } else {
		if (seq[i + 1][seq[i + 1].size() - 2] != i_tag) {
		    return 1;
		} else {
		    return 0;
		}
	    }
	
	} else {
	    return 0;
	}	
    
    } else if (human_model == 2) {
	if (seq[i][seq[i].size() - 1] == b_tag) {
	    if (i >= seq.size() - 1) {
		return 1;
	    } else {
		if (seq[i + 1][seq[i + 1].size() - 1] != i_tag) {
		    return 1;
		} else {
		    return 0;
		}
	    }
	    
	} else if (seq[i][seq[i].size() - 1] == i_tag) {
	    if (i >= seq.size() - 1) {
		return 1;
	    } else {
		if (seq[i + 1][seq[i + 1].size() - 1] != i_tag) {
		    return 1;
		} else {
		    return 0;
		}
	    }
	
	} else {
	    return 0;
	}	
    
    } else {
	return 0;
    }
}
开发者ID:earthwu,项目名称:crf,代码行数:61,代码来源:evaluatechunk.cpp


示例8: show_list

void show_list(sequence<T> src)
// Pre: (none)
// Post: The items of src are printed to cout (one per line).
{
   for ( src.start(); src.is_item(); src.advance() )
      cout << src.current() << "  ";
}
开发者ID:brownbagspecial,项目名称:School-Work,代码行数:7,代码来源:sequenceTest.cpp


示例9: adjoint

sequence<T> adjoint( sequence<T> X )
{
	int t1 = X.t1();
	int t2 = X.t2();
	for( int t = t1; t <= t2; t++ )
		X(t) = adjoint(X(t));
	return X.timereverse();
}
开发者ID:damianmarelli,项目名称:bealab,代码行数:8,代码来源:algebra.hpp


示例10: objkey

RObject 
AORB::object_key_to_object(sequence<octet>& object_key)
{
  RString str = new String((const char*)object_key.data(), object_key.size(), NormalSST | CCAscii);
  ObjectKey objkey(str);
  if (objkey.isLocal() == true)
    return objkey.getLocalObject();
  // return Skelleton here
  return Nil;
}
开发者ID:huangyt,项目名称:foundations.github.com,代码行数:10,代码来源:AORB.cpp


示例11: breed

sequence sequence::breed(sequence const &a, sequence const &b) {
   sequence child;
   for (unsigned int i=0; i < sequence::solution.size(); i++) {
      if (random::probability(0.5)) {
         child.set_gene(i, a.get_gene(i));
      } else {
         child.set_gene(i, b.get_gene(i));
      }
   }
   return child;
}
开发者ID:IdrisAlneimy,项目名称:genetic,代码行数:11,代码来源:sequence.cpp


示例12: generate_vietoris_sequence

void generate_vietoris_sequence(sequence& a) {
    if (a.empty())
        return;
    a[0] = rdm(0, MAX_VAL);
    if (a.size() < 2)
        return;
    a[1] = rdm(0, a[0]);
    for (int k = 2; k < a.size(); k++) {
        a[k] = rdm(0, (1.0 * k - 1) / k) * a[k - 1];
    }
}
开发者ID:lybeck,项目名称:NuMe,代码行数:11,代码来源:w3e4.cpp


示例13:

editable_events::editable_events (sequence & seq, int bpm)
 :
    m_events            (),
    m_current_event     (m_events.end()),
    m_sequence          (seq),
    m_midi_parameters
    (
        bpm, seq.get_beats_per_bar(), seq.get_beat_width(), seq.get_ppqn()
    )
{
    // Empty body
}
开发者ID:danielappelt,项目名称:sequencer64,代码行数:12,代码来源:editable_events.cpp


示例14: seq1

      // compares the given two instances of ss
      double cm_assembly_ssq3::compare(ss const &__first, ss const &__second) const {
        sequence<cchb_dssp> const seq1(__first.get_sequence()), seq2(__second.get_sequence());

        if(seq1.size() != seq2.size()) {
          throw math::compare_error(get_identifier() + ": Sequence length differ, sequence1.length=" +
                                    std::to_string(seq1.size()) + ", sequence2.length=" + std::to_string(seq2.size()));
        } // if

        size_t c_correct(0), h_correct(0), e_correct(0); // initialize
        for(size_t pos(0); pos < seq1.size(); ++pos) { // works for both sequences b/c of same length
          char const sequence1_ss(seq1[pos].get_identifier_char());
          char const sequence2_ss(seq2[pos].get_identifier_char());
          if(sequence1_ss == sequence2_ss) { // actually it's only important that they are the same, not which one
            if(sequence1_ss == 'C') {
              ++c_correct;
            } // if
            else if(sequence1_ss == 'H') {
              ++h_correct;
            } // else if
            else if(sequence1_ss == 'E') {
              ++e_correct;
            } // else if
          } // if
        } // for

        DEBUG << get_identifier() << ": c_correct=" << c_correct << " h_correct=" << h_correct
              << " e_correct=" << e_correct << " seq_len=" << seq1.size();

        return ((double)c_correct + h_correct + e_correct) / seq1.size();
      } // compare()
开发者ID:shze,项目名称:biosim,代码行数:31,代码来源:cm_assembly_ssq3.cpp


示例15: correct

// **************************************************************************
// bool correct(sequence& test, size_t s, size_t cursor_spot, double items[])
//   This function determines if the sequence (test) is "correct" according to
//   these requirements:
//   a. it has exactly s items.
//   b. the items (starting at the front) are equal to
//      items[0] ... items[s-1]
//   c. if cursor_spot < s, then test's cursor must be at
//      the location given by cursor_spot.
//   d. if cursor_spot >= s, then test must not have a cursor.
// NOTE: The function also moves the cursor off the sequence.
// **************************************************************************
bool correct(sequence& test, size_t size, size_t cursor_spot, double items[])
{
    bool has_cursor = (cursor_spot < size); 

    // Check the sequence's size and whether it has a cursor.
    if (!test_basic(test, size, has_cursor))
    {
        cout << "Basic test of size() or is_item() failed." << endl << endl;
        return false;
    }

    // If there is a cursor, check the items from cursor to end of the sequence.
    if (has_cursor && !test_items(test, size, cursor_spot, items))
    {
        cout << "Test of the sequence's items failed." << endl << endl;
        return false;
    }

    // Restart the cursor at the front of the sequence and test items again.
    cout << "I'll call start() and look at the items one more time..." << endl;
    test.start( );
    if (has_cursor && !test_items(test, size, 0, items))
    {
        cout << "Test of the sequence's items failed." << endl << endl;
        return false;
    }

    // If the code reaches here, then all tests have been passed.
    cout << "All tests passed for this sequence." << endl << endl;
    return true;
}
开发者ID:dorazhuyi,项目名称:hws,代码行数:43,代码来源:seq_ex2.cpp


示例16: while

// is matching chunk (IOE2)? 
int evaluation::is_matching_chunk_ioe2(int i, sequence & seq, string i_tag, string e_tag) {
    if (!is_start_of_chunk_ioe2(1, i, seq, i_tag, e_tag) || 
	    !is_start_of_chunk_ioe2(2, i, seq, i_tag, e_tag)) {
	return 0;
    }
    
    int len = seq.size();
    int j = i, k = i;
    while (j < len) {
	if (is_end_of_chunk_ioe2(1, j, seq, i_tag, e_tag)) {
	    break;
	} else {
	    j++;
	}
    }

    while (k < len) {
	if (is_end_of_chunk_ioe2(2, k, seq, i_tag, e_tag)) {
	    break;
	} else {
	    k++;
	}
    }

    return (j == k);
}
开发者ID:earthwu,项目名称:crf,代码行数:27,代码来源:evaluation.cpp


示例17: orthonomial

 orthonomial(const sequence &a, const sequence &b, const sequence &c) : n(c.size() - 1), a(a), b(b), c(c) {    
   /* Ze względów bezpieczeństwa. */
   this->a.push_back(0);
   this->b.push_back(0);
   this->c.push_back(0);
   this->c.push_back(0);
 }
开发者ID:mrhania,项目名称:studies,代码行数:7,代码来源:program.cpp


示例18:

void crf::tagger::tag(sequence& seq)
{
    auto trellis = scorer_.viterbi(seq);

    auto lbls = util::range(label_id{0},
                            label_id(static_cast<uint32_t>(num_labels_ - 1)));
    auto last_lbl = functional::argmax(
        lbls.begin(), lbls.end(), [&](label_id lbl)
        {
            return trellis.probability(seq.size() - 1, lbl);
        });

    seq[seq.size() - 1].label(*last_lbl);
    for (uint64_t t = seq.size() - 1; t > 0; t--)
        seq[t - 1].label(trellis.previous_tag(t, seq[t].label()));
}
开发者ID:MGKhKhD,项目名称:meta,代码行数:16,代码来源:tagger.cpp


示例19: evaluate

double emissionFuncParam::evaluate(sequence& seq , size_t pos) {
    double val = (*emissionFunction)(seq.getUndigitized(),pos);

    if (emissionFuncScaling!=NULL) {
        val = emissionFuncScaling->getWeightedScore(val);
    }

    return val;
}
开发者ID:vohoaiviet,项目名称:stochhmm,代码行数:9,代码来源:externalFuncs.cpp


示例20: tag

void perceptron::tag(sequence& seq) const
{
    for (uint64_t t = 0; t < seq.size(); ++t)
    {
        analyzer_.analyze(seq, t);
        seq[t].label(model_.best_class(seq[t].features()));
        seq[t].tag(analyzer_.tag(seq[t].label()));
    }
}
开发者ID:MGKhKhD,项目名称:meta,代码行数:9,代码来源:perceptron.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ serial类代码示例发布时间:2022-05-31
下一篇:
C++ seq类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap