コード例 #1
0
ファイル: combinatorics.cpp プロジェクト: Aleyasen/Alaki
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
0
ファイル: buffers.cpp プロジェクト: alexeimoisseev/NwSMTP
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
0
ファイル: combinatorics.cpp プロジェクト: Aleyasen/Alaki
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
0
ファイル: gen_sbs_0.cpp プロジェクト: oakad/ucpf
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
0
ファイル: MuscleUtils.cpp プロジェクト: ggrekhov/ugene
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
0
ファイル: MTCAgentCmd.cpp プロジェクト: johnmichaloski/CMSD
template<class Seq> void purge(Seq& c) 
{
	typename Seq::iterator i;
	for(i = c.begin(); i != c.end(); ++i) {
		delete *i;
		*i = 0;
	}
}
コード例 #7
0
ファイル: Tools.hpp プロジェクト: bremond/siconos
/** 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
0
ファイル: XMLPrintVisitor.cpp プロジェクト: 151706061/sofa
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
0
ファイル: Contact3D.cpp プロジェクト: marekkopicki/Golem
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
0
ファイル: combinatorics.cpp プロジェクト: Aleyasen/Alaki
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
0
ファイル: combinatorics.cpp プロジェクト: Aleyasen/Alaki
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
0
ファイル: Contact3D.cpp プロジェクト: marekkopicki/Golem
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
0
ファイル: TempTemp.cpp プロジェクト: githubcai/Thinking_In_C
 T* begin(){
     return seq.begin();
 }
コード例 #14
0
    void f(const Seq& seq)
    {
	find(seq.begin(), seq.end(), 7);
    }
コード例 #15
0
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;
}
コード例 #16
0
ファイル: temptemp4.cpp プロジェクト: jiaozi/design-pattern
void printSeq(Seq<T>& seq){
	for (typename Seq<T>::iterator iter = seq.begin(); iter != seq.end();)
	{
		std::cout << *iter++ << std::endl;
	}
}
コード例 #17
0
ファイル: PrintSeq.cpp プロジェクト: githubcai/Thinking_In_C
void printSeq(Seq<T>& seq) {
    for(typename Seq<T>::iterator b=seq.begin(); b!=seq.end();) {
        cout << *b++ << endl;
    }
}
コード例 #18
0
ファイル: TempTemp4.cpp プロジェクト: githubcai/Thinking_In_C
 typename Seq<T>::iterator begin(){
     return seq.begin();
 }