本文整理汇总了C++中dv函数的典型用法代码示例。如果您正苦于以下问题:C++ dv函数的具体用法?C++ dv怎么用?C++ dv使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dv函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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;
}
}
示例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() );
}
}
}
示例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);
}
示例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();
}
}
}
示例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;
}
示例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");
}
示例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();
}
示例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));
}
示例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) ;
}
示例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;
}
示例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();
}
示例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 ();
}
示例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
}