From 277d1edfa17bf3719d90ddbac8e31f6181e952c3 Mon Sep 17 00:00:00 2001 From: Sandeep Gupta Date: Sun, 18 Jun 2017 23:55:40 +0530 Subject: First commit --- src/c/linearAlgebra/hess/dhessa.c | 81 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 src/c/linearAlgebra/hess/dhessa.c (limited to 'src/c/linearAlgebra/hess/dhessa.c') diff --git a/src/c/linearAlgebra/hess/dhessa.c b/src/c/linearAlgebra/hess/dhessa.c new file mode 100644 index 0000000..57f81b3 --- /dev/null +++ b/src/c/linearAlgebra/hess/dhessa.c @@ -0,0 +1,81 @@ +/* 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