/***********************************************************************
*                                                                      *
* This file is part of CARAT.                                          *
* Copyright (C) 2015  Tilman Schulz                                    *
*                                                                      *
* CARAT is free software: you can redistribute it and/or modify        *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 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 General Public License    *
* along with this program.  If not, see <http://www.gnu.org/licenses/> *
*                                                                      *
***********************************************************************/
#include"typedef.h"


main (int argc, char *argv[])
{

	matrix_TYP **x1, **x2, **S, *X;
        int anz;

        extern char **FILENAMES;
        extern int FILEANZ;

        extern matrix_TYP **mget_mat();
        extern matrix_TYP *hyperbolic_isometry();

        read_header(argc, argv);
        if(FILEANZ != 3)
        {
           printf("usage:  hypstab 'file1' 'file2' 'file3' ,\n");
           printf("where 'file1' contains an 1 by n matrix x.\n");
           printf("where 'file2' contains an 1 by n matrix y.\n");
           printf("and   'file3' contains a n by n matrix S.\n");
           printf("of sylvester Typ (-1, n-1) s.t. xSx^{tr} < 0 and ySy^{tr} < 0\n");
           if (is_option('h')){
              exit(0);
           }
           else{
              exit(31);
           }
        }
        x1 = mget_mat(FILENAMES[0], &anz);
        x2 = mget_mat(FILENAMES[1], &anz);
        S = mget_mat(FILENAMES[2], &anz);
        X = hyperbolic_isometry(x1[0], x2[0], S[0]);
        if(X == NULL)
         printf("There exists no isometry\n");
        else
           put_mat(X, NULL, "isometry", 0);


   exit(3);
}
