• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ orig函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: classicRcppStringVectorExample

RcppExport SEXP classicRcppStringVectorExample(SEXP strvec) {

    SEXP rl = R_NilValue; 		// Use this when there is nothing to be returned.
    char *exceptionMesg = NULL;

    try {

	RcppStringVector orig(strvec);
	RcppStringVector vec(strvec);
	
	for (int i=0; i<orig.size(); i++) {
	    std::transform(orig(i).begin(), orig(i).end(), 
			   vec(i).begin(), ::tolower);	
	}
	// Build result set to be returned as a list to R.
	RcppResultSet rs;

	rs.add("result",  vec);
	rs.add("original", orig);

	// Get the list to be returned to R.
	rl = rs.getReturnList();
	
    } catch(std::exception& ex) {
	exceptionMesg = copyMessageToR(ex.what());
    } catch(...) {
	exceptionMesg = copyMessageToR("unknown reason");
    }
    
    if(exceptionMesg != NULL)
	Rf_error(exceptionMesg);

    return rl;
}
开发者ID:cran,项目名称:RcppClassicExamples,代码行数:34,代码来源:classicRcppStringVectorExample.cpp


示例2: dijkstra

  bool dijkstra() {
    priority_queue<pair<double, pair<int, int> > > q;
    vi ent(sz(adj), -2);
    vd dist(sz(adj), INF);
    fu(u, sz(adj)) if (imb[u] >= delta)
      q.push(make_pair(0.0, make_pair(u, -1)));

    while (!q.empty()) {
      int u = q.top().second.first, f = q.top().second.second;
      double d = -q.top().first; q.pop();
      if (ent[u] != -2) continue; dist[u] = d; ent[u] = f;
			for (int a : adj[u]) if (capres(a) >= delta)
        q.push(make_pair(-(dist[u] + rescost(a)), make_pair(dest[a], a)));
    }

    fu(u, sz(adj)) if (ent[u] != -2 && imb[u] <= -delta) {
      fu(v, sz(adj)) pot[v] += dist[v];
      for (int a = ent[u]; a != -1; a = ent[orig(a)]) {
        flow[a] += delta;
        flow[inv(a)] -= delta;
        imb[dest[a]] += delta;
        imb[orig(a)] -= delta;
      }
      return true;
    }
    return false;
  }
开发者ID:danielf,项目名称:lib-puc-icpc,代码行数:27,代码来源:graph.cpp


示例3: spsorty

// Recursive Delaunay Triangulation Procedure
// Contains modifications for axis-switching division.
void CDelaunay::build(int lo, int hi, EdgePointer *le, EdgePointer *re, int rows)
{
  EdgePointer a, b, c, ldo, rdi, ldi, rdo, maxx, minx;
  int split, lowrows;
  int low, high;
  SitePointer s1, s2, s3;
  low = lo;
  high = hi;

  if ( low < (high-2) ) {
    // more than three elements; do recursion
    minx = sp[low];
    maxx = sp[high];
    if (rows == 1) {    // time to switch axis of division
      spsorty( sp, low, high);
      rows = 65536;
    }
    lowrows = rows/2;
    split = low - 1 + (int)
      (0.5 + ((double)(high-low+1) * ((double)lowrows / (double)rows)));
    build( low, split, &ldo, &ldi, lowrows );
    build( split+1, high, &rdi, &rdo, (rows-lowrows) );
    doMerge(&ldo, ldi, rdi, &rdo);
    while (orig(ldo) != minx) {
      ldo = rprev(ldo);
    }
    while (orig(rdo) != maxx) {
      rdo = (SitePointer) lprev(rdo);
    }
    *le = ldo;
    *re = rdo;
  }
  else if (low >= (high - 1)) { // two or one points
    a = makeEdge(sp[low], sp[high]);
    *le = a;
    *re = (EdgePointer) sym(a);
  } else { // three points
    // 3 cases: triangles of 2 orientations, and 3 points on a line
    a = makeEdge((s1 = sp[low]), (s2 = sp[low+1]));
    b = makeEdge(s2, (s3 = sp[high]));
    splice((EdgePointer) sym(a), b);
    if (ccw(s1, s3, s2)) {
      c = connectLeft(b, a);
      *le = (EdgePointer) sym(c);
      *re = c;
    } else {
      *le = a;
      *re = (EdgePointer) sym(b);
      if (ccw(s1, s2, s3)) {
        // not colinear
        c = connectLeft(b, a);
      }
    }
  }
}
开发者ID:cile,项目名称:android_packages_apps_Camera,代码行数:57,代码来源:Delaunay.cpp


示例4: TestArmadilloSerialization

void TestArmadilloSerialization(MatType& x)
{
  // First save it.
  std::ofstream ofs("test", std::ios::binary);
  OArchiveType o(ofs);

  bool success = true;
  try
  {
    o << BOOST_SERIALIZATION_NVP(x);
  }
  catch (boost::archive::archive_exception& e)
  {
    success = false;
  }

  BOOST_REQUIRE_EQUAL(success, true);
  ofs.close();

  // Now load it.
  MatType orig(x);
  success = true;
  std::ifstream ifs("test", std::ios::binary);
  IArchiveType i(ifs);

  try
  {
    i >> BOOST_SERIALIZATION_NVP(x);
  }
  catch (boost::archive::archive_exception& e)
  {
    success = false;
  }

  BOOST_REQUIRE_EQUAL(success, true);

  BOOST_REQUIRE_EQUAL(x.n_rows, orig.n_rows);
  BOOST_REQUIRE_EQUAL(x.n_cols, orig.n_cols);
  BOOST_REQUIRE_EQUAL(x.n_elem, orig.n_elem);

  for (size_t i = 0; i < x.n_cols; ++i)
    for (size_t j = 0; j < x.n_rows; ++j)
      if (double(orig(j, i)) == 0.0)
        BOOST_REQUIRE_SMALL(double(x(j, i)), 1e-8);
      else
        BOOST_REQUIRE_CLOSE(double(orig(j, i)), double(x(j, i)), 1e-8);

  remove("test");
}
开发者ID:Falit,项目名称:mlpack,代码行数:49,代码来源:serialization.hpp


示例5: allocEdge

// Quad-edge manipulation primitives
EdgePointer CDelaunay::makeEdge(SitePointer origin, SitePointer destination)
{
  EdgePointer temp, ans;
  temp = allocEdge();
  ans = temp;

  onext(temp) = ans;
  orig(temp) = origin;
  onext(++temp) = (EdgePointer) (ans + 3);
  onext(++temp) = (EdgePointer) (ans + 2);
  orig(temp) = destination;
  onext(++temp) = (EdgePointer) (ans + 1);

  return(ans);
}
开发者ID:cile,项目名称:android_packages_apps_Camera,代码行数:16,代码来源:Delaunay.cpp


示例6: play

    void play() {
        for (int i = 0, s = m_inputs[0].count() ; i < s ; ++i ) {
            Photo& photo = m_inputs[0][i];
            QDir targetDir(m_targetDirectory);
            QString magick;
            QString baseFilename = targetDir.filePath(photo.getTag(TAG_NAME));
            QString ext;
            switch (m_fileType) {
            case OpSave::SaveFITS:
                ext = ".fits"; magick = "FITS"; break;
            case OpSave::SaveTIFF:
                ext = ".tif"; magick = "TIFF"; break;
            case OpSave::SaveJPEG:
                ext = ".jpg"; magick = "JPG"; break;
            }
            QFileInfo finfo(baseFilename + ext);
            if ( m_backup && finfo.exists() ) {
                QDateTime lastModified = finfo.lastModified();
                QString ts = lastModified.toString("yyyy'-'dd'-'MM'T'hh':'mm':'ss'.'zzz'Z'");
                QFile orig(baseFilename + ext);
                orig.rename(baseFilename + "-" + ts + ext);
            }
            QString filename = finfo.filePath();
            photo.save(filename, magick);
            emitProgress(i, s, 0, 1);
        }
        emitSuccess();

    }
开发者ID:ploki,项目名称:darkflow,代码行数:29,代码来源:opsave.cpp


示例7: orig

void AmeJobMan::setPath(AmeJob *job, wxString &path, bool parent){
	//synchronized(job){
		if(job->check(jS_DOING)) return;
		//int status = jFAILED;
		
		wxFileName orig(job->getNewFilePath().Length()>0?job->getNewFilePath():job->getAbsolutePath());
		wxString name;
		if(parent){
			wxFileName pp = orig.GetPath();
			//pp = pp.GetPath();
			name += pp.GetFullName()+wxT(FILE_SEPARATOR);
		}
		name += orig.GetFullName();
		wxString file = path+wxT(FILE_SEPARATOR)+name;
		
		if(job->getHealth()==jH_MISSING){
			job->find(file);
			A.m_db->update(dJ, 1, job);
		} else if(updatePath(job, file)){
			if(job->getNewFilePath().Length()>0)
				job->setStatus(jMOVEWAIT, true);
			//	status = jMOVEWAIT;
			//else
			//	status = jFINISHED;
			A.m_db->update(dJ, 1, job);
		}
	//}
}
开发者ID:arucard21,项目名称:AniDB,代码行数:28,代码来源:ame-job-man.cpp


示例8: glLoadIdentity

void GLWidget::mouseMoveEvent(QMouseEvent *event)
{

    if (!select(event)){

        glLoadIdentity();

        int dx = event->x() - lastPos.x();
        int dy = event->y() - lastPos.y();

        if (event->buttons() & Qt::LeftButton) {
            QMatrix4x4 mat(view[0],view[4],view[8],view[12],view[1],view[5],view[9],view[13],view[2],view[6],view[10],view[14],view[3],view[7],view[11],view[15]);
            QVector3D orig(0, 0, 0);
            QVector3D m = mat.map(orig);
            glTranslatef(m.x(), m.y(), m.z());
            glRotatef(qSqrt(dx*dx+dy*dy)/2.0, dy, dx, 0);
            glTranslatef(-m.x(), -m.y(), -m.z());
        } else if (event->buttons() & Qt::RightButton) {
            glTranslatef(dx/(float)width()*ar/scale, -dy/(float)height()/scale, 0);
        }
        lastPos = event->pos();
        glPushMatrix();
        glMultMatrixf(view);
        glGetFloatv(GL_MODELVIEW_MATRIX, view);
        glPopMatrix();
    }

    updateGL();
}
开发者ID:satra,项目名称:brainbundler,代码行数:29,代码来源:glwidget.cpp


示例9: main

int main ()
{
	kdb::KeySet orig (3, *kdb::Key ("user/key3/1", KEY_END), *kdb::Key ("user/key3/2", KEY_END),
			  *kdb::Key ("user/key3/3", KEY_VALUE, "value", KEY_END), KS_END);
	kdb::KeySet flatCopy (orig);
	kdb::KeySet deepCopy = ksDeepCopy (orig);
}
开发者ID:BernhardDenner,项目名称:libelektra,代码行数:7,代码来源:cpp_example_dup.cpp


示例10: printCallStack

//TODO Return as string, so call stack could be used in dialogs.
void printCallStack()
{
#ifdef LYX_CALLSTACK_PRINTING
	const int depth = 50;
	
	// get void*'s for all entries on the stack
	void* array[depth];
	size_t size = backtrace(array, depth);
	
	char** messages = backtrace_symbols(array, size);
	
	for (size_t i = 0; i < size && messages != NULL; i++) {
		std::string orig(messages[i]);
		// extract mangled: bin/lyx2.0(_ZN3lyx7support7packageEv+0x32) [0x8a2e02b]
		char* mangled = 0;
		for (char *p = messages[i]; *p; ++p) {
			if (*p == '(') {
				*p = 0;
				mangled = p + 1;
			} else if (*p == '+') {
				*p = 0;
				break;
			}
		}
		int err = 0;
		char* demangled = abi::__cxa_demangle(mangled, 0, 0, &err);
		if (err == 0) {
			fprintf(stderr, "[bt]: (%d) %s %s\n", i, messages[i], demangled);
			free((void*)demangled);
		} else {
			fprintf(stderr, "[bt]: (%d) %s\n", i, orig.c_str());
		}		
	}
#endif
}
开发者ID:djmitche,项目名称:lyx,代码行数:36,代码来源:lassert.cpp


示例11: drawHere

    void drawHere(SkCanvas* canvas, SkFilterQuality filter, SkScalar dx, SkScalar dy) {
        SkCanvas* origCanvas = canvas;
        SkAutoCanvasRestore acr(canvas, true);

        SkISize size = SkISize::Make(fImage->width(), fImage->height());

        SkAutoTUnref<SkSurface> surface;
        if (fShowFatBits) {
            // scale up so we don't clip rotations
            SkImageInfo info = SkImageInfo::MakeN32(fImage->width() * 2, fImage->height() * 2,
                                                    kOpaque_SkAlphaType);
            surface.reset(make_surface(canvas, info));
            canvas = surface->getCanvas();
            canvas->drawColor(SK_ColorWHITE);
            size.set(info.width(), info.height());
        } else {
            canvas->translate(SkScalarHalf(fCell.width() - fImage->width()),
                              SkScalarHalf(fCell.height() - fImage->height()));
        }
        this->drawTheImage(canvas, size, filter, dx, dy);

        if (surface) {
            SkAutoTUnref<SkImage> orig(surface->newImageSnapshot());
            SkAutoTUnref<SkImage> zoomed(zoom_up(orig));
            origCanvas->drawImage(zoomed,
                                  SkScalarHalf(fCell.width() - zoomed->width()),
                                  SkScalarHalf(fCell.height() - zoomed->height()));
        }
    }
开发者ID:nikolayvoronchikhin,项目名称:skia,代码行数:29,代码来源:SampleFilterQuality.cpp


示例12: capture

bool capture(const std::string& re, std::string& src)
{
  std::string pat, flags;
  pcrecpp::RE rx("^\\/(.*)\\/(.*)$", pcrecpp::UTF8());

  if (rx.PartialMatch(re, &pat, &flags))
    {
      if (src.empty()) // Check regexp
        return true;

      pcrecpp::RE_Options opts = _init_re_opts(flags);
      if (strstr(flags.c_str(), "g") != 0)
        {
          std::string orig(src);
          pcrecpp::StringPiece sp(orig);
          pcrecpp::RE re(pat, opts);
          _check_re_error(re);
          src.clear();

          std::string s;
          while (re.FindAndConsume(&sp, &s))
            src += s;
        }
      else
        {
          std::string tmp = src;
          src.clear();
          pcrecpp::RE re(pat, opts);
          _check_re_error(re);
          re.PartialMatch(tmp, &src);
        }
      return true;
    }
  return false;
}
开发者ID:mogaal,项目名称:cclive,代码行数:35,代码来源:re.cpp


示例13: findMethodToReuse

nmethod* cacheProbingLookup::compileOrReuse() {
  nmethod* nm = findMethodToReuse();
    
  if ( nm == cannotReuse ) {
    nm= compilingLookup::compileOrReuse();
    updateCache(nm);
    return nm;
  }
  if ( nm == compileAndReuse ) {
    // compile in context of method holder and reuse

    MethodLookupKey orig(&key);
    
    key= canonical_key;
    nm= compilingLookup::compileOrReuse();
    key= orig;
    
    updateCache(nm);
    updateCache(nm, &canonical_key);
    return nm;
  }
  // reuse nm
  const char *s= sprintName(NULL, selector());
  if (PrintCompilation)
    lprintf("*Reusing NIC method %#lx for selector %s\n", nm, s);
  LOG_EVENT1("Reusing NIC method %#lx", nm);
  nm->addDeps(deps);
  updateCache(nm, &key);    
  return nm;
}
开发者ID:ardeujho,项目名称:self,代码行数:30,代码来源:complexLookup.cpp


示例14: TEST_F

TEST_F(SHAPE, Moves)
{
	std::vector<ade::DimT> junk = {8, 51, 73};
	std::vector<ade::DimT> slist = {24, 11, 12, 16};

	ade::Shape mvassign;
	ade::Shape mvassign2(junk);
	ade::Shape orig(slist);

	ade::Shape mv(std::move(orig));
	std::vector<ade::DimT> mlist(mv.begin(), mv.end());
	EXPECT_ARREQ(slist, mlist);
	for (uint8_t i = 0; i < ade::rank_cap; ++i)
	{
		EXPECT_EQ(1, orig.at(i));
	}

	mvassign = std::move(mv);
	std::vector<ade::DimT> alist(mvassign.begin(), mvassign.end());
	EXPECT_ARREQ(slist, alist);
	for (uint8_t i = 0; i < ade::rank_cap; ++i)
	{
		EXPECT_EQ(1, mv.at(i));
	}

	mvassign2 = std::move(mvassign);
	std::vector<ade::DimT> alist2(mvassign2.begin(), mvassign2.end());
	EXPECT_ARREQ(slist, alist2);
	for (uint8_t i = 0; i < ade::rank_cap; ++i)
	{
		EXPECT_EQ(1, mvassign.at(i));
	}
}
开发者ID:mingkaic,项目名称:tenncor,代码行数:33,代码来源:test_shape.cpp


示例15: main

int main(int argc, char *argv[])
{
    (void) argc; (void) argv;

    int n = 10;
    pthread_t threads[n];
    work_t work_items[n];

    QImage image;

    QString orig("../../inf8601-scratchpad/res/bsod.png");
    QString modz(orig + ".modz.png");

    if (!image.load(orig)) {
        qDebug() << "error loading image";
        return -1;
    }
    image = image.convertToFormat(QImage::Format_RGB32);

    for (int i = 0; i < n; i++) {
        work_items[i].n = n;
        work_items[i].rank = i;
        work_items[i].image = &image;
        pthread_create(&threads[i], NULL, effect, &work_items[i]);
    }

    for (int i = 0; i < n; i++) {
        pthread_join(threads[i], NULL);
    }

    image.save(modz);

    return 0;
}
开发者ID:giraldeau,项目名称:inf8601-scratchpad,代码行数:34,代码来源:main.cpp


示例16: QtestFromAccl

bool QtestFromAccl(){
	Quaternion orig(Vec3(1,0,0),toRad(45));
	Vec3 accl(0,0,1);
	accl.rotateBy(orig);
	Quaternion res(Vec3(0,0,1), accl);
	return fuzzyQCompare(orig, res);
}
开发者ID:MINDS-i,项目名称:Drone-Tests,代码行数:7,代码来源:testQuaternion.cpp


示例17: trap

 int trap(vector<int>& height) {
     vector<int> orig(height);
     
     int peak = INT_MIN;
     int peakIndex = -1;
     for (int i = 0; i < height.size(); ++i) {
         if (height[i] > peak) {
             peak = height[i];
             peakIndex = i;
         }
     }
     
     do {
         for (int i = 1; i < height.size()-1; ++i) {
             int leftPeak  = get_peak_from_left(i-1, height, height[i]);
             int rightPeak = get_peak_from_right(i+1, height, height[i]);
             height[i] = min(leftPeak, rightPeak);
         }
     } while (!perfect_mountain(height, peakIndex));
     
     print_vec(orig);
     print_vec(height);
     
     int capacity = 0;
     for (int i = 0; i < height.size(); ++i) {
         capacity += abs(height[i] - orig[i]);
     }
     
     return capacity;
 }
开发者ID:unmeshvrije,项目名称:C--,代码行数:30,代码来源:elevation_map.cpp


示例18: makeEdge

EdgePointer CDelaunay::connectRight(EdgePointer a, EdgePointer b)
{
  EdgePointer ans;
  ans = makeEdge(dest(a), orig(b));
  splice(ans, (EdgePointer) sym(a));
  splice((EdgePointer) sym(ans), (EdgePointer) oprev(b));
  return(ans);
}
开发者ID:cile,项目名称:android_packages_apps_Camera,代码行数:8,代码来源:Delaunay.cpp


示例19: Vector3D

void Scene::addLight(geovalue *pos, intensity *dif) {
  Vector3D u = Vector3D(0.5, 0.0 , 0.0);
  Vector3D v = Vector3D(0.0, 0.0 , 0.5);
  lights.push_back(new SquareLight(pos,u ,v , dif, 3, this));
  Vector3D orig(Vector3D(pos) - (u * 0.5) - (v * 0.5));
  objects.push_back(new SquareLightBody(orig, orig + u, orig + u + v, orig + v, dif, this));
  currentCam = -1;
}
开发者ID:axelerator,项目名称:adgr,代码行数:8,代码来源:scene.cpp


示例20: LinearNorm

 LinearNorm(const LN& vList) {
     assert(vList.size() >= 2);
     norm.reserve(vList.size());
     orig.reserve(vList.size());
     for (auto i = vList.begin(); i != vList.end(); i++) {
         norm.push_back(i->norm());
         orig.push_back(i->orig());
     }
 }
开发者ID:freepmml,项目名称:libpmml,代码行数:9,代码来源:Isotonic.hpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ originThreadID函数代码示例发布时间:2022-05-30
下一篇:
C++ orientationChanged函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap