/* Copyright (c) 2009-2014, Jack Poulson All rights reserved. This file is part of Elemental and is under the BSD 2-Clause License, which can be found in the LICENSE file in the root directory, or at http://opensource.org/licenses/BSD-2-Clause */ #pragma once #ifndef ELEM_FOXLI_HPP #define ELEM_FOXLI_HPP #include ELEM_DIAGONALSCALE_INC #include ELEM_HERMITIANTRIDIAGEIG_INC #include ELEM_ZEROS_INC namespace elem { template inline void FoxLi( Matrix>& A, Int n, Real omega ) { DEBUG_ONLY(CallStackEntry cse("FoxLi")) typedef Complex C; const Real pi = 4*Atan( Real(1) ); const C phi = Sqrt( C(0,omega/pi) ); // Compute Gauss quadrature points and weights Matrix d, e; Zeros( d, n, 1 ); e.Resize( n-1, 1 ); for( Int j=0; j x, Z; HermitianTridiagEig( d, e, x, Z, UNSORTED ); auto z = LockedView( Z, 0, 0, 1, n ); Matrix sqrtWeights( z ); for( Int j=0; j inline void FoxLi( DistMatrix,U,V>& A, Int n, Real omega ) { DEBUG_ONLY(CallStackEntry cse("FoxLi")) typedef Complex C; const Real pi = 4*Atan( Real(1) ); const C phi = Sqrt( C(0,omega/pi) ); // Compute Gauss quadrature points and weights const Grid& g = A.Grid(); DistMatrix d(g), e(g); Zeros( d, n, 1 ); e.Resize( n-1, 1 ); for( Int iLoc=0; iLoc x(g); DistMatrix Z(g); HermitianTridiagEig( d, e, x, Z, UNSORTED ); auto z = LockedView( Z, 0, 0, 1, n ); DistMatrix sqrtWeights( z ); for( Int jLoc=0; jLoc x_U_STAR( x ); DistMatrix x_V_STAR( x ); for( Int jLoc=0; jLoc sqrtWeightsTrans(g); Transpose( sqrtWeights, sqrtWeightsTrans ); DiagonalScale( LEFT, NORMAL, sqrtWeightsTrans, A ); DiagonalScale( RIGHT, NORMAL, sqrtWeightsTrans, A ); } } // namespace elem #endif // ifndef ELEM_FOXLI_HPP