當前位置: 首頁>>代碼示例>>C++>>正文


C++ DistMatrix::ResizeTo方法代碼示例

本文整理匯總了C++中DistMatrix::ResizeTo方法的典型用法代碼示例。如果您正苦於以下問題:C++ DistMatrix::ResizeTo方法的具體用法?C++ DistMatrix::ResizeTo怎麽用?C++ DistMatrix::ResizeTo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DistMatrix的用法示例。


在下文中一共展示了DistMatrix::ResizeTo方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: entry

inline void
LU( DistMatrix<F>& A, DistMatrix<Int,VC,STAR>& p, DistMatrix<Int,VC,STAR>& q )
{
#ifndef RELEASE
    CallStackEntry entry("LU");
#endif
    p.ResizeTo( Min(A.Height(),A.Width()), 1 );
    q.ResizeTo( Min(A.Height(),A.Width()), 1 );
    lu::Full( A, p, q );
}
開發者ID:khalid-hasanov,項目名稱:Elemental,代碼行數:10,代碼來源:LU.hpp

示例2: entry

inline void
Wilkinson( DistMatrix<T,U,V>& A, int k )
{
#ifndef RELEASE
    CallStackEntry entry("Wilkinson");
#endif
    const int n = 2*k+1;
    A.ResizeTo( n, n );
    MakeZeros( A );

    const int localHeight = A.LocalHeight();
    const int localWidth = A.LocalWidth();
    const int colShift = A.ColShift();
    const int rowShift = A.RowShift();
    const int colStride = A.ColStride();
    const int rowStride = A.RowStride();
    for( int jLocal=0; jLocal<localWidth; ++jLocal )
    {
        const int j = rowShift + jLocal*rowStride;
        for( int iLocal=0; iLocal<localHeight; ++iLocal )
        {
            const int i = colShift + iLocal*colStride;
            if( i == j )
            {
                if( j <= k )
                    A.SetLocal( iLocal, jLocal, T(k-j) );
                else
                    A.SetLocal( iLocal, jLocal, T(j-k) );
            }
            else if( i == j-1 || i == j+1 )
                A.SetLocal( iLocal, jLocal, T(1) );
        }
    }
}
開發者ID:ahmadia,項目名稱:Elemental-1,代碼行數:34,代碼來源:Wilkinson.hpp

示例3: entry

inline void
Redheffer( DistMatrix<T,U,V>& R, Int n )
{
#ifndef RELEASE
    CallStackEntry entry("Redheffer");
#endif
    R.ResizeTo( n, n );
    const Int localHeight = R.LocalHeight();
    const Int localWidth = R.LocalWidth();
    const Int colShift = R.ColShift();
    const Int rowShift = R.RowShift();
    const Int colStride = R.ColStride();
    const Int rowStride = R.RowStride();
    for( Int jLoc=0; jLoc<localWidth; ++jLoc )
    {
        const Int j = rowShift + jLoc*rowStride;
        for( Int iLoc=0; iLoc<localHeight; ++iLoc )
        {
            const Int i = colShift + iLoc*colStride;
            if( j==0 || ((j+1)%(i+1))==0 )
                R.SetLocal( iLoc, jLoc, T(1) );
            else
                R.SetLocal( iLoc, jLoc, T(0) );
        }
    }
}
開發者ID:khalid-hasanov,項目名稱:Elemental,代碼行數:26,代碼來源:Redheffer.hpp

示例4: entry

inline void
Hanowa( DistMatrix<T,U,V>& A, int n, T mu )
{
#ifndef RELEASE
    CallStackEntry entry("Hanowa");
#endif
    if( n % 2 != 0 )
        throw std::logic_error("n must be an even integer");
    A.ResizeTo( n, n );
    const int m = n/2;
    std::vector<T> d(m);
    DistMatrix<T,U,V> ABlock( A.Grid() );

    for( int j=0; j<m; ++j )
        d[j] = mu;
    View( ABlock, A, 0, 0, m, m );
    Diagonal( ABlock, d );
    View( ABlock, A, m, m, m, m );
    Diagonal( ABlock, d );

    for( int j=0; j<m; ++j )
        d[j] = -(j+1);
    View( ABlock, A, 0, m, m, m );
    Diagonal( ABlock, d );

    for( int j=0; j<m; ++j )
        d[j] = j+1;
    View( ABlock, A, m, 0, m, m );
    Diagonal( ABlock, d );
}
開發者ID:ahmadia,項目名稱:Elemental-1,代碼行數:30,代碼來源:Hanowa.hpp

示例5: PushCallStack

inline void
Diagonal( const std::vector<T>& d, DistMatrix<T,U,V>& D )
{
#ifndef RELEASE
    PushCallStack("Diagonal");
#endif
    const int n = d.size();
    D.ResizeTo( n, n );
    MakeZeros( D );

    const int localWidth = D.LocalWidth();
    const int colShift = D.ColShift();
    const int rowShift = D.RowShift();
    const int colStride = D.ColStride();
    const int rowStride = D.RowStride();
    for( int jLocal=0; jLocal<localWidth; ++jLocal )
    {
        const int j = rowShift + jLocal*rowStride;
        if( (j-colShift+colStride) % colStride == 0 )
        {
            const int iLocal = (j-colShift) / colStride;
            D.SetLocal( iLocal, jLocal, d[j] );
        }
    }
#ifndef RELEASE
    PopCallStack();
#endif
}
開發者ID:jimgoo,項目名稱:Elemental,代碼行數:28,代碼來源:Diagonal.hpp

示例6: entry

inline void
Riemann( DistMatrix<T,U,V>& R, int n )
{
#ifndef RELEASE
    CallStackEntry entry("Riemann");
#endif
    R.ResizeTo( n, n );
    const int localHeight = R.LocalHeight();
    const int localWidth = R.LocalWidth();
    const int colShift = R.ColShift();
    const int rowShift = R.RowShift();
    const int colStride = R.ColStride();
    const int rowStride = R.RowStride();
    for( int jLocal=0; jLocal<localWidth; ++jLocal )
    {
        const int j = rowShift + jLocal*rowStride;
        for( int iLocal=0; iLocal<localHeight; ++iLocal )
        {
            const int i = colShift + iLocal*colStride;
            if( ((j+2)%(i+2))==0 )
                R.SetLocal( iLocal, jLocal, T(i+1) );
            else
                R.SetLocal( iLocal, jLocal, T(-1) );
        }
    }
}
開發者ID:ahmadia,項目名稱:Elemental-1,代碼行數:26,代碼來源:Riemann.hpp

示例7: logic_error

inline void
Hankel( int m, int n, const std::vector<T>& a, DistMatrix<T,U,V>& A )
{
#ifndef RELEASE
    PushCallStack("Hankel");
#endif
    const int length = m+n-1;
    if( a.size() != (unsigned)length )
        throw std::logic_error("a was the wrong size");
    A.ResizeTo( m, n );

    const int localHeight = A.LocalHeight();
    const int localWidth = A.LocalWidth();
    const int colShift = A.ColShift();
    const int rowShift = A.RowShift();
    const int colStride = A.ColStride();
    const int rowStride = A.RowStride();
    for( int jLocal=0; jLocal<localWidth; ++jLocal )
    {
        const int j = rowShift + jLocal*rowStride;
        for( int iLocal=0; iLocal<localHeight; ++iLocal )
        {
            const int i = colShift + iLocal*colStride;
            A.SetLocal( iLocal, jLocal, a[i+j] );
        }
    }
#ifndef RELEASE
    PopCallStack();
#endif
}
開發者ID:certik,項目名稱:Elemental,代碼行數:30,代碼來源:Hankel.hpp

示例8: entry

inline void
Pei( DistMatrix<T,U,V>& P, Int n, T alpha )
{
#ifndef RELEASE
    CallStackEntry entry("MakeIdentity");
#endif
    P.ResizeTo( n, n );
    const Int localHeight = P.LocalHeight();
    const Int localWidth = P.LocalWidth();
    const Int colShift = P.ColShift();
    const Int rowShift = P.RowShift();
    const Int colStride = P.ColStride();
    const Int rowStride = P.RowStride();
    for( Int jLoc=0; jLoc<localWidth; ++jLoc )
    {
        const Int j = rowShift + jLoc*rowStride;
        for( Int iLoc=0; iLoc<localHeight; ++iLoc )
        {
            const Int i = colShift + iLoc*colStride;
            P.SetLocal( iLoc, jLoc, T(1) );
            if( i == j )
                P.UpdateLocal( iLoc, jLoc, alpha );
        }
    }
}
開發者ID:khalid-hasanov,項目名稱:Elemental,代碼行數:25,代碼來源:Pei.hpp

示例9: entry

inline void
Hankel( DistMatrix<T,U,V>& A, Int m, Int n, const std::vector<T>& a )
{
#ifndef RELEASE
    CallStackEntry entry("Hankel");
#endif
    const Int length = m+n-1;
    if( a.size() != (Unsigned)length )
        LogicError("a was the wrong size");
    A.ResizeTo( m, n );

    const Int localHeight = A.LocalHeight();
    const Int localWidth = A.LocalWidth();
    const Int colShift = A.ColShift();
    const Int rowShift = A.RowShift();
    const Int colStride = A.ColStride();
    const Int rowStride = A.RowStride();
    for( Int jLoc=0; jLoc<localWidth; ++jLoc )
    {
        const Int j = rowShift + jLoc*rowStride;
        for( Int iLoc=0; iLoc<localHeight; ++iLoc )
        {
            const Int i = colShift + iLoc*colStride;
            A.SetLocal( iLoc, jLoc, a[i+j] );
        }
    }
}
開發者ID:khalid-hasanov,項目名稱:Elemental,代碼行數:27,代碼來源:Hankel.hpp

示例10: logic_error

// Broadcast a matrix from the root grid to the others
void DepthBroadcast
( const mpi::Comm& depthComm,
  const DistMatrix<double,MC,MR>& A, 
        DistMatrix<double,MC,MR>& B )
{
    const int rank = mpi::CommRank(mpi::COMM_WORLD);
    const Grid& meshGrid = A.Grid();
    const int meshSize = meshGrid.Size();
    const int depthRank = rank / meshSize;

    const int localSize = A.LocalHeight()*A.LocalWidth();
    if( A.LocalHeight() != A.LocalLDim() )
        throw std::logic_error("Leading dimension did not match local height");

    B.Empty();
    B.AlignWith( A );
    B.ResizeTo( A.Height(), A.Width() );

    // Have the root pack the broadcast data
    if( depthRank == 0 )
        MemCopy( B.LocalBuffer(), A.LockedLocalBuffer(), localSize );

    // Broadcast from the root
    mpi::Broadcast( B.LocalBuffer(), localSize, 0, depthComm );
}
開發者ID:certik,項目名稱:Elemental,代碼行數:26,代碼來源:G3DGemm.cpp

示例11: entry

inline void
Ones( DistMatrix<T,U,V>& A, int m, int n )
{
#ifndef RELEASE
    CallStackEntry entry("Ones");
#endif
    A.ResizeTo( m, n );
    MakeOnes( A );
}
開發者ID:ahmadia,項目名稱:Elemental-1,代碼行數:9,代碼來源:Ones.hpp

示例12: entry

inline void
Hilbert( DistMatrix<F,U,V>& A, Int n )
{
#ifndef RELEASE
    CallStackEntry entry("Hilbert");
#endif
    A.ResizeTo( n, n );
    MakeHilbert( A );
}
開發者ID:khalid-hasanov,項目名稱:Elemental,代碼行數:9,代碼來源:Hilbert.hpp

示例13: entry

inline void
GKS( DistMatrix<F,U,V>& A, Int n )
{
#ifndef RELEASE
    CallStackEntry entry("GKS");
#endif
    A.ResizeTo( n, n );
    MakeGKS( A );
}
開發者ID:khalid-hasanov,項目名稱:Elemental,代碼行數:9,代碼來源:GKS.hpp

示例14: entry

inline void
Legendre( DistMatrix<F,U,V>& A, Int n )
{
#ifndef RELEASE
    CallStackEntry entry("Legendre");
#endif
    A.ResizeTo( n, n );
    MakeLegendre( A );
}
開發者ID:khalid-hasanov,項目名稱:Elemental,代碼行數:9,代碼來源:Legendre.hpp

示例15: entry

inline void
DiscreteFourier( DistMatrix<Complex<R>,U,V>& A, int n )
{
#ifndef RELEASE
    CallStackEntry entry("DiscreteFourier");
#endif
    A.ResizeTo( n, n );
    MakeDiscreteFourier( A );
}
開發者ID:ahmadia,項目名稱:Elemental-1,代碼行數:9,代碼來源:DiscreteFourier.hpp


注:本文中的DistMatrix::ResizeTo方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。