/*This is the file testEigen.C.  It is meant to show how to use the eigen class
of this project.  As explained in the readme file, you should only give this
class matrices of type double because even if the matrix is integers, that
doen't mean the eigenvalues are.  To compile this file type g++ testEigen.C at
the prompt. */

#include "Eigen.h"

void main()
{
    Matrix<double> mat(6,6);
    mat(0,0)=2.0;
    mat(0,1)=1.7;
    mat(0,2)=-1.5;
    mat(0,3)=3.25;
    mat(0,4)=9.0;
    mat(0,5)=1.5;
    mat(1,0)=1.7;
    mat(1,1)=3.0;
    mat(1,2)=-3.9;
    mat(1,3)=-0.5;
    mat(1,4)=1.8;
    mat(1,5)=2.6;
    mat(2,0)=-1.5;
    mat(2,1)=-3.9;
    mat(2,2)=4.0;
    mat(2,3)=5.0;
    mat(2,4)=8.5;
    mat(2,5)=4.3;
    mat(3,0)=3.25;
    mat(3,1)=-0.5;
    mat(3,2)=5.0;
    mat(3,3)=-1.0;
    mat(3,4)=1.2;
    mat(3,5)=0.7;
    mat(4,0)=9.0,
    mat(4,1)=1.8;
    mat(4,2)=8.5;
    mat(4,3)=1.2;
    mat(4,4)=0.5;
    mat(4,5)=-0.8;
    mat(5,0)=1.5;
    mat(5,1)=2.6;
    mat(5,2)=4.3;
    mat(5,3)=0.7;
    mat(5,4)=-0.8;
    mat(5,5)=-1.25;
    cout << "The input matrix is:"<<endl;
    cout <<mat;
    try{
        Eigen<double> eig(mat);
        Vector<double> v= eig.get_values(); //get the eigen values of mat
        cout <<endl<<"The Eigen Values of your matrix are:"<<endl;
        cout<<v;
        cout <<endl<<"The Eigen Vectors of your matrix are:"<<endl;
        Matrix <double> vectors = eig.get_vectors();//get the eigen vectors
        cout << vectors;
        cout <<endl<<"For a second example the matrix is:"<<endl;
        Matrix<double> sec(4,4);//a second example
        sec(0,0) = 2;
        sec(0,1) = -1;
        sec(0,2) = 3;
        sec(0,3) = -7;
        sec(1,0) = -1;
        sec(1,1) = 6;
        sec(1,2) = 12;
        sec(1,3) = -9;
        sec(2,0) = 3;
        sec(2,1) = 12;
        sec(2,2) = -13;
        sec(2,3) = -16;
        sec(3,0) = -7;
        sec(3,1) = -9;
        sec(3,2) = -16;
        sec(3,3) = 5;
        cout <<sec;
        Eigen<double> eig2(sec);
        Vector<double> v2= eig2.get_values();
        cout <<endl<<"The Eigen Values of your matrix are:"<<endl;
        cout<<v2;
        cout <<endl<<"The Eigen Vectors of your matrix are:"<<endl;
        Matrix <double> vectors2 = eig2.get_vectors();
        cout << vectors2;
            
    }
    catch(Exception& x)
    {
        x.display(cerr);
    }
        
}