function cgsmsg( cgflag,cgrelres,cgiter,cgmaxiter )
    switch cgflag
        case 0
            fprintf( 1, 'CGS converged to tolerance %g after %d of %d iterations.\n', cgrelres, cgiter, cgmaxiter );
        case 1
            fprintf( 1, 'CGS failed to converge to tolerance %g after %d of %d iterations.\n', cgrelres, cgiter,cgmaxiter );
        case 2
            fprintf( 1, 'CGS preconditioner was ill-conditioned.\n' );
        case 3
            fprintf( 1, 'CGS stagnated after %d of %d iterations.\n', cgiter, cgmaxiter );
        case 4
            fprintf( 1, 'CGS failed due to over/underflow after %d of %d iterations.\n', cgiter, cgmaxiter );
        otherwise
            fprintf( 1, 'CGS failed after %d of %d iterations for unknown reason %d.\n', cgiter, cgmaxiter, cgflag );
    end
end


