示例#1
0
void GetImagPartOfDiagonal
( const DistMatrix<T,U,V>& A, AbstractDistMatrix<Base<T>>& d, Int offset )
{ 
    DEBUG_ONLY(CallStackEntry cse("GetImagPartOfDiagonal"))
    std::function<Base<T>(T)> imagPart
    ( []( T alpha ) { return ImagPart(alpha); } );
    GetMappedDiagonal( A, d, imagPart, offset );
}
示例#2
0
void GetImagPartOfDiagonal
( const DistMatrix<T,U,V>& A, ElementalMatrix<Base<T>>& d, Int offset )
{ 
    DEBUG_ONLY(CSE cse("GetImagPartOfDiagonal"))
    function<Base<T>(T)> imagPart
    ( []( T alpha ) { return ImagPart(alpha); } );
    GetMappedDiagonal( A, d, imagPart, offset );
}
示例#3
0
void ImagPart( const Matrix<T>& A, Matrix<Base<T>>& AImag )
{
    EL_DEBUG_CSE
    const Int m = A.Height();
    const Int n = A.Width();
    AImag.Resize( m, n );
    for( Int j=0; j<n; ++j )
        for( Int i=0; i<m; ++i )
            AImag(i,j) = ImagPart(A(i,j));
}
示例#4
0
bool HasNan( const Matrix<F>& H )
{
    DEBUG_CSE
    bool hasNan = false;
    const Int m = H.Height();
    const Int n = H.Width();
    for( Int j=0; j<n; ++j )
        for( Int i=0; i<m; ++i )
            if( !limits::IsFinite(RealPart(H(i,j))) ||
                !limits::IsFinite(ImagPart(H(i,j))) )
                hasNan = true;
    return hasNan;
}
示例#5
0
void MatrixMarket( const SparseMatrix<T>& A, string basename="matrix" )
{
    EL_DEBUG_CSE
    
    string filename = basename + "." + FileExtension(MATRIX_MARKET);
    ofstream file( filename.c_str(), std::ios::binary );
    if( !file.is_open() )
        RuntimeError("Could not open ",filename);

    // Write the header
    // ================
    {
        ostringstream os;
        os << "%%MatrixMarket matrix coordinate ";
        if( IsComplex<T>::value )
            os << "complex "; 
        else
            os << "real ";
        os << "general\n";
        file << os.str();
    }
    
    // Write the size line
    // ===================
    const Int m = A.Height();
    const Int n = A.Width();
    const Int numNonzeros = A.NumEntries();
    file << BuildString(m," ",n," ",numNonzeros,"\n");
    
    // Write the entries
    // =================
    for( Int e=0; e<numNonzeros; ++e )
    {
        const Int i = A.Row(e);
        const Int j = A.Col(e);
        const T value = A.Value(e);
        if( IsComplex<T>::value )
        {
            file << 
              BuildString(i," ",j," ",RealPart(value)," ",ImagPart(value),"\n");
        }
        else
        {
            file << BuildString(i," ",j," ",RealPart(value),"\n");
        }
    }
}
示例#6
0
 static Complex<T> Cast( S alpha )
 { return Complex<T>( T(RealPart(alpha)), T(ImagPart(alpha)) ); }
示例#7
0
文件: impl.hpp 项目: mcopik/Elemental
inline Base<F> Arg( const F& alpha )
{ return Atan2( ImagPart(alpha), RealPart(alpha) ); }
示例#8
0
inline Base<F>
FastAbs( const F& alpha )
{ return Abs(RealPart(alpha)) + Abs(ImagPart(alpha)); }
示例#9
0
void ImagPart
( const AbstractDistMatrix<T>& A, AbstractDistMatrix<Base<T>>& AImag )
{ 
    auto imagPart = []( const T& alpha ) { return ImagPart(alpha); };
    EntrywiseMap( A, AImag, MakeFunction(imagPart) );
}