本文整理汇总了C++中Seq::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ Seq::begin方法的具体用法?C++ Seq::begin怎么用?C++ Seq::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Seq
的用法示例。
在下文中一共展示了Seq::begin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: variance_func
double variance_func(Seq &sq) {
if (sq.empty())
return 0;
double av=0;
double var=0;
typename Seq::iterator it = sq.begin();
while(it != sq.end()) {
av+=*(it);
var+=(*(it))*(*(it));
it++;
}
av=av/sq.size();
var=var/sq.size();
var-=av*av;
if(var<1e-7)
return 0;
return var;
}
示例2: size
std::size_t size(const Seq& seq)
{
std::size_t d = 0;
for (typename Seq::const_iterator it=seq.begin(); it!=seq.end(); ++it)
d += boost::asio::buffer_size(*it);
return d;
}
示例3: variance_pf
double variance_pf(Seq &sq) {
double av=0;
double var=0;
int h=0;
typename Seq::iterator it = sq.begin();
while(it != sq.end()) {
av+=*(it) * h;
var+=(*(it)) * h * h ;
it++;
h++;
}
var-=av*av;
if(var<1e-7)
return 0;
return var;
}
示例4: emit_sep
void emit_sep(
Seq const &s, std::size_t step, Printer &&p
)
{
auto iter(s.begin());
std::size_t c(0);
auto lc(std::min(s.size(), c + step));
if (lc) {
auto xc(c);
printf("\t\t");
p(*iter++);
for (++xc; xc < lc; ++xc) {
printf(", ");
p(*iter++);
}
}
c += lc;
for (; c < s.size(); c += step) {
printf(",\n");
lc = std::min(s.size(), c + step);
if (!lc)
break;
auto xc(c);
printf("\t\t");
p(*iter++);
for (++xc; xc < lc; ++xc) {
printf(", ");
p(*iter++);
}
}
}
示例5: convertMAlignment2SecVect
void convertMAlignment2SecVect(SeqVect& sv, const MultipleSequenceAlignment& ma, bool fixAlpha) {
sv.Clear();
MuscleContext *ctx = getMuscleContext();
ctx->fillUidsVectors(ma->getNumRows());
unsigned i=0;
unsigned seq_count = 0;
foreach(const MultipleSequenceAlignmentRow& row, ma->getMsaRows()) {
Seq *ptrSeq = new Seq();
QByteArray name = row->getName().toLocal8Bit();
ptrSeq->FromString(row->getCore().constData(), name.constData());
//stripping gaps, original Seq::StripGaps fails on MSVC9
Seq::iterator newEnd = std::remove(ptrSeq->begin(), ptrSeq->end(), U2Msa::GAP_CHAR);
ptrSeq->erase(newEnd, ptrSeq->end());
if (ptrSeq->Length()!=0) {
ctx->tmp_uIds[seq_count] = ctx->input_uIds[i];
sv.push_back(ptrSeq);
seq_count++;
}
i++;
}
if (fixAlpha) {
sv.FixAlpha();
}
}
示例6: purge
template<class Seq> void purge(Seq& c)
{
typename Seq::iterator i;
for(i = c.begin(); i != c.end(); ++i) {
delete *i;
*i = 0;
}
}
示例7: purge
/** to purge a STL container of pointers; only pointers owned by the container, ie for which second arg
corresponding value is true, are deleted.
\param a STL sequence container
\param a std::vector<bool>
*/
template<class Seq> void purge(Seq& c, const std::vector<bool>& isAllocatedIn)
{
typename Seq::iterator i;
std::vector<bool>::const_iterator it = isAllocatedIn.begin();
for (i = c.begin(); i != c.end(); ++i)
{
if (*it ++) delete *i;
*i = NULL;
}
}
示例8: processObjects
void XMLPrintVisitor::processObjects(Seq& list)
{
if (list.empty()) return;
// the following line breaks the compilator on Visual2003
//for_each<XMLPrintVisitor, Seq, typename Seq::value_type>(this, list, &XMLPrintVisitor::processObject<typename Seq::value_type>);
for (typename Seq::iterator it = list.begin(); it != list.end(); ++it)
{
typename Seq::value_type obj = *it;
this->processObject<typename Seq::value_type>(obj);
}
}
示例9: Real
void Contact3D::draw(const Contact3D::Appearance& appearance, const Seq& contacts, const golem::Mat34& pose, golem::DebugRenderer& renderer) {
if (appearance.pointsShow) {
Real norm = Real(golem::numeric_const<U8>::MAX);
if (appearance.pointSize > REAL_ZERO) {
renderer.setPointSize(appearance.pointSize);
norm *= golem::Sample<Real>::getNormWeight<golem::Ref1>(contacts);
}
for (Contact3D::Seq::const_iterator i = contacts.begin(); i != contacts.end(); ++i)
i->draw(appearance, pose, renderer, U8(norm*i->weight));
}
if (appearance.boundsFrameShow)
renderer.addAxes(pose, appearance.boundsFrameSize);
}
示例10: average_func
double average_func(Seq &sq) {
if (sq.empty())
return 0;
double av=0;
typename Seq::iterator it = sq.begin();
while(it != sq.end())
av+=*(it++);
av=av/sq.size();
return av;
}
示例11: average_pf
double average_pf(Seq &sq) {
double av=0;
int h=0;
typename Seq::iterator it = sq.begin();
while(it != sq.end()) {
av+=*(it)*h;
it++;
h++;
}
return av;
}
示例12: rbpose
void golem::Contact3D::drawPoints(const Seq& contacts, const golem::RGBA& colour, golem::Real normalLen, const golem::Mat34& pose, golem::DebugRenderer& renderer) {
const RBCoord rbpose(pose);
const Real norm = Real(golem::numeric_const<U8>::MAX)*golem::Sample<Real>::getNormWeight<golem::Ref1>(contacts);
for (Contact3D::Seq::const_iterator j = contacts.begin(); j != contacts.end(); ++j) {
RBCoord frame;
frame.setInverse(j->local);
frame.multiply(rbpose, frame);
const RGBA colour(colour._rgba.r, colour._rgba.g, colour._rgba.b, U8(norm*j->weight));
renderer.addPoint(frame.p, colour);
if (normalLen > REAL_EPS) {
Vec3 z;
frame.q.multiply(z, Vec3::axisZ());
Vec3 p;
p.multiplyAdd(normalLen, z, frame.p);
renderer.addLine(frame.p, p, colour);
}
}
}
示例13: begin
T* begin(){
return seq.begin();
}
示例14: f
void f(const Seq& seq)
{
find(seq.begin(), seq.end(), 7);
}
示例15: none
bool none(Seq const& s, Pred const& p) {
for (typename Seq::const_iterator i = s.begin(), e = s.end(); i!=e; ++i)
if (p(*i)) return false;
return true;
}