/* Copyright (C) 2017 - IIT Bombay - FOSSEE This file must be used under the terms of the CeCILL. This source file is licensed as described in the file COPYING, which you should have received as part of this distribution. The terms are also available at http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt Author: Sandeep Gupta Organization: FOSSEE, IIT Bombay Email: toolbox@scilab.in */ /*This function finds the hessenberg form of a matrix A.*/ #include "hess.h" #include #include "string.h" #include "stdlib.h" #include "lapack.h" #include "matrixTranspose.h" #include "matrixMultiplication.h" extern int dgehrd_(int *, int *,int *,double *,int *,double *,double *,int *,int *); extern int dorghr_(int *, int *,int *,double *,int *,double *,double *,int *,int *); void dhessa(double *in1,int size,int nout,double *out1, double *out2){ int i,j,k; int N = size; int ILO=1; int IHI=N; double *A; int LDA=N; double *TAU; double *WORK; int LWORK = N; int INFO; A = (double *)malloc((double)size*size*sizeof(double)); memcpy(A,in1,size*size*sizeof(double)); TAU = (double *)malloc((double)size*sizeof(double)); WORK = (double *)malloc((double)LWORK*sizeof(double)); dgehrd_(&N,&ILO,&IHI,A,&LDA,TAU,WORK,&N,&INFO); for(i=0;i 1){ dorghr_(&N,&ILO,&IHI,A,&LDA,TAU,WORK,&LWORK,&INFO); for(i=0;i=ILO-1;i--){ tau = TAU[i]; double V[size],v[size],v1[size*size]; for(j=0;j