#!/usr/bin/env python
"""
Examples of how to obtain eigenvalues and eigenvectors of a matrix

author: Bob Wimmer
date: January 3, 2013
email: wimmer@physik.uni-kiel.de

This example uses much of the scipy Doc page on arpack, the package underlying the eigenvalue routine:
http://docs.scipy.org/doc/scipy/reference/tutorial/arpack.html

"""
import numpy as np
from scipy.linalg import eigh
from scipy.sparse.linalg import eigsh


#this allows us to use this file as a module, but also to call it as a standalone script
if __name__ == "__main__":
    np.random.seed(0)
    X = np.random.random((10,10)) - 0.5
    X = np.dot(X, X.T) #create a symmetric matrix
    evals_all, evecs_all = eigh(X)   #eigs
    print evals_all
    print evecs_all
