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

C++ dv函数代码示例

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

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



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

示例1: dv

osg::BoundingSphere LightPointNode::computeBound() const
{
    osg::BoundingSphere bsphere;
    bsphere.init();
    _bbox.init();

    if (_lightPointList.empty())
    {
        return bsphere;
    }


    LightPointList::const_iterator itr;
    for(itr=_lightPointList.begin();
        itr!=_lightPointList.end();
        ++itr)
    {
        _bbox.expandBy(itr->_position);
    }


    bsphere.set(_bbox.center(),0.0f);

    for(itr=_lightPointList.begin();
        itr!=_lightPointList.end();
        ++itr)
    {
        osg::Vec3 dv(itr->_position-bsphere.center());
        float radius = dv.length()+itr->_radius;
        if (bsphere.radius()<radius) bsphere.radius()=radius;
    }

    bsphere.radius()+=1.0f;
    return bsphere;
}
开发者ID:yueying,项目名称:osg,代码行数:35,代码来源:LightPointNode.cpp


示例2: getItemsVector

 std::vector<double> getItemsVector(int32_t item) {
     std::vector<float> fv;
     ptr->get_item(item, &fv);
     std::vector<double> dv(fv.size());
     std::copy(fv.begin(), fv.end(), dv.begin());
     return dv;
 }
开发者ID:edwindj,项目名称:rcppannoy,代码行数:7,代码来源:annoy.cpp


示例3: dv

//_______________________________________________________________________
inline void ReadMLP::Transform_1( std::vector<double>& iv, int cls) const
{
   // Normalization transformation
   if (cls < 0 || cls > 2) {
   if (2 > 1 ) cls = 2;
      else cls = 2;
   }
   const int nVar = 2;

   // get indices of used variables

   // define the indices of the variables which are transformed by this transformation
   std::vector<int> indicesGet;
   std::vector<int> indicesPut;

   indicesGet.push_back( 0);
   indicesGet.push_back( 1);
   indicesPut.push_back( 0);
   indicesPut.push_back( 1);

   std::vector<double> dv(nVar);
   for (int ivar=0; ivar<nVar; ivar++) dv[ivar] = iv[indicesGet.at(ivar)];
   for (int ivar=0;ivar<2;ivar++) {
      double offset = fMin_1[cls][ivar];
      double scale  = 1.0/(fMax_1[cls][ivar]-fMin_1[cls][ivar]);
      iv[indicesPut.at(ivar)] = (dv[ivar]-offset)*scale * 2 - 1;
   }
}
开发者ID:sonasi,项目名称:Utilities,代码行数:29,代码来源:TMVAClassification4_MLP.class.C


示例4: TEST

    // Insert a record and try to perform an in-place update on it with a DamageVector
    // containing overlapping DamageEvents.
    TEST( RecordStoreTestHarness, UpdateWithOverlappingDamageEvents ) {
        scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
        scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );

        if (!rs->updateWithDamagesSupported())
            return;

        {
            scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
            ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) );
        }

        string data = "00010111";
        RecordId loc;
        const RecordData rec(data.c_str(), data.size() + 1);
        {
            scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
            {
                WriteUnitOfWork uow( opCtx.get() );
                StatusWith<RecordId> res = rs->insertRecord( opCtx.get(),
                                                            rec.data(),
                                                            rec.size(),
                                                            false );
                ASSERT_OK( res.getStatus() );
                loc = res.getValue();
                uow.commit();
            }
        }

        {
            scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
            ASSERT_EQUALS( 1, rs->numRecords( opCtx.get() ) );
        }

        {
            scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
            {
                mutablebson::DamageVector dv( 2 );
                dv[0].sourceOffset = 3;
                dv[0].targetOffset = 0;
                dv[0].size = 5;
                dv[1].sourceOffset = 0;
                dv[1].targetOffset = 3;
                dv[1].size = 5;

                WriteUnitOfWork uow( opCtx.get() );
                ASSERT_OK( rs->updateWithDamages( opCtx.get(), loc, rec, data.c_str(), dv ) );
                uow.commit();
            }
        }

        data = "10100010";
        {
            scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
            {
                RecordData record = rs->dataFor( opCtx.get(), loc );
                ASSERT_EQUALS( data, record.data() );
            }
        }
    }
开发者ID:7segments,项目名称:mongo-1,代码行数:62,代码来源:record_store_test_updatewithdamages.cpp


示例5: task_manager

void
MapWindow::DrawTask(Canvas &canvas)
{
  if (task == NULL)
    return;

  ProtectedTaskManager::Lease task_manager(*task);
  const AbstractTask *task = task_manager->get_active_task();
  if (task == NULL || !task->check_task())
    return;

  /* RLD bearing is invalid if GPS not connected and in non-sim mode,
   but we can still draw targets */
  const bool draw_bearing = Basic().gps.Connected;

  RenderObservationZone ozv;
  RenderTaskPointMap tpv(canvas,
#ifdef ENABLE_OPENGL
                         /* OpenGL doesn't have the BufferCanvas
                            class */
                         NULL,
#else
                         &buffer_canvas,
#endif
                         render_projection,
                         SettingsMap(),
                         /* we're accessing the OrderedTask here,
                            which may be invalid at this point, but it
                            will be used only if active, so it's ok */
                         task_manager->get_ordered_task().get_task_projection(),
                         ozv, draw_bearing,
                         Basic().Location);
  RenderTask dv(tpv, render_projection.GetScreenBounds());
  ((TaskVisitor &)dv).Visit(*task);
}
开发者ID:galippi,项目名称:xcsoar,代码行数:35,代码来源:MapWindowTask.cpp


示例6: link

void link(CompilerState& state, const LinkDesc& desc)
{
    StackMaps sm;
    DataView dv(state.m_stackMapsSection->data());
    sm.parse(&dv);
    auto rm = sm.computeRecordMap();
    EMASSERT(state.m_codeSectionList.size() == 1);
    uint8_t* prologue = const_cast<uint8_t*>(reinterpret_cast<const uint8_t*>(state.m_codeSectionList.front().data()));
    uint8_t* body = static_cast<uint8_t*>(state.m_entryPoint);
    desc.m_patchPrologue(desc.m_opaque, prologue);
    for (auto& record : rm) {
        EMASSERT(record.second.size() == 1);
        auto found = state.m_patchMap.find(record.first);
        if (found == state.m_patchMap.end()) {
            // should be the tcg helpers.
            continue;
        }
        PatchDesc& patchDesc = found->second;
        switch (patchDesc.m_type) {
        case PatchType::Assist: {
            desc.m_patchAssist(desc.m_opaque, body + record.second[0].instructionOffset, desc.m_dispAssist);
        } break;
        case PatchType::TcgDirect: {
            auto& recordUnit = record.second[0];
            desc.m_patchTcgDirect(desc.m_opaque, body + recordUnit.instructionOffset, desc.m_dispTcgDirect);
        } break;
        case PatchType::TcgIndirect: {
            auto& recordUnit = record.second[0];
            desc.m_patchTcgIndirect(desc.m_opaque, body + recordUnit.instructionOffset, desc.m_dispTcgIndirect);
        } break;
        default:
            EMUNREACHABLE();
        }
    }
}
开发者ID:zhangzhanheng,项目名称:arm_translator,代码行数:35,代码来源:Link.cpp


示例7: holidayList

RcppExport SEXP holidayList(SEXP calSexp, SEXP params) {

    try {
        boost::shared_ptr<QuantLib::Calendar> pcal( getCalendar(Rcpp::as<std::string>(calSexp)) );
        Rcpp::List rparam(params);
        int iw = Rcpp::as<int>(rparam["includeWeekends"]);
        std::vector<QuantLib::Date> 
            holidays = QuantLib::Calendar::holidayList(*pcal,
                                                       QuantLib::Date(dateFromR(Rcpp::as<Rcpp::Date>( rparam["from"]))), 
                                                       QuantLib::Date(dateFromR(Rcpp::as<Rcpp::Date>( rparam["to"] ))), 
                                                       iw == 1 ? true : false);                

        if (holidays.size() > 0) {
            Rcpp::DateVector dv( holidays.size() );
            for (unsigned int i = 0; i< holidays.size(); i++){
                dv[i] = Rcpp::Date(holidays[i].month(), holidays[i].dayOfMonth(), holidays[i].year());
            }
            return Rcpp::wrap(dv);
        } else {
            return R_NilValue;
        }

    } catch(std::exception &ex) { 
        forward_exception_to_r(ex); 
    } catch(...) { 
        ::Rf_error("c++ exception (unknown reason)"); 
    }

    return R_NilValue;
}
开发者ID:rforge,项目名称:rquantlib,代码行数:30,代码来源:calendars.cpp


示例8: TEST_F

TEST_F(test_dvector, is_valid_index)
{
  dvector dv(1, 4);
  ASSERT_EQ(false, dv.is_valid_index(0));
  ASSERT_EQ(true, dv.is_valid_index(1));
  ASSERT_EQ(true, dv.is_valid_index(2));
  ASSERT_EQ(true, dv.is_valid_index(3));
  ASSERT_EQ(true, dv.is_valid_index(4));
  ASSERT_EQ(false, dv.is_valid_index(5));
  ASSERT_EQ(false, false || dv.is_valid_index(0));
  ASSERT_EQ(true, false || dv.is_valid_index(1));
  ASSERT_EQ(true, false || dv.is_valid_index(4));
  ASSERT_EQ(false, false || dv.is_valid_index(5));
  ASSERT_DEATH(dv(0), "Assertion");
  ASSERT_DEATH(dv(5), "Assertion");
}
开发者ID:jimianelli,项目名称:admb,代码行数:16,代码来源:test_dvector.cpp


示例9: split

void Crossline::Process(const cv::Mat& prevImg, const cv::Mat& nextImg, float** density_feature, float** x_feature, float** y_feature) {
  std::vector<cv::Mat> src1_spl;
  std::vector<cv::Mat> src2_spl;

  split(prevImg, src1_spl);
  split(nextImg, src2_spl);

  std::vector<cv::Mat> channels;
  channels.push_back(src1_spl[0]);
  channels.push_back(src1_spl[1]);
  channels.push_back(src1_spl[2]);
  channels.push_back(src2_spl[0]);
  channels.push_back(src2_spl[1]);
  channels.push_back(src2_spl[2]);
  cv::Mat input_data;
  merge(channels, input_data);

  std::vector<cv::Mat> dv (1, input_data);
  std::vector<int> dv1 (1, 0);

  md_layer_->AddMatVector(dv, dv1);

  feature_extraction_net_->ForwardFromTo(0, feature_extraction_net_->layers().size() - 1);
  const shared_ptr<Blob<float> > feature_blob_density = feature_extraction_net_->blob_by_name("density_out");
  const shared_ptr<Blob<float> > feature_blob_X = feature_extraction_net_->blob_by_name("vx_out");
  const shared_ptr<Blob<float> > feature_blob_Y = feature_extraction_net_->blob_by_name("vy_out");

  *density_feature = feature_blob_density->mutable_cpu_data();
  *x_feature = feature_blob_X->mutable_cpu_data();
  *y_feature = feature_blob_Y->mutable_cpu_data();
}
开发者ID:airxcy,项目名称:ITF_Tracker,代码行数:31,代码来源:Crossline.cpp


示例10: live

// Compute lifetime intervals and use positions of all intervals by walking
// the code bottom-up once. Loops aren't handled yet.
void Vxls::buildIntervals() {
  livein.resize(unit.blocks.size());
  intervals.resize(unit.next_vr);
  for (auto blockIt = blocks.end(); blockIt != blocks.begin();) {
    auto vlabel = *--blockIt;
    auto& block = unit.blocks[vlabel];
    LiveSet live(unit.next_vr);
    for (auto s : succs(block)) {
      if (!livein[s].empty()) live |= livein[s];
    }
    auto& block_range = block_ranges[vlabel];
    forEach(live, [&](Vreg vr) {
      intervals[vr]->add(block_range);
    });
    auto pos = block_range.end;
    for (auto i = block.code.end(); i != block.code.begin();) {
      auto& inst = *--i;
      pos -= 2;
      DefVisitor dv(live, *this, pos);
      visit(inst, dv);
      RegSet implicit_uses, implicit_defs;
      getEffects(abi, inst, implicit_uses, implicit_defs);
      implicit_defs.forEach([&](Vreg r) {
        dv.def(r);
      });
      UseVisitor uv(live, *this, {block_range.start, pos});
      visit(inst, uv);
      implicit_uses.forEach([&](Vreg r) {
        uv.use(r);
      });
    }
    livein[vlabel] = live;
  }
  for (auto& c : unit.cpool) {
    auto ivl = intervals[c.second];
    if (ivl) {
      ivl->ranges.back().start = 0;
      ivl->cns = true;
      ivl->val = c.first;
    }
  }
  // Each interval's range and use list is backwards; reverse them now.
  for (auto ivl : intervals) {
    if (!ivl) continue;
    assert(!ivl->ranges.empty()); // no empty intervals
    std::reverse(ivl->uses.begin(), ivl->uses.end());
    std::reverse(ivl->ranges.begin(), ivl->ranges.end());
  }
  if (dumpIREnabled(kRegAllocLevel)) {
    print("after building intervals");
  }
  // todo: t4764262 this should check each root, not just position 0.
  for (DEBUG_ONLY auto ivl : intervals) {
    // only constants and physical registers can be live at entry.
    assert(!ivl || ivl->cns || ivl->vreg.isPhys() || ivl->start() > 0);
  }
  assert(check(unit));
}
开发者ID:CodeKong,项目名称:hhvm,代码行数:60,代码来源:vasm-xls.cpp


示例11: du

 void MapGradient::compute_tangent_and_binormal(
     MapVertexProperty<vec3>& tangent,
     MapVertexProperty<vec3>& binormal
 ) {
     vec2 du(1,0) ; vec2 dv(0,1) ;
     FOR_EACH_VERTEX(Map, map_, it) {
         tangent[it] = compute_gradient(it, du) ;
         binormal[it] = compute_gradient(it, dv) ;
     }
开发者ID:Amy1014,项目名称:shape-packing,代码行数:9,代码来源:map_gradient.cpp


示例12: dv

		void Manipulator::translate(float dx, float dy, float dz) {
			osg::Matrixd rotation_matrix;
			rotation_matrix.makeRotate(_rotation);
			osg::Vec3d dv(dx, dy, dz);

			dv = dv *rotation_matrix;
			_center += dv;
			_acc_translation += dv;
		}
开发者ID:VinoTechnology,项目名称:vino-server,代码行数:9,代码来源:Manipulator.cpp


示例13: ParticlesAdvector_RKII

static void ParticlesAdvector_RKII()
{
	VFXEpoch::Grid2DfScalarField du(v.getDimY(), v.getDimX(), 1.0f / v.getDimX(), 1.0f / v.getDimY());
	VFXEpoch::Grid2DfScalarField dv(v.getDimY(), v.getDimX(), 1.0f / v.getDimX(), 1.0f / v.getDimY());
	VFXEpoch::ExtractComponents(du, v, VFXEpoch::VECTOR_COMPONENTS::X);
	VFXEpoch::ExtractComponents(dv, v, VFXEpoch::VECTOR_COMPONENTS::Y);
	sl2D_solver._advect_particles_rk2(du, dv, particles);
	du.clear();
	dv.clear();
}
开发者ID:Shakebones,项目名称:VFX,代码行数:10,代码来源:main.cpp


示例14: invInertia

void dgBody::AddImpulse (const dgVector& pointDeltaVeloc, const dgVector& pointPosit)
{
	dgMatrix invInertia (CalculateInvInertiaMatrix());

	// get contact matrix
	dgMatrix tmp;
	dgVector globalContact (pointPosit - m_globalCentreOfMass);

	tmp[0][0] = dgFloat32 (0.0f);
	tmp[0][1] = + globalContact[2];
	tmp[0][2] = - globalContact[1];
	tmp[0][3] = dgFloat32 (0.0f);

	tmp[1][0] = -globalContact[2];
	tmp[1][1] = dgFloat32 (0.0f);
	tmp[1][2] = +globalContact[0];
	tmp[1][3] = dgFloat32 (0.0f);

	tmp[2][0] = +globalContact[1];
	tmp[2][1] = -globalContact[0];
	tmp[2][2] = dgFloat32 (0.0f);
	tmp[2][3] = dgFloat32 (0.0f);

	tmp[3][0] = dgFloat32 (0.0f);
	tmp[3][1] = dgFloat32 (0.0f);
	tmp[3][2] = dgFloat32 (0.0f);
	tmp[3][3] = dgFloat32 (1.0f);

	dgMatrix contactMatrix (tmp * invInertia * tmp);
	for (dgInt32 i = 0; i < 3; i ++) {
		for (dgInt32 j = 0; j < 3; j ++) {
			contactMatrix[i][j] *= -dgFloat32 (1.0f);
		}
	}
	contactMatrix[0][0] += m_invMass.m_w;	
	contactMatrix[1][1] += m_invMass.m_w;	
	contactMatrix[2][2] += m_invMass.m_w;	

	contactMatrix = contactMatrix.Symetric3by3Inverse ();

	// change of momentum
	dgVector changeOfMomentum (contactMatrix.RotateVector (pointDeltaVeloc));


	dgVector dv (changeOfMomentum.Scale3 (m_invMass.m_w));
	dgVector dw (invInertia.RotateVector (globalContact * changeOfMomentum));

	m_veloc += dv;
	m_omega += dw;

	m_sleeping	= false;
	m_equilibrium = false;
	Unfreeze ();
}
开发者ID:Hurleyworks,项目名称:NewtonBlock,代码行数:54,代码来源:dgBody.cpp


示例15: dash_pen

void
MapWindow::DrawAbortedTask(Canvas &canvas)
{
  if (way_points == NULL || task == NULL)
    return;

  Pen dash_pen(Pen::DASH, IBLSCALE(1), MapGfx.TaskColor);
  canvas.select(dash_pen);
  DrawAbortedTaskVisitor dv(canvas, Orig_Aircraft, *way_points);
  task->scan_point_forward(dv, false); // read lock
}
开发者ID:bugburner,项目名称:xcsoar,代码行数:11,代码来源:MapWindowTask.cpp


示例16: dv

void
MapWindow::DrawTask(Canvas &canvas, RECT rc)
{
  if (way_points == NULL || task == NULL)
    return;

  DrawTaskVisitor dv(*this, canvas, Orig_Aircraft, task_screen, task_start_screen,
                     task->getActiveIndex(), *way_points);
  task->scan_leg_forward(dv, false); // read lock
  task->scan_point_forward(dv, false); // read lock
}
开发者ID:bugburner,项目名称:xcsoar,代码行数:11,代码来源:MapWindowTask.cpp


示例17: dv

void Mesh::computeDualVertices(void) {
  if (triangles.size() == 0 || vertices.size() == 0) {
    std::cout << "Unitialized mesh\n";
  }

  for (const auto &t : triangles) {
    Vertex dv((vertices[t.v1].x + vertices[t.v2].x + vertices[t.v3].x) / 3,
              (vertices[t.v1].y + vertices[t.v2].y + vertices[t.v3].y) / 3,
              (vertices[t.v1].z + vertices[t.v2].z + vertices[t.v3].z) / 3);
    dvertices.push_back(dv);
  }
}
开发者ID:el-cangrejo,项目名称:simple_obj_loader,代码行数:12,代码来源:Mesh.cpp


示例18: classicRcppDateExample

RcppExport SEXP classicRcppDateExample(SEXP dvsexp, SEXP dtvsexp) {

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

    try {

	RcppDateVector dv(dvsexp);
	RcppDatetimeVector dtv(dtvsexp);
	
	Rprintf("\nIn C++, seeing the following date value\n");
	for (int i=0; i<dv.size(); i++) {
	    Rcpp::Rcout << dv(i) << std::endl;
	    dv(i) = dv(i) + 7;		// shift a week
	}
	Rprintf("\nIn C++, seeing the following datetime value\n");
	for (int i=0; i<dtv.size(); i++) {
	    Rcpp::Rcout << dtv(i) << std::endl;
	    dtv(i) = dtv(i) + 0.250;    // shift 250 millisec
	}

	// Build result set to be returned as a list to R.
	RcppResultSet rs;
	rs.add("date",   dv);
	rs.add("datetime", dtv);

	// 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,代码行数:40,代码来源:classicRcppDateExample.cpp


示例19: br

void
br(void)
{
	if(!isoutput)
		return;
	isoutput = 0;

	nr(L(".dv"), 0);
	dv(0);
	hideihtml();
	if(getnr(L(".paragraph")))
		outhtml(L("</p>"));
}
开发者ID:AustenConrad,项目名称:plan-9,代码行数:13,代码来源:roff.c


示例20: QFETCH

void tst_QDoubleValidator::validateIntEquiv()
{
    QFETCH(double, minimum);
    QFETCH(double, maximum);
    QFETCH(QString, input);
    QFETCH(QValidator::State, state);

    QLocale::setDefault(QLocale("C"));

    QDoubleValidator dv(minimum, maximum, 0, 0);
    dv.setNotation(QDoubleValidator::StandardNotation);
    int dummy;
    QCOMPARE(dv.validate(input, dummy), state);
}
开发者ID:KDE,项目名称:android-qt5-qtbase,代码行数:14,代码来源:tst_qdoublevalidator.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ dvb_attach函数代码示例发布时间:2022-05-30
下一篇:
C++ durationChanged函数代码示例发布时间: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