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


C++ Samples::end方法代码示例

本文整理汇总了C++中Samples::end方法的典型用法代码示例。如果您正苦于以下问题:C++ Samples::end方法的具体用法?C++ Samples::end怎么用?C++ Samples::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Samples的用法示例。


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

示例1: createDataFile

void DocumentExporter::createDataFile(const Samples& samples, std::ostream& os, Image* textureImage)
{
  os << "{ \"frames\": {\n";
  for (Samples::const_iterator
         it = samples.begin(),
         end = samples.end(); it != end; ) {
    gfx::Size srcSize = it->originalSize();
    gfx::Rect spriteSourceBounds = it->trimmedBounds();
    gfx::Rect frameBounds = it->inTextureBounds();

    os << "   \"" << it->filename() << "\": {\n"
       << "    \"frame\": { "
       << "\"x\": " << frameBounds.x << ", "
       << "\"y\": " << frameBounds.y << ", "
       << "\"w\": " << frameBounds.w << ", "
       << "\"h\": " << frameBounds.h << " },\n"
       << "    \"rotated\": false,\n"
       << "    \"trimmed\": " << (it->trimmed() ? "true": "false") << ",\n"
       << "    \"spriteSourceSize\": { "
       << "\"x\": " << spriteSourceBounds.x << ", "
       << "\"y\": " << spriteSourceBounds.y << ", "
       << "\"w\": " << spriteSourceBounds.w << ", "
       << "\"h\": " << spriteSourceBounds.h << " },\n"
       << "    \"sourceSize\": { "
       << "\"w\": " << srcSize.w << ", "
       << "\"h\": " << srcSize.h << " },\n"
       << "    \"duration\": " << it->sprite()->getFrameDuration(it->frame()) << "\n"
       << "   }";

    if (++it != samples.end())
      os << ",\n";
    else
      os << "\n";
  }

  os << " },\n"
     << " \"meta\": {\n"
     << "  \"app\": \"" << WEBSITE << "\",\n"
     << "  \"version\": \"" << VERSION << "\",\n";
  if (!m_textureFilename.empty())
    os << "  \"image\": \"" << m_textureFilename.c_str() << "\",\n";
  os << "  \"format\": \"" << (textureImage->getPixelFormat() == IMAGE_RGB ? "RGBA8888": "I8") << "\",\n"
     << "  \"size\": { "
     << "\"w\": " << textureImage->getWidth() << ", "
     << "\"h\": " << textureImage->getHeight() << " },\n"
     << "  \"scale\": \"" << m_scale << "\"\n"
     << " }\n"
     << "}\n";
}
开发者ID:atzkey,项目名称:aseprite,代码行数:49,代码来源:document_exporter.cpp

示例2: clear

	void clear() {
		SamplesIterator i, end = samples.end();
		for (i = samples.begin(); i != end; ++i) {
			// delete object pointed to by Sample* pointer
			delete (*i);
		}
		samples.clear();
		byNames.clear();
		marker::manager.unref(markers);
	}
开发者ID:djhshih,项目名称:genomic,代码行数:10,代码来源:RawSampleSet.hpp

示例3: fitFromData

void BSplineInterpolation::fitFromData(const Samples &samples) {

    /* preprocess samples and extract some info */
    Samples ssamples = samples;
    std::sort(ssamples.begin(), ssamples.end());
    const int numSamples = ssamples.size();
    const float minSampleX = ssamples[0].first;
    const float maxSampleX = ssamples.back().first;

    /* prepare fitting data */
    gsl_vector *x = gsl_vector_alloc(ssamples.size());
    gsl_vector *y = gsl_vector_alloc(ssamples.size());

    for (int i=0; i<ssamples.size(); i++) {
        gsl_vector_set(x, i, ssamples[i].first);
        gsl_vector_set(y, i, ssamples[i].second);
    }

    /* uniform knots distributed in sample range */
    gsl_bspline_knots_uniform(minSampleX, maxSampleX, bSplineWorkspace);

    /* construct a fit matrix */
    gsl_matrix *fitMatrix = gsl_matrix_alloc(numSamples, nCoeffs);
    for (int i=0; i<numSamples; i++) {
        /* compute B_j(xi) for all j */
        double xi = gsl_vector_get(x, i);
        gsl_bspline_eval(xi, bSpline, bSplineWorkspace);

        /* fill in row i */
        for (int j=0; j<nCoeffs; j++) {
            double Bj = gsl_vector_get(bSpline, j);
            gsl_matrix_set(fitMatrix, i, j, Bj);
        }
    }

    /* fit spline to data */
    gsl_multifit_linear_workspace *mws = 
        gsl_multifit_linear_alloc(numSamples, nCoeffs);
    double chisq;
    size_t rank;
    double tol = 0.1;
    gsl_multifit_linear(fitMatrix, y, cParameters, covMatrix, &chisq, mws);
    //gsl_multifit_linear_svd(fitMatrix, y, tol,
    //        &rank, cParameters, covMatrix, &chisq, mws);

    splineMinX = minSampleX;
    splineMaxX = maxSampleX;

    /* clean up */
    gsl_vector_free(x);
    gsl_vector_free(y);
    gsl_matrix_free(fitMatrix);
    gsl_multifit_linear_free(mws);
    
}
开发者ID:aurelw,项目名称:beholder,代码行数:55,代码来源:bsplineinterpolation.cpp

示例4: if

void
diy::detail::KDTreeSamplingPartition<Block,Point>::
operator()(Block* b, const diy::ReduceProxy& srp, const KDTreePartners& partners) const
{
    int dim;
    if (srp.round() < partners.rounds())
        dim = partners.dim(srp.round());
    else
        dim = partners.dim(srp.round() - 1);

    if (srp.round() == partners.rounds())
        update_links(b, srp, dim, partners.sub_round(srp.round() - 2), partners.swap_rounds(), partners.wrap, partners.domain); // -1 would be the "uninformative" link round
    else if (partners.swap_round(srp.round()) && partners.sub_round(srp.round()) < 0)       // link round
    {
        dequeue_exchange(b, srp, dim);         // from the swap round
        split_to_neighbors(b, srp, dim);
    }
    else if (partners.swap_round(srp.round()))
    {
        Samples samples;
        receive_samples(b, srp, samples);
        enqueue_exchange(b, srp, dim, samples);
    } else if (partners.sub_round(srp.round()) == 0)
    {
        if (srp.round() > 0)
        {
            int prev_dim = dim - 1;
            if (prev_dim < 0)
                prev_dim += dim_;
            update_links(b, srp, prev_dim, partners.sub_round(srp.round() - 2), partners.swap_rounds(), partners.wrap, partners.domain);    // -1 would be the "uninformative" link round
        }

        compute_local_samples(b, srp, dim);
    } else if (partners.sub_round(srp.round()) < (int) partners.histogram.rounds()/2)     // we are reusing partners class, so really we are talking about the samples rounds here
    {
        Samples samples;
        add_samples(b, srp, samples);
        srp.enqueue(srp.out_link().target(0), samples);
    } else
    {
        Samples samples;
        add_samples(b, srp, samples);
        if (samples.size() != 1)
        {
            // pick the median
            std::nth_element(samples.begin(), samples.begin() + samples.size()/2, samples.end());
            std::swap(samples[0], samples[samples.size()/2]);
            //std::sort(samples.begin(), samples.end());
            //samples[0] = (samples[samples.size()/2] + samples[samples.size()/2 + 1])/2;
            samples.resize(1);
        }
        forward_samples(b, srp, samples);
    }
}
开发者ID:sujin-philip,项目名称:diy2,代码行数:54,代码来源:kdtree-sampling.hpp

示例5: renderTexture

void DocumentExporter::renderTexture(const Samples& samples, Image* textureImage)
{
  textureImage->clear(0);

  for (Samples::const_iterator
         it = samples.begin(),
         end = samples.end(); it != end; ++it) {
    // Make the sprite compatible with the texture so the render()
    // works correctly.
    if (it->sprite()->getPixelFormat() != textureImage->getPixelFormat()) {
      DocumentApi docApi(it->document(), NULL); // DocumentApi without undo
      docApi.setPixelFormat(it->sprite(), textureImage->getPixelFormat(),
        DITHERING_NONE);
    }

    it->sprite()->render(textureImage,
      it->inTextureBounds().x - it->trimmedBounds().x,
      it->inTextureBounds().y - it->trimmedBounds().y,
      it->frame());
  }
}
开发者ID:atzkey,项目名称:aseprite,代码行数:21,代码来源:document_exporter.cpp

示例6: record

void NonCalls::record(const string& seqName, long pos, const Samples& samples) {
    map<string, NonCall>& site = (*this)[seqName][pos];
    for (Samples::const_iterator s = samples.begin(); s != samples.end(); ++s) {
        // tally ref and non-ref alleles
        const string& name = s->first;
        const Sample& sample = s->second;
        NonCall& noncall = site[name];
        for (Sample::const_iterator a = sample.begin(); a != sample.end(); ++a) {
            const vector<Allele*>& alleles = a->second;
            for (vector<Allele*>::const_iterator o = alleles.begin(); o != alleles.end(); ++o) {
                Allele& allele = **o;
                if (allele.isReference()) {
                    ++noncall.refCount;
                    noncall.reflnQ += allele.lnquality;
                } else {
                    ++noncall.altCount;
                    noncall.altlnQ += allele.lnquality;
                }
            }
        }
    }
}
开发者ID:ekg,项目名称:freebayes,代码行数:22,代码来源:NonCall.cpp

示例7: test_set_ae

double test_set_ae(DBN& dbn, const Samples& images) {
    return test_set_ae(dbn, images.begin(), images.end());
}
开发者ID:jkhoogland,项目名称:dll,代码行数:3,代码来源:test.hpp

示例8: test_set

double test_set(DBN& dbn, const Samples& images, const Labels& labels, Functor&& f) {
    return test_set(dbn, images.begin(), images.end(), labels.begin(), labels.end(), std::forward<Functor>(f));
}
开发者ID:jkhoogland,项目名称:dll,代码行数:3,代码来源:test.hpp

示例9: train_denoising

 double train_denoising(const Samples& noisy, const Samples& clean, std::size_t max_epochs, Args... args) {
     dll::rbm_trainer<parent_t, EnableWatcher, RW, true> trainer(args...);
     return trainer.train(as_derived(), noisy.begin(), noisy.end(), clean.begin(), clean.end(), max_epochs);
 }
开发者ID:hal2001,项目名称:dll,代码行数:4,代码来源:rbm_base.hpp

示例10: train

 double train(const Samples& training_data, std::size_t max_epochs, Args... args) {
     dll::rbm_trainer<parent_t, EnableWatcher, RW, false> trainer(args...);
     return trainer.train(as_derived(), training_data.begin(), training_data.end(), max_epochs);
 }
开发者ID:hal2001,项目名称:dll,代码行数:4,代码来源:rbm_base.hpp

示例11: filter

	void filter(const marker::Set& refMarkers) {
		if (markers == NULL) {
			throw invalid_argument("Markers in sample set are missing.");
		}
		
		// flag markers for removal
		markers->filter(refMarkers);
		
		if (samples.size() > 0) {
		
			// Create copy of samples with only unflagged markers
			
			// Shallow copy current samples (copy pointers)
			Samples oldSamples = samples;
			
			// clear current data
			samples.clear();
			byNames.clear();
			
			// pre-allocate space
			samples.resize(oldSamples.size());
			for (size_t sampleIndex = 0; sampleIndex < oldSamples.size(); ++sampleIndex) {
				// iterate through chromosomes
				for (size_t chromIndex = 0; chromIndex < oldSamples[0]->size(); ++chromIndex) {
					// resize chromosome to be as big as chromosome from old sample
					samples[sampleIndex]->resizeChromosome(chromIndex, (*oldSamples[sampleIndex])[chromIndex].size());
				}
			}
			
			// copy data from unflagged markers
			const size_t chromEnd = markers->size();
			vector<size_t> validMarkersCounts(chromEnd);
			for (size_t chromIndex = 0; chromIndex < chromEnd; ++chromIndex) {
				const size_t numMarkers = (*markers)[chromIndex].size();
				validMarkersCounts[chromIndex] = 0;
				for (size_t markerIndex = 0; markerIndex < numMarkers; ++markerIndex) {
					// only copy unflagged markers
					if (!(*markers)[chromIndex][markerIndex]->flag) {
						// copy marker values from oldSamples
						const size_t numSamples = oldSamples.size();
						for (size_t sampleIndex = 0; sampleIndex < numSamples; ++sampleIndex) {
							(*samples[sampleIndex])[chromIndex][validMarkersCounts[chromIndex]] = (*oldSamples[sampleIndex])[chromIndex][markerIndex];
						}
						++validMarkersCounts[chromIndex];
					}
				}
			}
			
			// shrink new sample chromosomes to match new size
			SamplesIterator it, end = samples.end();
			for (it = samples.begin(); it != end; ++it) {
				for (size_t chromIndex = 0; chromIndex < chromEnd; ++chromIndex) {
					(**it).resizeChromosome(chromIndex, validMarkersCounts[chromIndex]);
				}
			}
			
			// clear old samples
			end = oldSamples.end();
			for (it = oldSamples.begin(); it != end; ++it) {
				delete (*it);
			}
			
		}
		
		// remove flagged markers
		markers->clean();
		
	}
开发者ID:djhshih,项目名称:genomic,代码行数:68,代码来源:RawSampleSet.hpp

示例12: main

// freebayes main
int main (int argc, char *argv[]) {

    // install segfault handler
    signal(SIGSEGV, segfaultHandler);

    AlleleParser* parser = new AlleleParser(argc, argv);
    Parameters& parameters = parser->parameters;
    list<Allele*> alleles;

    Samples samples;

    ostream& out = *(parser->output);

    Bias observationBias;
    if (!parameters.alleleObservationBiasFile.empty()) {
        observationBias.open(parameters.alleleObservationBiasFile);
    }

    Contamination contaminationEstimates(0.5+parameters.probContamination, parameters.probContamination);
    if (!parameters.contaminationEstimateFile.empty()) {
        contaminationEstimates.open(parameters.contaminationEstimateFile);
    }

    // this can be uncommented to force operation on a specific set of genotypes
    vector<Allele> allGenotypeAlleles;
    allGenotypeAlleles.push_back(genotypeAllele(ALLELE_GENOTYPE, "A", 1));
    allGenotypeAlleles.push_back(genotypeAllele(ALLELE_GENOTYPE, "T", 1));
    allGenotypeAlleles.push_back(genotypeAllele(ALLELE_GENOTYPE, "G", 1));
    allGenotypeAlleles.push_back(genotypeAllele(ALLELE_GENOTYPE, "C", 1));

    int allowedAlleleTypes = ALLELE_REFERENCE;
    if (parameters.allowSNPs) {
        allowedAlleleTypes |= ALLELE_SNP;
    }
    if (parameters.allowIndels) {
        allowedAlleleTypes |= ALLELE_INSERTION;
        allowedAlleleTypes |= ALLELE_DELETION;
    }
    if (parameters.allowMNPs) {
        allowedAlleleTypes |= ALLELE_MNP;
    }
    if (parameters.allowComplex) {
        allowedAlleleTypes |= ALLELE_COMPLEX;
    }

    // output VCF header
    if (parameters.output == "vcf") {
        out << parser->variantCallFile.header << endl;
    }

    Allele nullAllele = genotypeAllele(ALLELE_NULL, "N", 1, "1N");

    unsigned long total_sites = 0;
    unsigned long processed_sites = 0;

    while (parser->getNextAlleles(samples, allowedAlleleTypes)) {

        ++total_sites;

        DEBUG2("at start of main loop");

        // don't process non-ATGC's in the reference
        string cb = parser->currentReferenceBaseString();
        if (cb != "A" && cb != "T" && cb != "C" && cb != "G") {
            DEBUG2("current reference base is N");
            continue;
        }

        if (parameters.trace) {
            for (Samples::iterator s = samples.begin(); s != samples.end(); ++s) {
                const string& name = s->first;
                for (Sample::iterator g = s->second.begin(); g != s->second.end(); ++g) {
                    vector<Allele*>& group = g->second;
                    for (vector<Allele*>::iterator a = group.begin(); a != group.end(); ++a) {
                        Allele& allele = **a;
                        parser->traceFile << parser->currentSequenceName << "," << (long unsigned int) parser->currentPosition + 1  
                                          << ",allele," << name << "," << allele.readID << "," << allele.base() << ","
                                          << allele.currentQuality() << "," << allele.mapQuality << endl;
                    }
                }
            }
            DEBUG2("after trace generation");
        }

        if (!parser->inTarget()) {
            DEBUG("position: " << parser->currentSequenceName << ":" << (long unsigned int) parser->currentPosition + 1
                  << " is not inside any targets, skipping");
            continue;
        }

        int coverage = countAlleles(samples);

        DEBUG("position: " << parser->currentSequenceName << ":" << (long unsigned int) parser->currentPosition + 1 << " coverage: " << coverage);

        if (!parser->hasInputVariantAllelesAtCurrentPosition()) {
            // skips 0-coverage regions
            if (coverage == 0) {
                DEBUG("no alleles left at this site after filtering");
                continue;
//.........这里部分代码省略.........
开发者ID:a113n,项目名称:freebayes,代码行数:101,代码来源:freebayes.cpp


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