本文整理汇总了C++中DistMultiVec::Height方法的典型用法代码示例。如果您正苦于以下问题:C++ DistMultiVec::Height方法的具体用法?C++ DistMultiVec::Height怎么用?C++ DistMultiVec::Height使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DistMultiVec
的用法示例。
在下文中一共展示了DistMultiVec::Height方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: G
void Mehrotra
( const DistSparseMatrix<Real>& A,
const DistMultiVec<Real>& b,
const DistMultiVec<Real>& c,
const DistMultiVec<Int>& orders,
const DistMultiVec<Int>& firstInds,
DistMultiVec<Real>& x,
DistMultiVec<Real>& y,
DistMultiVec<Real>& z,
const MehrotraCtrl<Real>& ctrl )
{
EL_DEBUG_CSE
const Int n = c.Height();
const Grid& grid = A.Grid();
DistSparseMatrix<Real> G(grid);
Identity( G, n, n );
G *= -1;
DistMultiVec<Real> h(grid);
Zeros( h, n, 1 );
MehrotraCtrl<Real> affineCtrl = ctrl;
affineCtrl.primalInit = false;
affineCtrl.dualInit = false;
DistMultiVec<Real> s(grid);
socp::affine::Mehrotra(A,G,b,c,h,orders,firstInds,x,y,z,s,affineCtrl);
}
示例2: RowMaxNorms
void RowMaxNorms( const DistMultiVec<F>& A, DistMultiVec<Base<F>>& norms )
{
DEBUG_CSE
norms.SetComm( A.Comm() );
norms.Resize( A.Height(), 1 );
RowMaxNorms( A.LockedMatrix(), norms.Matrix() );
}
示例3: cse
void SOCSquareRoot
( const DistMultiVec<Real>& x,
DistMultiVec<Real>& xRoot,
const DistMultiVec<Int>& orders,
const DistMultiVec<Int>& firstInds, Int cutoff )
{
DEBUG_ONLY(CSE cse("SOCSquareRoot"))
DistMultiVec<Real> d(x.Comm());
SOCDets( x, d, orders, firstInds );
ConeBroadcast( d, orders, firstInds );
auto roots = x;
ConeBroadcast( roots, orders, firstInds );
const Int localHeight = x.LocalHeight();
xRoot.SetComm( x.Comm() );
Zeros( xRoot, x.Height(), 1 );
for( Int iLoc=0; iLoc<localHeight; ++iLoc )
{
const Int i = x.GlobalRow(iLoc);
const Real x0 = roots.GetLocal(iLoc,0);
const Real det = d.GetLocal(iLoc,0);
const Real eta0 = Sqrt(x0+Sqrt(det))/Sqrt(Real(2));
if( i == firstInds.GetLocal(iLoc,0) )
xRoot.SetLocal( iLoc, 0, eta0 );
else
xRoot.SetLocal( iLoc, 0, x.GetLocal(iLoc,0)/(2*eta0) );
}
}
示例4: EntrywiseMap
void EntrywiseMap
( const DistMultiVec<S>& A,
DistMultiVec<T>& B,
function<T(S)> func )
{
DEBUG_CSE
B.SetComm( A.Comm() );
B.Resize( A.Height(), A.Width() );
EntrywiseMap( A.LockedMatrix(), B.Matrix(), func );
}
示例5: Sqrt
void NesterovTodd
( const DistMultiVec<Real>& s,
const DistMultiVec<Real>& z,
DistMultiVec<Real>& w )
{
DEBUG_CSE
w.SetComm( s.Comm() );
w.Resize( s.Height(), 1 );
const Real* sBuf = s.LockedMatrix().LockedBuffer();
const Real* zBuf = z.LockedMatrix().LockedBuffer();
Real* wBuf = w.Matrix().Buffer();
const Int localHeight = w.LocalHeight();
for( Int iLoc=0; iLoc<localHeight; ++iLoc )
wBuf[iLoc] = Sqrt(sBuf[iLoc]/zBuf[iLoc]);
}
示例6: cse
inline void
DistNodalMultiVec<F>::Pull
( const DistMap& inverseMap, const DistSymmInfo& info,
const DistMultiVec<F>& X )
{
DEBUG_ONLY(CallStackEntry cse("DistNodalMultiVec::Pull"))
height_ = X.Height();
width_ = X.Width();
// Traverse our part of the elimination tree to see how many indices we need
int numRecvInds=0;
const int numLocal = info.localNodes.size();
for( int s=0; s<numLocal; ++s )
numRecvInds += info.localNodes[s].size;
const int numDist = info.distNodes.size();
for( int s=1; s<numDist; ++s )
numRecvInds += info.distNodes[s].multiVecMeta.localSize;
// Fill the set of indices that we need to map to the original ordering
int off=0;
std::vector<int> mappedInds( numRecvInds );
for( int s=0; s<numLocal; ++s )
{
const SymmNodeInfo& nodeInfo = info.localNodes[s];
for( int t=0; t<nodeInfo.size; ++t )
mappedInds[off++] = nodeInfo.off+t;
}
for( int s=1; s<numDist; ++s )
{
const DistSymmNodeInfo& nodeInfo = info.distNodes[s];
const Grid& grid = *nodeInfo.grid;
const int gridSize = grid.Size();
const int gridRank = grid.VCRank();
const int alignment = 0;
const int shift = Shift( gridRank, alignment, gridSize );
for( int t=shift; t<nodeInfo.size; t+=gridSize )
mappedInds[off++] = nodeInfo.off+t;
}
DEBUG_ONLY(
if( off != numRecvInds )
LogicError("mappedInds was filled incorrectly");
)