本文整理汇总了C++中DistMultiVec::UpdateLocal方法的典型用法代码示例。如果您正苦于以下问题:C++ DistMultiVec::UpdateLocal方法的具体用法?C++ DistMultiVec::UpdateLocal怎么用?C++ DistMultiVec::UpdateLocal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DistMultiVec
的用法示例。
在下文中一共展示了DistMultiVec::UpdateLocal方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cse
void PushPairInto
( DistMultiVec<Real>& s,
DistMultiVec<Real>& z,
const DistMultiVec<Real>& w,
const DistMultiVec<Int>& orders,
const DistMultiVec<Int>& firstInds,
Real wMaxNormLimit, Int cutoff )
{
DEBUG_ONLY(CSE cse("soc::PushPairInto"))
DistMultiVec<Real> sLower(s.Comm()), zLower(z.Comm());
soc::LowerNorms( s, sLower, orders, firstInds, cutoff );
soc::LowerNorms( z, zLower, orders, firstInds, cutoff );
const int localHeight = s.LocalHeight();
for( Int iLoc=0; iLoc<localHeight; ++iLoc )
{
const Int i = s.GlobalRow(iLoc);
const Real w0 = w.GetLocal(iLoc,0);
if( i == firstInds.GetLocal(iLoc,0) && w0 > wMaxNormLimit )
{
// TODO: Switch to a non-adhoc modification
s.UpdateLocal( iLoc, 0, Real(1)/wMaxNormLimit );
z.UpdateLocal( iLoc, 0, Real(1)/wMaxNormLimit );
}
}
}
示例2: cse
void PushInto
( DistMultiVec<Real>& x,
const DistMultiVec<Int>& orders,
const DistMultiVec<Int>& firstInds,
Real minDist, Int cutoff )
{
DEBUG_ONLY(CSE cse("soc::PushInto"))
DistMultiVec<Real> d(x.Comm());
soc::LowerNorms( x, d, orders, firstInds, cutoff );
const int localHeight = x.LocalHeight();
for( Int iLoc=0; iLoc<localHeight; ++iLoc )
{
const Int i = x.GlobalRow(iLoc);
const Real x0 = x.GetLocal(iLoc,0);
const Real lowerNorm = d.GetLocal(iLoc,0);
if( i == firstInds.GetLocal(iLoc,0) && x0-lowerNorm < minDist )
x.UpdateLocal( iLoc, 0, minDist - (x0-lowerNorm) );
}
}
示例3: cse
void SOCApply
( const DistMultiVec<Real>& x,
const DistMultiVec<Real>& y,
DistMultiVec<Real>& z,
const DistMultiVec<Int>& orders,
const DistMultiVec<Int>& firstInds, Int cutoff )
{
DEBUG_ONLY(CSE cse("SOCApply"))
SOCDots( x, y, z, orders, firstInds );
auto xRoots = x;
auto yRoots = y;
ConeBroadcast( xRoots, orders, firstInds );
ConeBroadcast( yRoots, orders, firstInds );
const Int localHeight = x.LocalHeight();
for( Int iLoc=0; iLoc<localHeight; ++iLoc )
{
const Int i = x.GlobalRow(iLoc);
const Int firstInd = firstInds.GetLocal(iLoc,0);
if( i != firstInd )
z.UpdateLocal
( iLoc, 0, xRoots.GetLocal(iLoc,0)*y.GetLocal(iLoc,0) +
yRoots.GetLocal(iLoc,0)*x.GetLocal(iLoc,0) );
}
}