本文整理汇总了C++中BlockMatrix::Resize方法的典型用法代码示例。如果您正苦于以下问题:C++ BlockMatrix::Resize方法的具体用法?C++ BlockMatrix::Resize怎么用?C++ BlockMatrix::Resize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BlockMatrix
的用法示例。
在下文中一共展示了BlockMatrix::Resize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EntrywiseMap
void EntrywiseMap
( const BlockMatrix<S>& A,
BlockMatrix<T>& B,
function<T(S)> func )
{
if( A.DistData().colDist == B.DistData().colDist &&
A.DistData().rowDist == B.DistData().rowDist )
{
B.AlignWith( A.DistData() );
B.Resize( A.Height(), A.Width() );
EntrywiseMap( A.LockedMatrix(), B.Matrix(), func );
}
else
{
B.Resize( A.Height(), A.Width() );
#define GUARD(CDIST,RDIST) \
B.DistData().colDist == CDIST && B.DistData().rowDist == RDIST
#define PAYLOAD(CDIST,RDIST) \
DistMatrix<S,CDIST,RDIST,BLOCK> AProx(B.Grid()); \
AProx.AlignWith( B.DistData() ); \
Copy( A, AProx ); \
EntrywiseMap( AProx.Matrix(), B.Matrix(), func );
#include <El/macros/GuardAndPayload.h>
#undef GUARD
#undef PAYLOAD
}
}
示例2: Transpose
void TransposeContract
( const BlockMatrix<T>& A,
BlockMatrix<T>& B, bool conjugate )
{
EL_DEBUG_CSE
const Dist U = B.ColDist();
const Dist V = B.RowDist();
if( A.ColDist() == V && A.RowDist() == Partial(U) )
{
Transpose( A, B, conjugate );
}
else
{
unique_ptr<BlockMatrix<T>>
ASumFilt( B.ConstructTranspose(B.Grid(),B.Root()) );
if( B.ColConstrained() )
ASumFilt->AlignRowsWith( B, true );
if( B.RowConstrained() )
ASumFilt->AlignColsWith( B, true );
Contract( A, *ASumFilt );
if( !B.ColConstrained() )
B.AlignColsWith( *ASumFilt, false );
if( !B.RowConstrained() )
B.AlignRowsWith( *ASumFilt, false );
// We should have ensured that the alignments match
B.Resize( A.Width(), A.Height() );
Transpose( ASumFilt->LockedMatrix(), B.Matrix(), conjugate );
}
}
示例3: BLoc
void IndexDependentMap
( const BlockMatrix<S>& A,
BlockMatrix<T>& B,
function<T(Int,Int,S)> func )
{
DEBUG_CSE
const Int mLoc = A.LocalHeight();
const Int nLoc = A.LocalWidth();
B.AlignWith( A.DistData() );
B.Resize( A.Height(), A.Width() );
auto& ALoc = A.LockedMatrix();
auto& BLoc = B.Matrix();
for( Int jLoc=0; jLoc<nLoc; ++jLoc )
{
const Int j = A.GlobalCol(jLoc);
for( Int iLoc=0; iLoc<mLoc; ++iLoc )
{
const Int i = A.GlobalRow(iLoc);
BLoc(iLoc,jLoc) = func(i,j,ALoc(iLoc,jLoc));
}
}
}