这篇教程C++ xs函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中xs函数的典型用法代码示例。如果您正苦于以下问题:C++ xs函数的具体用法?C++ xs怎么用?C++ xs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了xs函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: assertvoid GaussianProcess::update_K(bool all){ //const unsigned int start_idx = all? last_x_size : 0; const unsigned int start_idx = 0; const unsigned int x_len = xs.size() - start_idx;// const unsigned int num_rows = K.rows();// const unsigned int num_cols = K.cols(); /* if (!all){ assert(num_rows < last_x_size); } */ //K.resize(num_rows+x_len,num_cols+x_len); K.resize(x_len,+x_len); for (unsigned int i = 0; i < xs.size(); ++i) { for (unsigned int j = start_idx; j < xs.size(); ++j) { const double diff = kernel->eval(xs(j),xs(i)); std::cout << "diff: " << diff << std::endl; if (diff != diff){ exit(-1); } K(i,j) = diff; K(j,i) = diff; } } stale = false;}
开发者ID:perfortnight,项目名称:icra-2016,代码行数:27,
示例2: sse_teststatic voidsse_test (void){ assert (ys (1) == xs ()); assert (ys (2) == xs () * 2); assert (yd (1) == xd ()); assert (yd (2) == xd () * 2);}
开发者ID:IntegerCompany,项目名称:linaro-android-gcc,代码行数:8,
示例3: print_linevoidprint_line(line* t){ fprintf(outfile, "newpath/n"); fprintf(outfile, "4 setlinewidth/n"); fprintf(outfile, "0.3 setgray/n"); fprintf(outfile, "%f %f moveto/n", xs(t->v1[0]), ys(t->v1[1])); fprintf(outfile, "%f %f lineto/n", xs(t->v2[0]), ys(t->v2[1])); fprintf(outfile, "stroke/n");}
开发者ID:rsecchi,项目名称:optgene,代码行数:10,
示例4: print_circlevoid print_circle(){ fprintf(outfile, "newpath/n"); fprintf(outfile, "0 setgray/n"); fprintf(outfile, "1 setlinewidth/n"); fprintf(outfile, "%f %f %f 0 360 arc/n", (double)(xs(0)), (double)(ys(0)), (double)((xs(RADIUS))-(xs(0)))); fprintf(outfile, "stroke/n"); }
开发者ID:rsecchi,项目名称:optgene,代码行数:10,
示例5: print_proj_xyvoidprint_proj_xy(triangle* t){ fprintf(outfile, "newpath/n"); fprintf(outfile, "0.2 setlinewidth/n"); fprintf(outfile, "%f %f moveto/n", xs(t->v1[0]), ys(t->v1[1])); fprintf(outfile, "%f %f lineto/n", xs(t->v2[0]), ys(t->v2[1])); fprintf(outfile, "%f %f lineto/n", xs(t->v3[0]), ys(t->v3[1])); fprintf(outfile, "%f %f lineto/n", xs(t->v1[0]), ys(t->v1[1])); fprintf(outfile, "stroke/n");}
开发者ID:rsecchi,项目名称:optgene,代码行数:12,
示例6: assertvoidMockReadonlyIndex::build(SortableStrVec& keys) { const Schema* schema = m_schema; const byte* base = keys.m_strpool.data(); size_t fixlen = schema->getFixedRowLen(); if (fixlen) { assert(keys.m_index.size() == 0); assert(keys.str_size() % fixlen == 0); m_ids.resize_no_init(keys.str_size() / fixlen); for (size_t i = 0; i < m_ids.size(); ++i) m_ids[i] = i; std::sort(m_ids.begin(), m_ids.end(), [=](size_t x, size_t y) { fstring xs(base + fixlen * x, fixlen); fstring ys(base + fixlen * y, fixlen); int r = schema->compareData(xs, ys); if (r) return r < 0; else return x < y; }); } else { if (keys.str_size() >= UINT32_MAX) { THROW_STD(length_error, "keys.str_size=%lld is too large", llong(keys.str_size())); } // reuse memory of keys.m_index auto offsets = (uint32_t*)keys.m_index.data(); size_t rows = keys.m_index.size(); m_ids.resize_no_init(rows); for (size_t i = 0; i < rows; ++i) m_ids[i] = i; for (size_t i = 0; i < rows; ++i) { uint32_t offset = uint32_t(keys.m_index[i].offset); offsets[i] = offset; } offsets[rows] = keys.str_size(); std::sort(m_ids.begin(), m_ids.end(), [=](size_t x, size_t y) { size_t xoff0 = offsets[x], xoff1 = offsets[x+1]; size_t yoff0 = offsets[y], yoff1 = offsets[y+1]; fstring xs(base + xoff0, xoff1 - xoff0); fstring ys(base + yoff0, yoff1 - yoff0); int r = schema->compareData(xs, ys); if (r) return r < 0; else return x < y; }); BOOST_STATIC_ASSERT(sizeof(SortableStrVec::SEntry) == 4*3); m_keys.offsets.risk_set_data(offsets); m_keys.offsets.risk_set_size(rows + 1); m_keys.offsets.risk_set_capacity(3 * rows); m_keys.offsets.shrink_to_fit(); keys.m_index.risk_release_ownership(); } m_keys.strpool.swap((valvec<char>&)keys.m_strpool); m_fixedLen = fixlen;}
开发者ID:GreatStone,项目名称:terark-db,代码行数:52,
示例7: mainint main(){ unsigned long cpu_facilities; cpu_facilities = i386_cpuid (); if (cpu_facilities & bit_SSE) { assert (ys (1) == xs ()); assert (ys (2) == xs () * 2); assert (yd (1) == xd ()); assert (yd (2) == xd () * 2); } return 0;}
开发者ID:5432935,项目名称:crossbridge,代码行数:15,
示例8: validate_quant_solutionstatic void validate_quant_solution(ast_manager& m, expr* fml, expr* guard, qe::def_vector const& defs) { // verify: // new_fml => fml[t/x] scoped_ptr<expr_replacer> rep = mk_expr_simp_replacer(m); app_ref_vector xs(m); expr_substitution sub(m); for (unsigned i = 0; i < defs.size(); ++i) { xs.push_back(m.mk_const(defs.var(i))); sub.insert(xs.back(), defs.def(i)); } rep->set_substitution(&sub); expr_ref fml1(fml, m); (*rep)(fml1); expr_ref tmp(m); tmp = m.mk_not(m.mk_implies(guard, fml1)); front_end_params fp; smt::kernel solver(m, fp); solver.assert_expr(tmp); lbool res = solver.check(); //SASSERT(res == l_false); if (res != l_false) { std::cout << "Validation failed: " << res << "/n"; std::cout << mk_pp(tmp, m) << "/n"; model_ref model; solver.get_model(model); model_smt2_pp(std::cout, m, *model, 0); fatal_error(0); }}
开发者ID:CharudattaSChitale,项目名称:sygus-comp14,代码行数:29,
示例9: mainint main(int argc, char *argv[]){ QCoreApplication app(argc, argv); if (app.arguments().count() != 2) { std::cerr << qPrintable(Traverse::tr("Usage: traverse <XML file>")) << std::endl; return 1; } QFile file(app.arguments()[1]); if (!file.open(QFile::ReadOnly)) { std::cerr << qPrintable(Traverse::tr("Failed to open file: %1").arg(app.arguments()[1])) << std::endl; return 1; } //! [traverse document] QXmlStreamReader xs(&file); while (!xs.atEnd()) { if (xs.readNextStartElement()) std::cout << qPrintable(xs.name().toString()) << std::endl; } //! [traverse document] file.close(); return 0;}
开发者ID:Kwangsub,项目名称:qt-openwebos,代码行数:26,
示例10: xs void DOMElement::setTextContent(const std::wstring & ws) { if(isNull()) return; std::basic_string<XMLCh> xs(ws.begin(), ws.end()); XELEM(m_wrapped)->setTextContent(xs.c_str()); }
开发者ID:enuuros,项目名称:multitude,代码行数:9,
示例11: linSpaceVecstd::vector<T> linSpaceVec(T a, T b, size_t N) { T h = (b - a) / static_cast<T>(N-1); std::vector<T> xs(N); typename std::vector<T>::iterator x; T val; for (x = xs.begin(), val = a; x != xs.end(); ++x, val += h) *x = val; return xs;}
开发者ID:nebw,项目名称:gsoc2012,代码行数:9,
示例12: operator std::vector<T> operator()(std::size_t size) { // Generate double as many elements because many will be discarded by // applying unique. result_type xs(source(2 * size)); std::sort(xs.begin(), xs.end()); auto last = std::unique(xs.begin(), xs.end()); xs.erase(last, xs.end()); return std::move(xs); }
开发者ID:Doublle,项目名称:ogs,代码行数:10,
示例13: mainint main(){ std::vector<X> xs(10); set_parameter(xs, 42, &X::foo); set_parameter(xs, "hello world", &X::splurgle); for (auto const& x : xs) std::cout << x.foo << ", " << x.splurgle << "/n";}
开发者ID:CCJY,项目名称:coliru,代码行数:10,
示例14: linspace std::vector<T> linspace(T begin, T end, size_t n) { T h = (end - begin) / static_cast<T>(n-1); std::vector<T> xs(n); typename std::vector<T>::iterator it; T val; for (it = xs.begin(), val = begin; it != xs.end(); ++it, val += h) *it = val; return xs; }
开发者ID:Hugh-Shu-Wang,项目名称:OPTIONS,代码行数:10,
示例15: wide_check_boxboxwide_check_box (path ip, SI x1, SI x2, pencil pen) { SI width, height; get_wide_parameters (x1, x2, pen, width, height); array<box> bs (2); array<SI> xs (2); array<SI> ys (2); xs[0]= ys[0]= xs[1]= ys[1]= 0; bs[0]= line_box (decorate_middle (ip), 0, height, width/2, 0, pen); bs[1]= line_box (decorate_middle (ip), width/2, 0, width, height, pen); return composite_box (ip, bs, xs, ys);}
开发者ID:xywei,项目名称:texmacs,代码行数:12,
示例16: print_numbervoid print_number(triangle* t, int n){ float xbar, ybar; xbar = (t->v1[0] + t->v2[0] + t->v3[0])/3; ybar = (t->v1[1] + t->v2[1] + t->v3[1])/3; fprintf(outfile,"newpath/n"); fprintf(outfile,"%f %f moveto/n", xs(xbar), ys(ybar)); fprintf(outfile,"(%d) show/n", n); fprintf(outfile,"stroke/n"); }
开发者ID:rsecchi,项目名称:optgene,代码行数:13,
示例17: linspacestd::vector<double> linspace(const double low, const double high, const size_t n, double * const step /*= nullptr*/){ std::vector<double> xs(n); const double dx = (high - low)/(n - 1); if(step) *step = dx; for(size_t i = 0; i < n; ++i) { xs[i] = low + i*dx; } return xs;}
开发者ID:cglosser,项目名称:EMRG,代码行数:13,
示例18: xsvoid GaussianProcess::observe(double x, double y){ stale = true; last_x_size = xs.size(); const unsigned int x_size = xs.size(); const unsigned int y_size = ys.size(); xs.resize(x_size+1); ys.resize(y_size+1); xs(x_size) = x; ys(y_size) = y;}
开发者ID:perfortnight,项目名称:icra-2016,代码行数:13,
示例19: getCaptionInsetdocstring InsetCaptionable::getCaptionHTML(OutputParams const & runparams) const{ InsetCaption const * ins = getCaptionInset(); if (ins == 0) return docstring(); odocstringstream ods; XHTMLStream xs(ods); docstring def = ins->getCaptionAsHTML(xs, runparams); if (!def.empty()) // should already have been escaped xs << XHTMLStream::ESCAPE_NONE << def << '/n'; return ods.str();}
开发者ID:cburschka,项目名称:lyx,代码行数:14,
示例20: assert ExecStatus Distinct<View0,View1>::propagate(Space& home, const ModEventDelta&) { assert(x0.assigned()||x1.assigned()); if (x0.assigned()) { GlbRanges<View0> xr(x0); IntSet xs(xr); ConstSetView cv(home, xs); GECODE_REWRITE(*this,(DistinctDoit<View1>::post(home(*this),x1,cv))); } else { GlbRanges<View1> yr(x1); IntSet ys(yr); ConstSetView cv(home, ys); GECODE_REWRITE(*this,(DistinctDoit<View0>::post(home(*this),x0,cv))); } }
开发者ID:MGKhKhD,项目名称:easy-IP,代码行数:15,
示例21: wide_sqobr_boxboxwide_sqobr_box (path ip, SI x1, SI x2, pencil pen) { SI penw= pen->get_width (); pencil demipen= pencil (pen->get_color (), penw/2); path dip= decorate_middle (ip); SI width= max (x2-x1, 6*penw), height= 6*penw; array<box> bs (3); array<SI> xs (3); array<SI> ys (3); xs[0]= ys[0]= xs[1]= ys[1]= xs[2]= ys[2]= 0; bs[0]= line_box (dip, 0, height, width, height, pen); bs[1]= line_box (dip, 0, height, 0, 0, demipen); bs[2]= line_box (dip, width, height, width, 0, demipen); return composite_box (ip, bs, xs, ys);}
开发者ID:xywei,项目名称:texmacs,代码行数:15,
示例22: xsvoid MainWindow::setInitialTimeDisplay(int start){ std::size_t ncols = _vm["file.ncols"].as<int>(); std::size_t nrows = _vm["file.nrows"].as<int>(); //TODO: move plotting to appropiate method std::size_t numofplottedsamples = _vm["plot.num.samples"].as<int>(); _gridPlot->p->detachItems(); _gridPlot->setoffset(start); double interrowoffset = _vm["inter.row.offset"].as<double>(); for (std::size_t row=0; row<nrows; ++row){// for (std::size_t row=0; row<1; ++row){ std::vector<double> xs(numofplottedsamples); std::vector<double> ys(numofplottedsamples); std::stringstream strst; std::string strTitle = "Row"; strst << strTitle << "-" << row; strTitle = strst.str(); QwtPlotCurve *tscurve = new QwtPlotCurve((char *)strTitle.c_str()); for (std::size_t x = 0; x < numofplottedsamples; ++x) { if (x+start<ncols){ xs[x] = (x+start)/_gridPlot->gridXpixelsperunit; //position in seconds if (_bf!=NULL) { ys[x] = row*interrowoffset + (*_bf)(row,x+start)/_gridPlot->gridYpixelsperunit; //y value of that sample } else if (_bfsi!=NULL) { ys[x] = row*interrowoffset + (*_bfsi)(row,x+start)/_gridPlot->gridYpixelsperunit; //y value of that sample } } } tscurve->setSamples(&xs[0],&ys[0],xs.size()); tscurve->setPen(QPen(Qt::black)); QwtPlotMarker *rowNameText = new QwtPlotMarker(); rowNameText->setLabel(QString(strTitle.c_str())); rowNameText->setXValue(xs[0]+0.25); rowNameText->setYValue(row*interrowoffset-0.5); rowNameText->attach(_gridPlot->p); tscurve->attach(_gridPlot->p); } _gridPlot->resetzoom();}
开发者ID:pepoviru,项目名称:bfviewer,代码行数:47,
示例23: wide_vect_boxboxwide_vect_box (path ip, SI x1, SI x2, pencil pen) { SI penw= pen->get_width (); SI width, height, arrow= 2*penw, delta=penw/2; get_wide_parameters (x1, x2, pen, width, height); height= 10*penw; array<box> bs (3); array<SI> xs (3); array<SI> ys (3); xs[0]= ys[0]= xs[1]= ys[1]= xs[2]= ys[2]= 0; bs[0]= line_box (decorate_middle (ip), 0, arrow, width, arrow, pen); bs[1]= line_box (decorate_middle (ip), width- arrow- delta, 0, width, arrow, pen); bs[2]= line_box (decorate_middle (ip), width+ delta- arrow, 2*arrow, width, arrow, pen); return composite_box (ip, bs, xs, ys);}
开发者ID:xywei,项目名称:texmacs,代码行数:17,
示例24: xr ExecStatus Distinct<View0,View1>::post(Home home, View0 x, View1 y) { if (x.assigned()) { GlbRanges<View0> xr(x); IntSet xs(xr); ConstSetView cv(home, xs); GECODE_ES_CHECK((DistinctDoit<View1>::post(home,y,cv))); } if (y.assigned()) { GlbRanges<View1> yr(y); IntSet ys(yr); ConstSetView cv(home, ys); GECODE_ES_CHECK((DistinctDoit<View0>::post(home,x,cv))); } (void) new (home) Distinct<View0,View1>(home,x,y); return ES_OK; }
开发者ID:MGKhKhD,项目名称:easy-IP,代码行数:17,
示例25: PetscOptionsGetIntstd::vector<receiverStruct>receiver::getReceiversFromOptions(){ // get number of receivers PetscInt numReceivers; PetscOptionsGetInt(NULL, "--number_of_receivers", &numReceivers, NULL); // get base directory for where to write receivers char dumC[PETSC_MAX_PATH_LEN]; PetscOptionsGetString(NULL, "--base_write_directory", dumC, PETSC_MAX_PATH_LEN, NULL); std::string baseName = dumC; PetscOptionsGetString(NULL, "--iteration_name", dumC, PETSC_MAX_PATH_LEN, NULL); baseName += "/" + std::string(dumC) + "/receivers"; // make the base dir if (MPI::COMM_WORLD.Get_rank() == 0) { mkdir(baseName.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); } // get receiver parameters char *names[numReceivers]; PetscBool dumB = PETSC_FALSE; std::vector<PetscScalar> xs(numReceivers); std::vector<PetscScalar> ys(numReceivers); PetscOptionsGetStringArray(NULL, "--receiver_names", names, &numReceivers, NULL); PetscOptionsGetScalarArray(NULL, "--receiver_x", xs.data(), &numReceivers, NULL); PetscOptionsGetScalarArray(NULL, "--receiver_y", ys.data(), &numReceivers, NULL); PetscOptionsGetBool(NULL, "--write_receivers", &dumB, NULL); // add to structures std::vector<receiverStruct> receivers; for (auto i=0; i<numReceivers; i++) { receiverStruct r; r.name = baseName + "/" + names[i] + ".txt"; r.xLoc = xs[i]; r.yLoc = ys[i]; r.write = dumB; receivers.push_back(r); } return receivers;}
开发者ID:michael-afanasiev,项目名称:salvus2,代码行数:45,
示例26: typeset_as_boxboxtypeset_as_box (edit_env env, tree t, path ip) { box b= typeset_as_concat (env, t, ip); SI ox= 0; int i, n=N(b); for (i=0; i<n; i++) if (b[i]->w() != 0) ox= b[i]->x1; array<box> bs (1); array<SI> xs (1); array<SI> ys (1); bs[0]= b; xs[0]= ox; ys[0]= 0; return composite_box (ip, bs, xs, ys);}
开发者ID:mgubi,项目名称:texmacs,代码行数:18,
示例27: maxArea int maxArea(vector<int>& height) { auto comp = [&height](int a, int b) -> bool {return height[a] < height[b]; }; priority_queue<int, vector<int>, decltype(comp)> xs(comp); REP(i, height.size()) xs.push(i); int minx = xs.top(); int maxx = xs.top(); int ret = 0; xs.pop(); while (!xs.empty()) { minx = min(minx, xs.top()); maxx = max(maxx, xs.top()); ret = max(ret, (maxx - minx)*height[xs.top()]); // cout << xs.top() << ' ' << ret << endl; xs.pop(); } return ret; }
开发者ID:zhugelianglongming,项目名称:OJ,代码行数:18,
示例28: get_subwindow//////////////////////////////////////////////////////////////////////////////////////////////////////////get_subwindow with repeated valuescv::Mat get_subwindow(cv::Rect r, const cv::Mat & img){ std::vector<int> xs(r.width); cv::Mat out(r.height,r.width,CV_8U); for (int i = 0; i < r.width; i++) { xs[i] = r.x + i; if (xs[i] < 0) { xs[i] = 0; } else if (xs[i] >= img.cols) { xs[i] = img.cols-1; } } std::vector<int> ys(r.height); for (int i = 0; i < r.height; i++) { ys[i] = r.y + i; if (ys[i] < 0) { ys[i] = 0; } else if (ys[i] >= img.rows) { ys[i] = img.rows-1; } } for (int i = 0; i < r.width; i++) { for (int j = 0; j < r.height; j++) { out.at<unsigned char>(j,i) = img.at<unsigned char>(ys[j],xs[i]); } } //cv::imshow("subwindow",out.clone()); return out.clone();}
开发者ID:lbl1985,项目名称:toolbox_c,代码行数:45,
示例29: mainint main() { std::vector<int> x {3,2,1,4,5,6}; vectorSubrange<int> xs(x,2,3); std::vector<int>::iterator i = begin(xs); std::cout << *i << " " << *(i+2) << std::endl; constVectorSubrange<int> xss(x,2,-1); std::vector<int>::const_iterator it = begin(xss); std::cout << *it << " " << *(it+2) << std::endl; for ( auto ii=begin(xss); ii!=end(xss); ++ii) std::cout << *ii << ","; std::cout << std::endl; for ( auto ii : xss ) std::cout << ii << ","; std::cout << std::endl;}
开发者ID:lshort,项目名称:cpp_stuff,代码行数:19,
示例30: wide_tilda_boxboxwide_tilda_box (path ip, SI x1, SI x2, pencil pen) { SI width, height, w, h, uw, hh; get_wide_parameters (x1, x2, pen, width, height); h = height/2; hh= (SI) (0.8660254 * ((double) h)); w = width; uw= (SI) (((double) w) / 4.2679492); array<box> bs (3); array<SI> xs (3); array<SI> ys (3); xs[0]= ys[0]= xs[1]= ys[1]= xs[2]= ys[2]= 0; bs[0]= arc_box (decorate_middle (ip), 0, -h, 2*uw, h, 60<<6, 180<<6, pen); bs[1]= line_box (decorate_middle (ip), 3*uw/2, hh, w-(3*uw/2), h-hh, pen); bs[2]= arc_box (decorate_middle (ip), w- (2*uw), 0, w, 2*h, 240<<6, 360<<6, pen); return composite_box (ip, bs, xs, ys);}
开发者ID:xywei,项目名称:texmacs,代码行数:20,
注:本文中的xs函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ xsArg函数代码示例 C++ xreallocarray函数代码示例 |