本文整理汇总了C++中DistMultiVec::FirstLocalRow方法的典型用法代码示例。如果您正苦于以下问题:C++ DistMultiVec::FirstLocalRow方法的具体用法?C++ DistMultiVec::FirstLocalRow怎么用?C++ DistMultiVec::FirstLocalRow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DistMultiVec
的用法示例。
在下文中一共展示了DistMultiVec::FirstLocalRow方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cse
void Apply
( 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("soc::Apply"))
soc::Dots( x, y, z, orders, firstInds );
auto xRoots = x;
auto yRoots = y;
cone::Broadcast( xRoots, orders, firstInds );
cone::Broadcast( yRoots, orders, firstInds );
const Int firstLocalRow = x.FirstLocalRow();
const Int localHeight = x.LocalHeight();
const Real* xBuf = x.LockedMatrix().LockedBuffer();
const Real* xRootBuf = xRoots.LockedMatrix().LockedBuffer();
const Real* yBuf = y.LockedMatrix().LockedBuffer();
const Real* yRootBuf = yRoots.LockedMatrix().LockedBuffer();
Real* zBuf = z.Matrix().Buffer();
const Int* firstIndBuf = firstInds.LockedMatrix().LockedBuffer();
for( Int iLoc=0; iLoc<localHeight; ++iLoc )
{
const Int i = iLoc + firstLocalRow;
const Int firstInd = firstIndBuf[iLoc];
if( i != firstInd )
zBuf[iLoc] += xRootBuf[iLoc]*yBuf[iLoc] + yRootBuf[iLoc]*xBuf[iLoc];
}
}