/*  compute eigenvalues and eigenvectors of a symmetric tridiagonal matrix */

/*  (c) 2003 by Gunter Winkler (guwi17@gmx.de) */

/*  This routine is free software; you can redistribute it and/or modify     */
/*  it under the terms of the GNU Lesser General Public License as published */
/*  by the Free Software Foundation; either version 2.1 of the License, or   */
/*  (at your option) any later version. */

/*  This program is distributed in the hope that it will be useful,    */
/*  but WITHOUT ANY WARRANTY; without even the implied warranty of     */
/*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      */
/*  GNU General Public License for more details. */

/*  You should have received a copy of the GNU Lesser General Public    */
/*  License along with this program; if not, write to the Free Software */
/*  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.           */

/*  important info: This routine was adapted from a numeric repository  */
/*  of the Chemnitz University (http://www.tu-chemnitz.de) Many people  */
/*  including Prof. Arndt Meyer and Dr. Matthias Pester developed this  */
/*  code. They were inspired by similar EISPACK routines.               */

/* ****************************************************************** */

#ifndef _eigtridi_h_
#define _eigtridi_h_

/*     Documentation   */
/*     -------------   */

/* tridi_eigenvalues computes by using an implicite QZ-algorithm  */
/* the eigenvalues and eigenvectors of a tridiagonal symmetric matrix */

/*     Parameters:   

 *       nm      (I) :   leading dimension of ev[] 
 *       n       (I) :   dimension of diag[] and sub[] 
 *       diag[]  (I) :   diagonal elements of matrix 
 *               (O) :   eigenvalues 
 *       sub[]   (I) :   sub diagonal elements
 *       ev[]    (I) :   a few lines of a transformation matrix
 *                       column major storage assumed
 *                       set the first row of ev[] to (1,0,...,0) if you
 *                       need the first component of each eigenvector 
 *               (O) :   (first) nev elements of eigenvectors
 *       nev     (I) :   =k: compute only first nev elements of eigenvectors
 *       ierr    (O) :   error indicator 
 *                       number of the eigenvalue where the maximal
 *                       iteration count (30) was exceeded
 *                       only (ierr-1) eigenvalues are correct
 *       result      :   zero means ok, nonzero means error -> check ierr

 * ********************************************************************** */

#include <math.h>

/* forward declarations for incomplete C libraries */
double sqrt(double);

int tridi_eigenvalues ( int nm, int n, double diag[], double sub[], 
                        double ev[], int nev, int* ierr );
        
#endif
