def compare_eigen_methods():
    """ timing of different eigensolver methods"""
    import scipy.linalg as linalg 
    print '\n *** diagonalize a real symmetric band matrix by different methods ***\n'
    mt=mytimer.create(10)    
    try:
        N=float(sys.argv[1])
        S=float(sys.argv[2])
    except:
        sys.exit('supply N S (command line arguments): matrix dimension N and and number of super-diagonals S ')

    np.random.seed(1)
    a=np.random.random((N,N))

    ab=GMatrix(np.random.random((S+1,N)),storage='upper_banded')
    mt[0].start('lapack symmetric upper banded')
    print ab.store+'\n',ab.eigvals()[:5]
    mt[0].stop()

    a=ab.restore('full')
    mt[1].start('lapack symmetric full')
    print a.store+'\n',a.eigvals()[:5]
    mt[1].stop()

    print 'lingalg'
    mt[2].start('linalg general')
    print np.sort(linalg.eigvals(a.m).real)[:5]
    mt[2].stop()

    mytimer.table()
        # Schmidt orthonormalize
        for m in range(M): 
            vk[:,m]=vk[:,m]-vk[:,:m]*(vk[:,:m].T*vk[:,m])
            vk[:,m]=vk[:,m]/np.sqrt(vk[:,m].T*vk[:,m]) 
        t[3].stop()        

        t[4].start('A*vk')
        ek=(vk.T*A*vk).diagonal()
        t[4].stop()
        
    eguess=ek[0,0]
    t[5].stop()

    print ' appr.,exact',L,eguess,ev0[(np.abs(ev0-eguess)).argmin()]
print ' ---------------'
mt.table()

xlabel('Number of iterations')
ylabel('|DE/E|')
title('About as simple as it gets, folks')
axes().set_aspect('equal', 'datalim')
for m in range(M):
    plot(range(kplt), eplt[:,m], '-', lw=2)

show()

def inversiter(eguess,wfguess,A,S):

    vk=np.matrix(wfguess)
    olu,opi=la.lu_factor(Ovr)