def eigenMethod(self, tol = 1e-8, maxiter = 1e5):
        """
        Determines ``pi`` by searching for the eigenvector corresponding to the first eigenvalue, using the :func:`eigs` function. 
        The result is stored in the class attribute ``pi``.         
        
        Parameters
        ----------
        tol : float, optional(default=1e-8)
            Tolerance level for the precision of the end result. A lower tolerance leads to more accurate estimate of ``pi``.
        maxiter : int, optional(default=1e5)
            The maximum number of iterations to be carried out.            
        
        Example
        -------
        >>> P = np.array([[0.5,0.5],[0.6,0.4]])
        >>> mc = markovChain(P)
        >>> mc.eigenMethod()
        >>> print(mc.pi) 
        [ 0.54545455  0.45454545]
        
        Remarks
        -------
        The speed of convergence depends heavily on the choice of the initial guess for ``pi``.
        Here we let the initial ``pi`` be a vector of ones. 
        For large state spaces, this method may not work well.
        At the moment, we call :func:`powerMethod` if the number of states is 2.
        Code is due to a colleague: http://nicky.vanforeest.com/probability/markovChains/markovChain.html
        """
        Q = self.getIrreducibleTransitionMatrix(probabilities=False)
        
        if Q.shape == (1, 1):
            self.pi = np.array([1.0]) 
            return          
        
        if Q.shape == (2, 2):
            self.pi= np.array([Q[1,0],Q[0,1]]/(Q[0,1]+Q[1,0]))
            return                 
        
        size = Q.shape[0]
        guess = np.ones(size,dtype=float)
        w, v = eigs(Q.T, k=1, v0=guess, sigma=1e-6, which='LM',tol=tol, maxiter=maxiter)
        pi = v[:, 0].real
        pi /= pi.sum()
        
        self.pi = pi