Beispiel #1
0
inline typename Base<F>::type
HermitianSchattenNorm
( UpperOrLower uplo, const DistMatrix<F,U,V>& A, typename Base<F>::type p )
{
#ifndef RELEASE
    PushCallStack("HermitianSchattenNorm");
#endif
    typedef typename Base<F>::type R;

    DistMatrix<F> B( A );
    DistMatrix<R,VR,STAR> s( A.Grid() );
    HermitianSVD( uplo, B, s );

    // TODO: Think of how to make this more stable
    const int kLocal = s.LocalHeight();
    R localSum = 0;
    for( int j=kLocal-1; j>=0; --j )
        localSum += Pow( s.GetLocal(j,0), p );
    R sum;
    mpi::AllReduce( &localSum, &sum, 1, mpi::SUM, A.Grid().VRComm() );
    const R norm = Pow( sum, 1/p );
#ifndef RELEASE
    PopCallStack();
#endif
    return norm;
}
Beispiel #2
0
Base<F> HermitianTwoNorm( UpperOrLower uplo, const ElementalMatrix<F>& A )
{
    DEBUG_ONLY(CSE cse("HermitianTwoNorm"))
    DistMatrix<Base<F>,VR,STAR> s( A.Grid() );
    HermitianSVD( uplo, A, s );
    return InfinityNorm( s );
}
Beispiel #3
0
Base<F> HermitianTwoNorm( UpperOrLower uplo, const Matrix<F>& A )
{
    DEBUG_ONLY(CSE cse("HermitianTwoNorm"))
    Matrix<Base<F>> s;
    HermitianSVD( uplo, A, s );
    return InfinityNorm( s );
}
Beispiel #4
0
HermitianTwoNorm( UpperOrLower uplo, const DistMatrix<F,U,V>& A )
{
#ifndef RELEASE
    CallStackEntry entry("HermitianTwoNorm");
#endif
    typedef BASE(F) R;
    DistMatrix<F,U,V> B( A );
    DistMatrix<R,VR,STAR> s( A.Grid() );
    HermitianSVD( uplo, B, s );
    return InfinityNorm( s );
}
Beispiel #5
0
HermitianTwoNorm( UpperOrLower uplo, const Matrix<F>& A )
{
#ifndef RELEASE
    CallStackEntry entry("HermitianTwoNorm");
#endif
    typedef BASE(F) R;
    Matrix<F> B( A );
    Matrix<R> s;
    HermitianSVD( uplo, B, s );
    return InfinityNorm( s );
}
Beispiel #6
0
inline typename Base<F>::type
HermitianSchattenNorm
( UpperOrLower uplo, const Matrix<F>& A, typename Base<F>::type p )
{
#ifndef RELEASE
    PushCallStack("HermitianSchattenNorm");
#endif
    typedef typename Base<F>::type R;

    Matrix<F> B( A );
    Matrix<R> s;
    HermitianSVD( uplo, B, s );

    // TODO: Think of how to make this more stable
    const int k = s.Height();
    R sum = 0;
    for( int j=k-1; j>=0; --j )
        sum += Pow( s.Get(j,0), p );
    const R norm = Pow( sum, 1/p );
#ifndef RELEASE
    PopCallStack();
#endif
    return norm;
}