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 ); }
Base<F> Norm( const Matrix<F>& A, NormType type ) { DEBUG_ONLY(CSE cse("Norm")) Base<F> norm = 0; switch( type ) { // The following norms are rather cheap to compute case ENTRYWISE_ONE_NORM: norm = EntrywiseNorm( A, Base<F>(1) ); break; case FROBENIUS_NORM: norm = FrobeniusNorm( A ); break; case INFINITY_NORM: norm = InfinityNorm( A ); break; case MAX_NORM: norm = MaxNorm( A ); break; case ONE_NORM: norm = OneNorm( A ); break; // The following two norms make use of an SVD case NUCLEAR_NORM: norm = NuclearNorm( A ); break; case TWO_NORM: norm = TwoNorm( A ); break; } return norm; }
Base<F> TwoNorm( const ElementalMatrix<F>& A ) { DEBUG_ONLY(CSE cse("TwoNorm")) DistMatrix<Base<F>,VR,STAR> s( A.Grid() ); SVD( A, s ); return InfinityNorm( s ); }
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 ); }
Base<F> TwoNorm( const Matrix<F>& A ) { DEBUG_ONLY(CSE cse("TwoNorm")) Matrix<Base<F>> s; SVD( A, s ); return InfinityNorm( s ); }
Base<F> TwoNorm( const Matrix<F>& A ) { DEBUG_CSE Matrix<Base<F>> s; SVD( A, s ); return InfinityNorm( s ); }
Base<F> TwoNorm( const AbstractDistMatrix<F>& A ) { DEBUG_ONLY(CSE cse("TwoNorm")) DistMatrix<F> B( A ); DistMatrix<Base<F>,VR,STAR> s( A.Grid() ); SVD( B, s ); return InfinityNorm( s ); }
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 ); }
TwoNorm( const DistMatrix<F,U,V>& A ) { #ifndef RELEASE CallStackEntry entry("TwoNorm"); #endif typedef BASE(F) R; DistMatrix<F> B( A ); DistMatrix<R,VR,STAR> s( A.Grid() ); SVD( B, s ); return InfinityNorm( s ); }
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 ); }
TwoNorm( const Matrix<F>& A ) { #ifndef RELEASE CallStackEntry entry("TwoNorm"); #endif typedef BASE(F) R; Matrix<F> B( A ); Matrix<R> s; SVD( B, s ); return InfinityNorm( s ); }
TwoNormUpperBound( const DistMatrix<F>& A ) { #ifndef RELEASE CallStackEntry entry("TwoNormUpperBound"); #endif typedef BASE(F) R; const R m = A.Height(); const R n = A.Width(); const R maxNorm = MaxNorm( A ); const R oneNorm = OneNorm( A ); const R infNorm = InfinityNorm( A ); R upperBound = std::min( Sqrt(m*n)*maxNorm, Sqrt(m)*infNorm ); upperBound = std::min( upperBound, Sqrt(n)*oneNorm ); upperBound = std::min( upperBound, Sqrt( oneNorm*infNorm ) ); return upperBound; }
which can be found in the LICENSE file in the root directory, or at http://opensource.org/licenses/BSD-2-Clause */ #pragma once #ifndef EL_CONDITION_INFINITY_HPP #define EL_CONDITION_INFINITY_HPP namespace El { template<typename F> Base<F> InfinityCondition( const Matrix<F>& A ) { DEBUG_ONLY(CallStackEntry cse("InfinityCondition")) typedef Base<F> Real; Matrix<F> B( A ); const Real infNorm = InfinityNorm( B ); try { Inverse( B ); } catch( SingularMatrixException& e ) { return std::numeric_limits<Real>::infinity(); } const Real infNormInv = InfinityNorm( B ); return infNorm*infNormInv; } template<typename F> Base<F> InfinityCondition( const AbstractDistMatrix<F>& A ) { DEBUG_ONLY(CallStackEntry cse("InfinityCondition")) typedef Base<F> Real; DistMatrix<F> B( A ); const Real infNorm = InfinityNorm( B ); try { Inverse( B ); }