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


C++ chain函数代码示例

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


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

示例1: RunProof

void RunProof() {
  
  std::string filename = "/data/Phys/data/mcd02kpi_tracks9_merged.root";
  bool fileNotFound = gSystem->AccessPathName(filename.c_str());
  // if local file is not found use the EOS version
  if (fileNotFound) {
    filename = "root://eoslhcb.cern.ch//eos/lhcb/user/m/malexand/d2hh/secondariesTagging/mcd02kpi_tracks9_merged.root";
  }
  
  TChain chain("TrackFilter/DecayTree");
  chain.Add(filename.c_str());
  TDSet dset(chain);

  auto p = TProof::Open("");
  p->Process(&dset, "RadialSelector.C");

}
开发者ID:particleist,项目名称:PromptSecondaryLTUnb,代码行数:17,代码来源:RunProof.C

示例2: ising_entries_jnorm

void ising_entries_jnorm(options opts, int *buffer_sequenze, RandMT &generatore) {
    int L = opts.seq_len;
    int runs = opts.n_seq;
    double beta = opts.beta[0];

    vector<int> flipchain(L);
    vector<int> chain(L);
    vector<int> J(L);
    vector<double> prob(L);

    for (int i = 0; i < L; i++) {
        double r;
		//probabilita di trovare un flip, ovvero -1
        //J gaussiano (positivo)
        //r = generatore.semi_norm();
        //J uniforme [0,1] (positivo)
		//r = generatore.rand();
        //J uniforme [0,0.5] (positivo)
		r = generatore.get_double()/2;
		//J cost
		//r=1;

        prob[i] = exp(-2 * beta * r);
        prob[i] /= (1 + prob[i]);

        // J  +- 1
        //J[i] = 2 * (generatore() > .5) - 1;
        // J positivi
        J[i] = 1;
    }

    for (int i = 0; i < runs; i++) {
        chain[0] = 2 * (generatore.get_double() > .5) - 1;

        for (int k = 0; k < L; k++)
            flipchain[k] = (prob[k] > generatore.get_double()) ? -1 : 1;

        for (int k = 1; k < L; k++)
            chain[k] = flipchain[k] * chain[k - 1] * J[k];

        for (int k = 0; k < L; k++) {
            buffer_sequenze[i * L + k] = chain[k];
        }
    }

}
开发者ID:parpwhick,项目名称:Distanze_Ising,代码行数:46,代码来源:ising_disordinato.cpp

示例3: words

vector<DisambiguatedData> Disambiguator::disambiguate(
    const vector<PredisambiguatedData>& predisambiguated)
{
    // Create chain
    size_t size = predisambiguated.size();
    vector<wstring> words(size);
    vector<vector<wstring> > features(size);
    vector<wstring> labels(size);
    for (size_t chainIndex = 0; chainIndex < size; ++chainIndex)
    {
        words[chainIndex] = predisambiguated[chainIndex].content;
        features[chainIndex] = predisambiguated[chainIndex].features;
    }
    LinearCRF::Chain chain(
        std::move(words)
        , std::move(features)
        , std::move(labels)
        , vector<vector<wstring> >());
    vector<wstring> bestSequence;
    vector<double> bestSequenceWeights;
    this->Apply(chain, &bestSequence, &bestSequenceWeights);
    // Create disambiguated data
    vector<DisambiguatedData> disambiguatedData;
    for (size_t tokenIndex = 0; tokenIndex < size; ++tokenIndex)
    {
        wstring& label = bestSequence[tokenIndex];
        shared_ptr<Morphology> grammInfo = getBestGrammInfo(
                                               predisambiguated[tokenIndex], label);
        applyPostprocessRules(&label, grammInfo);
        const wstring& lemma
            = dictionary == 0 ? DICT_IS_NULL
              : *(grammInfo->lemma) == NOT_FOUND_LEMMA
              ? Tools::ToLower(predisambiguated[tokenIndex].content) : *(grammInfo->lemma);
        disambiguatedData.emplace_back(
            predisambiguated[tokenIndex].content
            , predisambiguated[tokenIndex].punctuation
            , predisambiguated[tokenIndex].source
            , predisambiguated[tokenIndex].isNextSpace
            , lemma
            , label
            , bestSequenceWeights[tokenIndex]
            , grammInfo->lemma_id);
    }
    return disambiguatedData;
}
开发者ID:Samsung,项目名称:veles.nlp,代码行数:45,代码来源:Disambiguator.cpp

示例4: LOG_FUNCTION

std::vector<Chain> Board::getAllEmptyChains ()
{
    LOG_FUNCTION(cout, "Board::getAllEmptyChains");

    std::vector<Chain> emptyChains;

    // A set of points that we've already examined. This helps prevents some
    // bad recursion and keeps a chain from being "found" once for each stone
    // in the chain.
    //
    ConstPointSet alreadyVisited;

    for (size_t row = 0; row < m_points.size(); ++row)
    {
        for (size_t column = 0; column < m_points[row].size(); ++column)
        {
            const Point & point = m_points[row][column];

            // We are only looking for points without a stone, so get out
            // of here if there is a stone on this point
            //
            if (point.getStoneColor() != StoneColor::NONE)
                continue;

            // If the point we are considering has already been visited,
            // then Chain's ctor will throw a PointVisitedAlreadyException
            // object. We can safely swallow that exception and move on
            // to the next point.
            //
            try
            {
                // TODO: figure out why this didn't work... emptyChains.emplace_back(StoneColor::NONE, point, *this, &alreadyVisited);
                Chain chain(StoneColor::NONE, point, *this, &alreadyVisited);
                emptyChains.push_back(chain);
                gLogger.log(LogLevel::kMedium, cout, "Discovered empty chain"); // " : ", chain);
            }
            catch (const Chain::PointVisitedAlreadyException & ex)
            {
                gLogger.log(LogLevel::kFirehose, cout, "Skipping ", point);
            }
        }
    }

    return emptyChains;
}
开发者ID:michaelbprice,项目名称:21st_century_native_programming,代码行数:45,代码来源:Board.cpp

示例5: main

void main()
{
	int i,q,n;
	clrscr();
	printf("\n Number Of Matrix :");
	scanf("%d",&q);

	for(i=1;i<=q+1;i++)
	{
		printf("r[%d] :",i);
		scanf("%d",&r[i]);
	}
	chain(q);
	printf("\n\n Total Computation : %5d",c[1][5]);
	printf("\n\n Kay Value : %5d",kay[1][q]);

	traceback(1,q);
getch();
}
开发者ID:ganeshpaib,项目名称:CollegePrograms,代码行数:19,代码来源:CHAIN(IT.CPP

示例6: input2form

static void input2form(TInput *v, Tform **t) {
    TGrid *from, *to;
    TTex  *tex;
    if (Grid) {
        from = &v->f;
        to   = &v->t;
        grid_log(from);
        grid_log(to);
        tform_grid2grid(from->lo, from->hi, from->n,
                          to->lo, to->hi,   to->n, /**/ *t);
    } else if (Tex) {
        tex = &v->tex;
        tex2sdf_ini(coords, tex->T, tex->N, tex->M, /**/ *t);
    } else {
        UC(tform_vector(v->v.a0, v->v.a1,
                        v->v.b0, v->v.b1, /**/ *t));
        if (Chain) chain(v, t);
    }
}
开发者ID:uDeviceX,项目名称:uDeviceX,代码行数:19,代码来源:main.cpp

示例7: create_simplified_along_backbone

Hierarchy create_simplified_along_backbone(Hierarchy in,
                                           int num_res,
                                           bool keep_detailed) {
  Hierarchies chains= get_by_type(in, CHAIN_TYPE);
  if (chains.size() > 1) {
    Hierarchy root= Hierarchy::setup_particle(new Particle(in->get_model(),
                                                           in->get_name()));
    for (unsigned int i=0; i< chains.size(); ++i) {
      Chain chain(chains[i].get_particle());
      root.add_child(create_simplified_along_backbone(chain, num_res));
    }
    return root;
  } else if (chains.size()==1) {
    // make sure to cast it to chain to get the right overload
    return create_simplified_along_backbone(Chain(chains[0]), num_res,
                                            keep_detailed);
  } else {
    IMP_THROW("No chains to simplify", ValueException);
  }
}
开发者ID:drussel,项目名称:imp,代码行数:20,代码来源:hierarchy_tools.cpp

示例8: checkIn

void checkIn( const boost::program_options::variables_map & options )
{
	BACKTRACE_BEGIN
	boost::filesystem::path reportFile = options[ "reportFile" ].as< std::string >();
	unsigned reportIntervalSeconds = options[ "reportIntervalSeconds" ].as< unsigned >();
	boost::filesystem::path workDir = stripTrailingSlash( options[ "arg1" ].as< std::string >() );
	std::string label = options[ "arg2" ].as< std::string >();
	Osmosis::Chain::Chain chain( options[ "objectStores" ].as< std::string >(), false, false );
	if ( chain.count() > 1 )
		THROW( Error, "--objectStores must contain one object store in a checkin operation" );
	bool md5 = options.count( "MD5" ) > 0;

	boost::filesystem::path draftsPath = workDir / Osmosis::ObjectStore::DirectoryNames::DRAFTS;
	if ( boost::filesystem::exists( draftsPath ) )
		THROW( Error, "workDir must not contain " << draftsPath );

	Osmosis::Client::CheckIn instance( workDir, label, chain.single(), md5, reportFile, reportIntervalSeconds );
	instance.go();
	BACKTRACE_END
}
开发者ID:LightBitsLabs,项目名称:osmosis,代码行数:20,代码来源:main.cpp

示例9: chain

int chain(uint64_t x)
{
	uint64_t y, z;

	if (found[x/8] & (1 << (x%8)))
		return result[x/8] & (1 << (x%8));

	y = 0; z = x;
	while (z) {
		y += (z % 10) * (z % 10);
		z /= 10;
	}

	z = chain(y);
	found[x/8] |= (1 << (x%8));
	if (z)
		result[x/8] |= (1 << (x%8));

	return z;
}
开发者ID:enfiskutensykkel,项目名称:euler,代码行数:20,代码来源:chain.c

示例10: main

int main(){
	int ceiling = 1000000;
	int curStart = 1;
	long max = 0;
	long value = 1;
	long count = 0;
	while (curStart <= ceiling){
		value = curStart;
		count = 0;
		while (value != 1){
			value = chain(value);
			count++;
		}
		if (count > max){ max = count; printf("%d has a chain of %ld\n", curStart, max);}
		curStart++;
	}

	return 0;

}
开发者ID:sihrc,项目名称:Personal-Code-Bin,代码行数:20,代码来源:problem_14.cpp

示例11: univht_traverse

void univht_traverse(univht *ht, univht_visitor visitor, void *state) {

	int slot;

	/* Traverse every key in the table */
	for (slot = 0; ht->entries; slot++) {

		void *entry;

		/* Traverse the chain */
		for (entry = ht->table[slot]; entry != NULL; entry = chain(ht, entry)) {

			/* Invoke visitor on entry, propagating state changes */
			state = visitor(entry, state);

		}

	}

}
开发者ID:DhruvRelwani,项目名称:GamesmanClassic,代码行数:20,代码来源:univht.c

示例12: run_sample_osx

int run_sample_osx(const long num_events = -1)
{
    // load relevant libaries
    gSystem->Load("$CMSSW_BASE/lib/$SCRAM_ARCH/libPackagesLooperTools.dylib");
    gSystem->Load("$CMSSW_BASE/lib/$SCRAM_ARCH/libAnalysisExampleCMS2Looper.dylib");

    // simple style
    gROOT->SetStyle("Plain");
    gStyle->SetOptStat(111111);

    LoadFWLite();
    TChain chain("Events");
    chain.Add("/nfs-7/userdata/rwkelley/cms2/dyjets_ntuple_slim_10k_53X_v2.root");

    CMS2Looper looper("output/dy_plots.root");
    looper.SetRunList("json/Merged_190456-208686_8TeV_PromptReReco_Collisions12_goodruns.txt");
    std::cout << "running cms2 looper..." << std::endl;
    looper.ScanChain(chain, num_events);

    return 0;
}
开发者ID:ashrafkasem,项目名称:AnalysisTutorial,代码行数:21,代码来源:run_sample_osx.C

示例13: main

int main( void ) {
    // init
    time_t seed = time(NULL);
    printf("seed: %ld\n", seed);
    srand((unsigned int)seed); // might break in 2038
    aa_test_ulimit();

    for( size_t i = 0; i < 1000; i++ ) {
        /* Random Data */
        static const size_t k=2;
        double E[2][7], S[2][8], T[2][12], dx[2][6];
        for( size_t j = 0; j < k; j ++ ) {
            rand_tf(E[j], S[j], T[j]);
            aa_vrand(6,dx[j]);
        }
        //printf("%d\n",i);
        /* Run Tests */
        rotvec(E[0]);
        euler(dx[0]);
        euler1(dx[0]);
        eulerzyx(E[0]);
        chain(E,S,T);
        quat(E);
        duqu();
        rel_q();
        rel_d();
        slerp();
        theta2quat();
        rotmat(E[0]);
        tfmat();
        tfmat_inv(T[0]);
        mzlook(dx[0]+0, dx[0]+3, dx[1]+0);
        integrate(E[0], S[0], T[0], dx[0]);
        tf_conj(E, S);
        qdiff(E,dx);
    }


    return 0;
}
开发者ID:kingdwd,项目名称:amino,代码行数:40,代码来源:aa_fuzz_tf.c

示例14: run_loadfile

int
run_loadfile(u_long *marks, int howto)
{
	char bootline[512];		/* Should check size? */
	u_int32_t entry;
	char *cp;
	void *ssym, *esym;

	strlcpy(bootline, opened_name, sizeof bootline);
	cp = bootline + strlen(bootline);
	*cp++ = ' ';
        *cp = '-';
        if (howto & RB_ASKNAME)
                *++cp = 'a';
        if (howto & RB_CONFIG)
                *++cp = 'c';
        if (howto & RB_SINGLE)
                *++cp = 's';
        if (howto & RB_KDB)
                *++cp = 'd';
        if (*cp == '-')
		*--cp = 0;
	else
		*++cp = 0;

	entry = marks[MARK_ENTRY];
	ssym = (void *)marks[MARK_SYM];
	esym = (void *)marks[MARK_END];
	{
		u_int32_t lastpage;
		lastpage = roundup(marks[MARK_END], NBPG);
		OF_release((void*)lastpage, CLAIM_LIMIT - lastpage);
	}

	chain((void *)entry, bootline, ssym, esym);

	_rtt();
	return 0;
}
开发者ID:alenichev,项目名称:openbsd-kernel,代码行数:39,代码来源:main.c

示例15: univht_destroy

void univht_destroy(univht *ht) {
	int slot;

	/* Print statistical information about database */
	printf("Statistics:\n");
	printf("\tNumber of entries: %lu\n", ht->entries);
	printf("\tNumber of occupied slots: %lu\n", ht->stat_chains);
	printf("\tLength of longest chain: %lu\n", ht->stat_max_chain_length);
	printf("\tAverage chain length: %f\n", ht->stat_avg_chain_length);
	printf("\tTotal memory occupied: %lu bytes\n", ht->slots * sizeof(void *) + ht->entries * ht->stat_entry_size);
	printf("\tMemory occupied by entries: %lu bytes\n", ht->entries * ht->stat_entry_size);

	for (slot = 0; ht->entries; slot++) {

		/* Traverse the chain */
		while (ht->table[slot]) {

			void *entry = ht->table[slot];

			/* Link the slot to chain of object moved */
			ht->table[slot] = chain(ht, entry);

			/* Invoke entry object destructor */
			ht->destructor(entry);

			/* Decrement number of entries in hash table */
			ht->entries--;

		}

	}

	/* Free slots of hash table */
	free(ht->table);

	/* Free actual hash table */
	free(ht);

}
开发者ID:DhruvRelwani,项目名称:GamesmanClassic,代码行数:39,代码来源:univht.c


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