[llvm-commits] CVS: llvm/test/Programs/MultiSource/McCat-05-eks/Divsol.c Divsol.h Jacobi.c Jacobi.h MM.c MM.h Makefile QRfact.c QRfact.h README Triang.c Triang.h main.c main.h print.c print.h val2 val3 val4 val5

Chris Lattner lattner at cs.uiuc.edu
Mon May 12 13:57:46 PDT 2003


Changes in directory llvm/test/Programs/MultiSource/McCat-05-eks:

Divsol.c added (r1.1)
Divsol.h added (r1.1)
Jacobi.c added (r1.1)
Jacobi.h added (r1.1)
MM.c added (r1.1)
MM.h added (r1.1)
Makefile added (r1.1)
QRfact.c added (r1.1)
QRfact.h added (r1.1)
README added (r1.1)
Triang.c added (r1.1)
Triang.h added (r1.1)
main.c added (r1.1)
main.h added (r1.1)
print.c added (r1.1)
print.h added (r1.1)
val2 added (r1.1)
val3 added (r1.1)
val4 added (r1.1)
val5 added (r1.1)

---
Log message:

Initial checking


---
Diffs of the changes:

Index: llvm/test/Programs/MultiSource/McCat-05-eks/Divsol.c
diff -c /dev/null llvm/test/Programs/MultiSource/McCat-05-eks/Divsol.c:1.1
*** /dev/null	Mon May 12 13:56:49 2003
--- llvm/test/Programs/MultiSource/McCat-05-eks/Divsol.c	Mon May 12 13:56:38 2003
***************
*** 0 ****
--- 1,167 ----
+ 
+ /****
+     Copyright (C) 1996 McGill University.
+     Copyright (C) 1996 McCAT System Group.
+     Copyright (C) 1996 ACAPS Benchmark Administrator
+                        benadmin at acaps.cs.mcgill.ca
+ 
+     This program is free software; you can redistribute it and/or modify
+     it provided this copyright notice is maintained.
+ 
+     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.  
+ ****/
+ 
+ /************************************************************************/
+ /*  author :   Mikkel Damsgaard                                         */
+ /*             Kirsebaerhaven 85b                                        */
+ /*                                                                      */
+ /*             DK-8520 Lystrup                                          */
+ /*             email mikdam at daimi.aau.dk                                */
+ /*                                                                      */
+ /*  files :                                                             */
+ /*  Divsol.c           QRfact.h           Divsol.h           Jacobi.c   */     
+ /*  Jacobi.h           Triang.c           print.c            MM.c       */   
+ /*  Triang.h           print.h            MM.h               QRfact.c   */   
+ /*  main.c             main.h                                           */
+ /*                                                                      */
+ /*  It calculates the eigenvalues for 4 different matrixes. It does not */
+ /*  take any input; those 4 matrixes are calculated by MakeMatrix       */
+ /*  function. Output is given as 4 files: val2, val3, val4, val5, that  */
+ /*  contains the eigenvalues for each of the matrixes.                  */
+ /*                                                                      */
+ /************************************************************************/
+ #include "MM.h"
+ #include "QRfact.h"
+ #include "Triang.h"
+ #include "Divsol.h"
+ 
+ 
+ void HouseMatrix(Matrix H,Vector v, int start, int end)
+ {
+   int i,j;
+   double a;
+ 
+   a = 2.0/xty(v,v,start,end);
+   MakeID(H);
+   for (i=start;i<=end;i++)
+     for (j=start;j<=end;j++)
+       H[i][j] -= a*v[i]*v[j];
+ }
+ 
+ void ApplyHouse(Matrix A,Vector v, int start, int end)
+ {
+   Matrix M,H;
+ 
+   M = newMatrix();
+   H = newMatrix();
+ 
+   HouseMatrix(H,v,0,n-1);
+ 
+ 	  /* Apply it A=H*A*H */
+   matrixMult(M,A,H);
+   matrixMult(A,H,M);
+ 
+   freeMatrix(H);
+   freeMatrix(M);
+ }
+ 
+ void WeirdHouse(Matrix A,Vector v,int row,int sc,int ec)
+ {
+   int i;
+   double a,b;
+ 
+   a = 0.0;
+ 
+   for (i=sc;i<=ec;i++)
+     a += A[row][i]*A[row][i];
+ 
+   /* a is the 2-norm squared of A(row,sc:ec) */
+ 
+   b=1/(A[row][ec]+sign(A[row][ec])*sqrt(a));
+ 
+   for (i=sc;i<ec;i++)
+     v[i] = A[row][i]*b;
+ 
+   v[ec] = 1.0;
+ }
+ 
+ Matrix DivideAndSolve(Matrix A,int p)
+ {
+   double a,b,d,e,s,c,mu,i;
+   int h,j,k,l,m,o,rowstartt,colstartt,rowendt,colendt;
+   Vector v,u,x,y,z;
+   Matrix B,C,D,E,Q,U,H;
+ 
+   U = newIdMatrix();
+   H = newMatrix();
+   v = newVector();
+ 
+   i = p+1;
+ 
+   rowstartt = i; 
+   colstartt = 0;
+ 
+   while (rowstartt<n)
+     {
+       rowendt = (rowstartt+i-1<n-1)?rowstartt+i-1:n-1; 
+       colstartt = rowstartt-i;
+       colendt = colstartt+i-1;
+       
+       /* Now T_i has dimension (p-h)x(p-h) */
+ 
+       /* First zero all but row 1 in T_i */
+ 
+       for (m=colstartt;m<=colendt;m++)
+ 	{
+ 	  if (norm(A,m,rowstartt,rowendt)!=0.0)
+ 	    {
+ 	      /* Find Householder(A(h:p,m)) */
+ 	      House(A,v,m,rowstartt,rowendt);
+ 	      for (o=0;o<rowstartt;o++)
+ 		v[o]=0.0;
+ 	      for (o=rowendt+1;o<n;o++)
+ 		v[o]=0.0;
+ 	      ApplyHouse(A,v,rowstartt,rowendt);
+ 	    }
+ 	  printf("m=%i, rowstart=%i, rowend=%i\n",m,rowstartt,rowendt);
+ 	  printVector(v);
+ 	  printMatrix(A);
+ 	}
+ 
+       /* Now zero all but the last entry in row 1 */
+ 
+       WeirdHouse(A,v,rowstartt,colstartt,colendt);
+ 
+       /* Apply the HouseHolder */
+ 
+       ApplyHouse(A,v,colstartt,colendt);
+ 
+       /* Now T_i has one single non-zero entry */
+ 
+       /* Iterate with explicit shift to zero the last
+ 	 non-zero entry */
+ 
+       while (A[rowstartt][colendt]>
+ 	     (A[rowstartt-1][colendt]-A[rowstartt][colendt+1])*epsilon)
+ 	{
+ 	  printMatrix(A);
+ 	  /* Wilkonson Shift?? */
+ 	  d  =(A[rowstartt-1][colendt]-A[rowstartt][colendt+1])/2.0;
+ 	  b = A[rowstartt][colendt];
+ 	  mu = A[rowstartt][colendt+1]+d-sign(d)*sqrt(d*d+b*b);
+ 
+ 	  /* Determine the givens */
+ 	  Givens(A[rowstartt-1][colendt]-mu,
+ 		 A[rowstartt][colendt],&s,&c);
+ 	  
+ 	  /* Apply the givens */
+ 	  ApplyGivens(A,s,c,rowstartt-1,rowstartt,0,n-1);
+ 	  printf("%e\n",A[colstartt][colendt]);
+ 	}
+ 
+       rowstartt+=i;
+       colstartt+=i;
+     }				    
+ }


Index: llvm/test/Programs/MultiSource/McCat-05-eks/Divsol.h
diff -c /dev/null llvm/test/Programs/MultiSource/McCat-05-eks/Divsol.h:1.1
*** /dev/null	Mon May 12 13:56:49 2003
--- llvm/test/Programs/MultiSource/McCat-05-eks/Divsol.h	Mon May 12 13:56:38 2003
***************
*** 0 ****
--- 1,22 ----
+ /************************************************************************/
+ /*  author :   Mikkel Damsgaard                                         */
+ /*             Kirsebaerhaven 85b                                        */
+ /*                                                                      */
+ /*             DK-8520 Lystrup                                          */
+ /*             email mikdam at daimi.aau.dk                                */
+ /*                                                                      */
+ /*  files :                                                             */
+ /*  Divsol.c           QRfact.h           Divsol.h           Jacobi.c   */     
+ /*  Jacobi.h           Triang.c           print.c            MM.c       */   
+ /*  Triang.h           print.h            MM.h               QRfact.c   */   
+ /*  main.c             main.h                                           */
+ /*                                                                      */
+ /*  It calculates the eigenvalues for 4 different matrixes. It does not */
+ /*  take any input; those 4 matrixes are calculated by MakeMatrix       */
+ /*  function. Output is given as 4 files: val2, val3, val4, val5, that  */
+ /*  contains the eigenvalues for each of the matrixes.                  */
+ /*                                                                      */
+ /************************************************************************/
+ #include "main.h"
+ 
+ Matrix DivideAndSolve(Matrix A,int i);


Index: llvm/test/Programs/MultiSource/McCat-05-eks/Jacobi.c
diff -c /dev/null llvm/test/Programs/MultiSource/McCat-05-eks/Jacobi.c:1.1
*** /dev/null	Mon May 12 13:56:49 2003
--- llvm/test/Programs/MultiSource/McCat-05-eks/Jacobi.c	Mon May 12 13:56:38 2003
***************
*** 0 ****
--- 1,109 ----
+ 
+ /****
+     Copyright (C) 1996 McGill University.
+     Copyright (C) 1996 McCAT System Group.
+     Copyright (C) 1996 ACAPS Benchmark Administrator
+                        benadmin at acaps.cs.mcgill.ca
+ 
+     This program is free software; you can redistribute it and/or modify
+     it provided this copyright notice is maintained.
+ 
+     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.  
+ ****/
+ 
+ /************************************************************************/
+ /*  author :   Mikkel Damsgaard                                         */
+ /*             Kirsebaerhaven 85b                                        */
+ /*                                                                      */
+ /*             DK-8520 Lystrup                                          */
+ /*             email mikdam at daimi.aau.dk                                */
+ /*                                                                      */
+ /*  files :                                                             */
+ /*  Divsol.c           QRfact.h           Divsol.h           Jacobi.c   */     
+ /*  Jacobi.h           Triang.c           print.c            MM.c       */   
+ /*  Triang.h           print.h            MM.h               QRfact.c   */   
+ /*  main.c             main.h                                           */
+ /*                                                                      */
+ /*  It calculates the eigenvalues for 4 different matrixes. It does not */
+ /*  take any input; those 4 matrixes are calculated by MakeMatrix       */
+ /*  function. Output is given as 4 files: val2, val3, val4, val5, that  */
+ /*  contains the eigenvalues for each of the matrixes.                  */
+ /*                                                                      */
+ /************************************************************************/
+ #include "QRfact.h"
+ #include "print.h"
+ 
+ void ApplyGivens(Matrix A,double s,double c, int i, int j,int start,int end)
+ { /* A = G.t()AG, G = Givens(i,j,theta); */
+   double t1,t2;
+   int k;
+ 
+   for (k=start;k<=end;k++)
+     { /* A = G.t()*A */
+       t1=A[i][k]; t2=A[j][k];
+       A[i][k] = c*t1-s*t2; A[j][k] = s*t1+c*t2;
+     }
+   
+   for (k=start;k<=end;k++)
+     { /* A = A*G */
+       t1=A[k][i]; t2=A[k][j];
+       A[k][i] = c*t1-s*t2; A[k][j] = s*t1+c*t2;
+     }
+ }
+ 
+ Matrix Jacobi(Matrix A,int bw)
+ {
+   double a,b,s,c;
+   int i,j,k,l,m;
+   Matrix U;
+ 
+   U = newIdMatrix();
+ 
+   for (i=bw;i>=2;i--)
+     { /* Remove one bandwith at a time */
+       for (j=0;j<n-i;j++)
+ 	{ /* Iterate through the diagonal */
+ 	  
+ 	  /* Calculate the Givens to zero A[j][j+i] */
+ 	  Givens(A[j][j+i-1],A[j][j+i],&s,&c);
+ 
+ 	  /* Now apply that givens */
+ 
+ 	  /* A = G.t()*A*G */
+ 	  ApplyGivens(A,s,c,j+i-1,j+i,j,(j+2*i<n)?j+2*i:n-1);
+ 	  /* U = U*G */
+ 	  ApplyRGivens(U,s,c,j+i-1,j+i);
+ 
+ 	  /* Now the bandwith is i+1, and we want it to return to i */
+ 	  /* so we chase the unwanted non-zero element down the diagonal */
+ 	  /* The unwanted non-zero element is A[j+i-1][j+2i+1] */
+ 
+ 	  /* Check(A,U,bw); */
+ 
+ 	  m = j+i;
+ 	  while (m<n-i)
+ 	    {
+ 	      /* We determine the givens that will zero the unwanted
+ 		 non-zero element */
+ 
+ 	      Givens(A[m-1][m+i-1],A[m-1][m+i],&s,&c);
+ 
+ 	      /* And apply that givens */
+ 	      
+ 	      /* A = G.t()*A*G */
+ 	      ApplyGivens(A,s,c,m+i-1,m+i,m-1,(m+2*i<n)?m+2*i:n-1);
+ 	      /* U = U*G */
+ 	      ApplyRGivens(U,s,c,m+i-1,m+i); 
+ 
+ 	      /* Check(A,U,bw); */
+ 
+ 	      m += i;
+ 	    }
+ 
+ 	  /* Now the ith band is zero in the first j positions */
+ 	}
+     }
+   return U;
+ }


Index: llvm/test/Programs/MultiSource/McCat-05-eks/Jacobi.h
diff -c /dev/null llvm/test/Programs/MultiSource/McCat-05-eks/Jacobi.h:1.1
*** /dev/null	Mon May 12 13:56:49 2003
--- llvm/test/Programs/MultiSource/McCat-05-eks/Jacobi.h	Mon May 12 13:56:38 2003
***************
*** 0 ****
--- 1,22 ----
+ /************************************************************************/
+ /*  author :   Mikkel Damsgaard                                         */
+ /*             Kirsebaerhaven 85b                                        */
+ /*                                                                      */
+ /*             DK-8520 Lystrup                                          */
+ /*             email mikdam at daimi.aau.dk                                */
+ /*                                                                      */
+ /*  files :                                                             */
+ /*  Divsol.c           QRfact.h           Divsol.h           Jacobi.c   */     
+ /*  Jacobi.h           Triang.c           print.c            MM.c       */   
+ /*  Triang.h           print.h            MM.h               QRfact.c   */   
+ /*  main.c             main.h                                           */
+ /*                                                                      */
+ /*  It calculates the eigenvalues for 4 different matrixes. It does not */
+ /*  take any input; those 4 matrixes are calculated by MakeMatrix       */
+ /*  function. Output is given as 4 files: val2, val3, val4, val5, that  */
+ /*  contains the eigenvalues for each of the matrixes.                  */
+ /*                                                                      */
+ /************************************************************************/
+ #include "main.h"
+ 
+ Matrix Jacobi(Matrix A,int i);


Index: llvm/test/Programs/MultiSource/McCat-05-eks/MM.c
diff -c /dev/null llvm/test/Programs/MultiSource/McCat-05-eks/MM.c:1.1
*** /dev/null	Mon May 12 13:56:49 2003
--- llvm/test/Programs/MultiSource/McCat-05-eks/MM.c	Mon May 12 13:56:38 2003
***************
*** 0 ****
--- 1,164 ----
+ 
+ /****
+     Copyright (C) 1996 McGill University.
+     Copyright (C) 1996 McCAT System Group.
+     Copyright (C) 1996 ACAPS Benchmark Administrator
+                        benadmin at acaps.cs.mcgill.ca
+ 
+     This program is free software; you can redistribute it and/or modify
+     it provided this copyright notice is maintained.
+ 
+     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.  
+ ****/
+ 
+ /************************************************************************/
+ /*  author :   Mikkel Damsgaard                                         */
+ /*             Kirsebaerhaven 85b                                        */
+ /*                                                                      */
+ /*             DK-8520 Lystrup                                          */
+ /*             email mikdam at daimi.aau.dk                                */
+ /*                                                                      */
+ /*  files :                                                             */
+ /*  Divsol.c           QRfact.h           Divsol.h           Jacobi.c   */     
+ /*  Jacobi.h           Triang.c           print.c            MM.c       */   
+ /*  Triang.h           print.h            MM.h               QRfact.c   */   
+ /*  main.c             main.h                                           */
+ /*                                                                      */
+ /*  It calculates the eigenvalues for 4 different matrixes. It does not */
+ /*  take any input; those 4 matrixes are calculated by MakeMatrix       */
+ /*  function. Output is given as 4 files: val2, val3, val4, val5, that  */
+ /*  contains the eigenvalues for each of the matrixes.                  */
+ /*                                                                      */
+ /************************************************************************/
+ #include "MM.h"
+ 
+ Matrix MakeMatrix(int i)
+ {
+   int j,k;
+   Matrix M;
+ 
+   M=newMatrix();
+ 
+   for (j=0;j<n;j++)
+     for (k=j;k<n;k++)
+       if (abs(k-j)>i) M[j][k] = M[k][j] = 0.0;
+       else M[j][k] = M[k][j] = 4.0/(5.0*sqrt(2.0*M_PI))*
+ 	exp(-(8.0/25.0)*(j-k)*(j-k));
+   return M;
+ }
+ 	    
+ Matrix newMatrix(void)
+ {
+   Matrix M;
+   int i;
+ 
+   M = (Matrix)malloc(sizeof(double *)*n);
+   for (i=0;i<n;i++)
+     M[i] = (double *)malloc(sizeof(double)*n);
+ 
+   return M;
+ }
+ 
+ Vector newVector(void)
+ {
+   Vector v;
+ 
+   v = (Vector) malloc(sizeof(double)*n);
+   
+   return v;
+ }
+ 
+ void matrixMult(Matrix C,Matrix A, Matrix B)
+ {
+   int i,j,k;
+ 
+   for (i=0;i<n;i++)
+     for (j=0;j<n;j++)
+       {
+ 	C[i][j] = 0.0;
+ 	for (k=0;k<n;k++)
+ 	  C[i][j] += A[i][k]*B[k][j];
+       }
+ }
+ 
+ void matrixTranspose(Matrix A)
+ {
+   int i,j;
+   double a;
+ 
+   for (i=0;i<n;i++)
+     for (j=i+1;j<n;j++)
+       {
+ 	a = A[i][j];
+ 	A[i][j] = A[j][i];
+ 	A[j][i] = a;
+       }
+ }
+ 
+ Matrix newIdMatrix(void)
+ {
+   Matrix C;
+ 
+   C = newMatrix();
+ 
+   MakeID(C);
+ 
+   return C;
+ }
+ 
+ void MakeID(Matrix A)
+ {
+   int l,j;
+ 
+   for (j=0;j<n;j++)
+     for (l=j;l<n;l++)
+       if (j==l) A[j][l]=1;
+       else A[j][l]=A[l][j]=0.0;
+ }
+ 
+ void freeMatrix(Matrix A)
+ {
+   int i;
+ 
+   for (i=0;i<n;i++)
+     free(A[i]);
+ 
+   free(A);
+ }
+ 
+ double NormInf(Matrix A)
+ {
+   double a,b;
+   int i,j;
+ 
+   a = 0.0;
+   for (i=0;i<n;i++)
+     {
+       b = 0.0;
+       for (j=0;j<n;j++)
+ 	b += fabs(A[i][j]);
+       if (b>a) a=b;
+     }
+ 
+   return a;
+ }
+ 
+ double NormOne(Matrix A)
+ {
+   double a,b;
+   int i,j;
+ 
+   a = 0.0;
+   for (j=0;j<n;j++)
+     {
+       b = 0.0;
+       for (i=0;i<n;i++)
+ 	b += fabs(A[i][j]);
+       if (b>a) a=b;
+     }
+ 
+   return a;
+ }
+ 


Index: llvm/test/Programs/MultiSource/McCat-05-eks/MM.h
diff -c /dev/null llvm/test/Programs/MultiSource/McCat-05-eks/MM.h:1.1
*** /dev/null	Mon May 12 13:56:49 2003
--- llvm/test/Programs/MultiSource/McCat-05-eks/MM.h	Mon May 12 13:56:38 2003
***************
*** 0 ****
--- 1,38 ----
+ /************************************************************************/
+ /*  author :   Mikkel Damsgaard                                         */
+ /*             Kirsebaerhaven 85b                                        */
+ /*                                                                      */
+ /*             DK-8520 Lystrup                                          */
+ /*             email mikdam at daimi.aau.dk                                */
+ /*                                                                      */
+ /*  files :                                                             */
+ /*  Divsol.c           QRfact.h           Divsol.h           Jacobi.c   */     
+ /*  Jacobi.h           Triang.c           print.c            MM.c       */   
+ /*  Triang.h           print.h            MM.h               QRfact.c   */   
+ /*  main.c             main.h                                           */
+ /*                                                                      */
+ /*  It calculates the eigenvalues for 4 different matrixes. It does not */
+ /*  take any input; those 4 matrixes are calculated by MakeMatrix       */
+ /*  function. Output is given as 4 files: val2, val3, val4, val5, that  */
+ /*  contains the eigenvalues for each of the matrixes.                  */
+ /*                                                                      */
+ /************************************************************************/
+ #ifndef __MM__H__
+ #define __MM__H__
+ 
+ #include "main.h"
+ 
+ Matrix MakeMatrix(int i);
+ Matrix newMatrix(void);
+ Vector newVector(void);
+ void matrixMult(Matrix C,Matrix A,Matrix B);
+ void matrixTranspose(Matrix A);
+ Matrix newIdMatrix(void);
+ void MakeID(Matrix A);
+ void freeMatrix(Matrix A);
+ double NormInf(Matrix A);
+ double NormOne(Matrix A);
+ 
+ #endif
+ 
+ 


Index: llvm/test/Programs/MultiSource/McCat-05-eks/Makefile
diff -c /dev/null llvm/test/Programs/MultiSource/McCat-05-eks/Makefile:1.1
*** /dev/null	Mon May 12 13:56:49 2003
--- llvm/test/Programs/MultiSource/McCat-05-eks/Makefile	Mon May 12 13:56:38 2003
***************
*** 0 ****
--- 1,7 ----
+ LEVEL = ../../../..
+ PROG = eks
+ LDFLAGS = -lm
+ #RUN_OPTIONS += 
+ #INPUT_FILENAME = bnchmrk.in1
+ include ../Makefile.multisrc
+ 


Index: llvm/test/Programs/MultiSource/McCat-05-eks/QRfact.c
diff -c /dev/null llvm/test/Programs/MultiSource/McCat-05-eks/QRfact.c:1.1
*** /dev/null	Mon May 12 13:56:49 2003
--- llvm/test/Programs/MultiSource/McCat-05-eks/QRfact.c	Mon May 12 13:56:38 2003
***************
*** 0 ****
--- 1,155 ----
+ 
+ /****
+     Copyright (C) 1996 McGill University.
+     Copyright (C) 1996 McCAT System Group.
+     Copyright (C) 1996 ACAPS Benchmark Administrator
+                        benadmin at acaps.cs.mcgill.ca
+ 
+     This program is free software; you can redistribute it and/or modify
+     it provided this copyright notice is maintained.
+ 
+     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.  
+ ****/
+ 
+ /************************************************************************/
+ /*  author :   Mikkel Damsgaard                                         */
+ /*             Kirsebaerhaven 85b                                        */
+ /*                                                                      */
+ /*             DK-8520 Lystrup                                          */
+ /*             email mikdam at daimi.aau.dk                                */
+ /*                                                                      */
+ /*  files :                                                             */
+ /*  Divsol.c           QRfact.h           Divsol.h           Jacobi.c   */     
+ /*  Jacobi.h           Triang.c           print.c            MM.c       */   
+ /*  Triang.h           print.h            MM.h               QRfact.c   */   
+ /*  main.c             main.h                                           */
+ /*                                                                      */
+ /*  It calculates the eigenvalues for 4 different matrixes. It does not */
+ /*  take any input; those 4 matrixes are calculated by MakeMatrix       */
+ /*  function. Output is given as 4 files: val2, val3, val4, val5, that  */
+ /*  contains the eigenvalues for each of the matrixes.                  */
+ /*                                                                      */
+ /************************************************************************/
+ #include "QRfact.h"
+ #include "MM.h"
+ 
+ /* Calculate givens transformation */
+ void Givens(double a,double b,double *s,double *c)
+ {
+   double t;
+   if (b==0.0) {*c=1;*s=0;}
+   else if (fabs(b)>fabs(a))
+     {
+       t = -a/b;
+       *s = 1/sqrt(1+t*t);
+       *c = (*s)*t;
+     }
+   else
+     {
+       t = -b/a;
+       *c = 1/sqrt(1+t*t);
+       *s = (*c)*t;
+     }
+   /* printf("%f  %f  %f   %f\n",a,b,(*c)*a-(*s)*b,(*c)*b+(*s)*a); */
+ }
+ 
+ int sign(double a)
+ {
+   if (a<0) return -1;
+   return 1;
+ }
+ 
+ 
+ void ApplyRGivens(Matrix U,double s, double c,int i,int j)
+ {  /* U = U*G, G=Givens(i,j,theta) */  
+   int k;
+   double t1,t2;
+ 
+   for (k=0;k<n;k++) 
+     { 
+       t1=U[k][i]; t2=U[k][j];
+       U[k][i] = c*t1-s*t2; U[k][j] = s*t1+c*t2;
+     }
+ }
+     
+ 
+ Matrix QRiterate(Matrix A, Matrix U)
+ {
+   double c,s,t,a,b,app,aqq,apq,a1p,a1q,a4p,a4q;
+   double d,mu,x,z,t1,t2;
+ 
+   int i,j,k,notdone=1,p,q,l,m;
+ 
+   while (notdone)
+     {
+       /* First examine if any offdiagonal is small enough to elimante */
+       for (i=0;i<n-1;i++)
+ 	if (fabs(A[i+1][i])<(fabs(A[i][i])+fabs(A[i+1][i+1]))*epsilon)
+ 	  A[i+1][i]=A[i][i+1]=0.0;
+ 
+       /* Find the boundaries for the QR step */
+       q=n-1;
+       while ((q>0) && (A[q-1][q]==0.0)) q--;
+       if (q==0) 
+ 	{
+ 	  notdone=0;
+ 	}
+       else
+ 	{
+ 	  p=q;
+ 	  while ((p>0) && (A[p-1][p]!=0.0)) p--;
+ 	}
+       
+       if (!notdone) break;
+       /* printf("%e   %i\n",A[q-1][q],q); */
+       /* Now we do the QR step on the submatrice A[p..q][p..q] */
+       
+       /* First calculate the shift */
+       d = (A[q-1][q-1]-A[q][q])/2; t=A[q][q-1]; t=t*t;
+       mu = A[q][q]-(t/(d+sign(d)*sqrt(d*d+t)));
+       x = A[p][p]-mu;
+       z = A[p+1][p];
+ 
+       /* Now QR faktorise */
+       for (i=p;i<q;i++)
+ 	{
+ 	  /* Find the givens rotation */
+ 	  Givens(x,z,&s,&c);
+ 
+ 	  /* l=max(p,i-1); */
+ 
+ 	  l = (i-1>p)?i-1:p;
+ 
+ 	  /* m=min(q,i+2); */
+ 
+ 	  m = (q<i+2)?q:i+2;
+ 
+ 	  for (k=l;k<=m;k++) 
+ 	    {
+ 	      t1=A[i][k]; t2=A[i+1][k];
+ 	      A[i][k] = c*t1-s*t2; A[i+1][k] = s*t1+c*t2;
+ 	    }
+ 	  
+ 	  for (k=l;k<=m;k++) 
+ 	    {
+ 	      t1=A[k][i]; t2=A[k][i+1];
+ 	      A[k][i] = c*t1-s*t2; A[k][i+1] = s*t1+c*t2;
+ 	    }
+ 
+ 
+ 	  /* Store the givens in U */
+ 	  /* U = G.T()*U */
+ 	  ApplyRGivens(U,s,c,i,i+1);
+ 
+ 	  /* And find the next pair of troublemakers */
+ 	  if (i<q-1)
+ 	    {
+ 	      x=A[i+1][i];
+ 	      z=A[i+2][i];
+ 	    }
+ 	}
+     }
+ 
+ }


Index: llvm/test/Programs/MultiSource/McCat-05-eks/QRfact.h
diff -c /dev/null llvm/test/Programs/MultiSource/McCat-05-eks/QRfact.h:1.1
*** /dev/null	Mon May 12 13:56:49 2003
--- llvm/test/Programs/MultiSource/McCat-05-eks/QRfact.h	Mon May 12 13:56:38 2003
***************
*** 0 ****
--- 1,29 ----
+ /************************************************************************/
+ /*  author :   Mikkel Damsgaard                                         */
+ /*             Kirsebaerhaven 85b                                        */
+ /*                                                                      */
+ /*             DK-8520 Lystrup                                          */
+ /*             email mikdam at daimi.aau.dk                                */
+ /*                                                                      */
+ /*  files :                                                             */
+ /*  Divsol.c           QRfact.h           Divsol.h           Jacobi.c   */     
+ /*  Jacobi.h           Triang.c           print.c            MM.c       */   
+ /*  Triang.h           print.h            MM.h               QRfact.c   */   
+ /*  main.c             main.h                                           */
+ /*                                                                      */
+ /*  It calculates the eigenvalues for 4 different matrixes. It does not */
+ /*  take any input; those 4 matrixes are calculated by MakeMatrix       */
+ /*  function. Output is given as 4 files: val2, val3, val4, val5, that  */
+ /*  contains the eigenvalues for each of the matrixes.                  */
+ /*                                                                      */
+ /************************************************************************/
+ #include "main.h"
+ #include "MM.h"
+ 
+ 
+ /* Iterate, by doing QR iterations with wilson shiftQ, asume that A is  
+    tridiagonal, return Q, such that Q^TAQ=diag(l1,l2,...,ln).
+    Using algorithm 8.2.3 */
+ Matrix QRiterate(Matrix A, Matrix U);
+ void Givens(double x,double y, double *s, double *c);
+ void ApplyRGivens(Matrix U,double s, double c,int i,int j);


Index: llvm/test/Programs/MultiSource/McCat-05-eks/README
diff -c /dev/null llvm/test/Programs/MultiSource/McCat-05-eks/README:1.1
*** /dev/null	Mon May 12 13:56:49 2003
--- llvm/test/Programs/MultiSource/McCat-05-eks/README	Mon May 12 13:56:38 2003
***************
*** 0 ****
--- 1,48 ----
+ The author of the program is:
+ 
+ Mikkel Damsgaard 
+ Kirsebaerhaven 85b
+ DK-8520 Lystrup
+ 
+ The program consists of the following files:
+ 
+ Divsol.c           QRfact.h           Divsol.h           Jacobi.c           
+ Jacobi.h           Triang.c           print.c            MM.c               
+ Triang.h           print.h            MM.h               QRfact.c           
+ main.c             main.h             
+ 
+ It calculates the eigenvalues for 4 different matrixes. It does not
+ take any input; those 4 matrixes are calculated by MakeMatrix
+ function. Output is given as 4 files: val2, val3, val4, val5, that
+ contains the eigenvalues for each of the matrixes.
+ 
+ Output files to compeare with, are:
+ 
+ val2.out  val3.out  val4.out  val5.out
+ 
+ The program can be compiled with :
+ 
+  gcc MM.c main.c QRfact.c Triang.c print.c Jacobi.c Divsol.c -o eks -lm
+ 
+ Program can be run with 
+ 
+  eks
+ 
+ The benchmark is given by
+ 
+ ------------------------------------------------------------------------------
+  Belmina Dzafic                  
+  Spobjergvej 22, 4+5            Email:     belmina at daimi.aau.dk  
+  8220 Brabrand                  Phone:     + 45 89 44 90 73  
+ ------------------------------------------------------------------------------
+ 
+ ------------------------------------------------------------------------------
+  Peter Andersen                  Homepage:  http://www.daimi.aau.dk/~ptr/  
+  Regenburgsgade 6 st.th.         Email:     ptr at daimi.aau.dk  
+  8000 Aarhus C                   Phone:     + 45 86 19 62 25 
+ ------------------------------------------------------------------------------
+ 
+ 
+ 
+ 
+ 


Index: llvm/test/Programs/MultiSource/McCat-05-eks/Triang.c
diff -c /dev/null llvm/test/Programs/MultiSource/McCat-05-eks/Triang.c:1.1
*** /dev/null	Mon May 12 13:56:49 2003
--- llvm/test/Programs/MultiSource/McCat-05-eks/Triang.c	Mon May 12 13:56:38 2003
***************
*** 0 ****
--- 1,161 ----
+ 
+ /****
+     Copyright (C) 1996 McGill University.
+     Copyright (C) 1996 McCAT System Group.
+     Copyright (C) 1996 ACAPS Benchmark Administrator
+                        benadmin at acaps.cs.mcgill.ca
+ 
+     This program is free software; you can redistribute it and/or modify
+     it provided this copyright notice is maintained.
+ 
+     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.  
+ ****/
+ 
+ /************************************************************************/
+ /*  author :   Mikkel Damsgaard                                         */
+ /*             Kirsebaerhaven 85b                                        */
+ /*                                                                      */
+ /*             DK-8520 Lystrup                                          */
+ /*             email mikdam at daimi.aau.dk                                */
+ /*                                                                      */
+ /*  files :                                                             */
+ /*  Divsol.c           QRfact.h           Divsol.h           Jacobi.c   */     
+ /*  Jacobi.h           Triang.c           print.c            MM.c       */   
+ /*  Triang.h           print.h            MM.h               QRfact.c   */   
+ /*  main.c             main.h                                           */
+ /*                                                                      */
+ /*  It calculates the eigenvalues for 4 different matrixes. It does not */
+ /*  take any input; those 4 matrixes are calculated by MakeMatrix       */
+ /*  function. Output is given as 4 files: val2, val3, val4, val5, that  */
+ /*  contains the eigenvalues for each of the matrixes.                  */
+ /*                                                                      */
+ /************************************************************************/
+ #include "Triang.h"
+ #include "MM.h"
+ #include "print.h"
+ 
+ 
+ double norm(Matrix A,int col,int rs,int re)
+ {
+   double t=0.0;
+   int i;
+ 
+   for (i=rs;i<=re;i++)
+     t += A[i][col]*A[i][col];
+   
+   return sqrt(t);
+ }
+ 
+ void House(Matrix A,Vector v,int col,int sr,int er)
+ {
+   double a,b;
+   int m;
+ 
+   a=norm(A,col,sr,er);
+   b=1/(A[sr][col]+sign(A[sr][col])*a);
+ 
+   for (m=sr+1;m<=er;m++)
+ 	v[m]=A[m][col]*b;
+       
+   v[sr] = 1.0;
+ }
+ 
+ double xty(Vector x,Vector y,int s,int e)
+ {
+   double t=0.0;
+   int i;
+ 
+   for (i=s;i<=e;i++)
+     t += x[i]*y[i];
+ 
+   return t;
+ }
+ 
+ Matrix Trianglelise(Matrix A,int i)
+ {
+   Matrix U,P,T;
+ 
+   double a,b;
+   Vector v,w,p;
+   
+   int j,k,l,m,h;
+ 
+   /* Initialize U to be the I */
+   P = newMatrix();
+   U = newIdMatrix();
+ 
+   v=(Vector)malloc(sizeof(double)*n);
+   w=(Vector)malloc(sizeof(double)*n);
+   p=(Vector)malloc(sizeof(double)*n);
+ 
+   if (i<2) return A;
+   l=i; /* This is the number of non-zero off diagonal entries */ 
+   for (j=0;j<n-2;j++) /* Iterate through the columns */
+     { 
+ 
+       /* This is to save time, h = min(j+l+2,n-1) */
+       h = (j+l+i<n-1)?j+l+i:n-1;
+ 
+       /* Find the householder vektor */
+       House(A,v,j,j+1,h);
+ 
+       /* Now v[j+1:j+l] contains the householder vektor */
+ 
+       /* Well, we need to apply the thing pre and 
+ 	 post multiplikative */
+ 
+       /* b = 1/(v.t()*v) */
+       b=1.0/xty(v,v,j+1,h);
+ 
+       for (m=j;m<=h;m++)
+ 	p[m] = 2.0*xty(A[m],v,j+1,h)*b; 
+ 
+       a=xty(p,v,j+1,h)*b;
+       /* w = p - a*v */
+       for (m=j+1;m<=h;m++)
+ 	w[m] = p[m] - a*v[m];
+ 
+       /* Update A[j+1:h][j+1:h], and utilize that we        */
+       /* know A to be symmetric before and after the update */
+       for (m=j+1;m<=h;m++)
+ 	for (k=m;k<=h;k++)
+ 	  {
+ 	    A[m][k] -= v[m]*w[k] + w[m]*v[k];
+ 	    A[k][m] = A[m][k];
+ 	  }
+ 
+       /* Calculating the off diagonal entry */
+ 
+       A[j+1][j] = A[j][j+1] = A[j][j+1] - p[j];
+ 
+       /* And zero the rest of the column/row */
+       for (m=j+2;m<=h;m++)
+ 	A[j][m] = A[m][j] = 0.0; 
+       
+       /* Calculate U*P */
+       /* Only update colums j+1 through j+l */
+       /* Remember that U is NOT symmetric */
+       /* TIME l*n+n*2*l = 3*n*l */
+ 
+       for (m=0;m<n;m++)
+ 	w[m]=2.0*b*xty(U[m],v,j+1,h);
+ 
+       for (m=0;m<n;m++)
+ 	for (k=j+1;k<=h;k++)
+ 	  U[m][k] -= w[m]*v[k]; 
+ 
+       /* Update l */
+       if (j+l+(i-1)<n-1) l += (i-1); else l = (n-1)-(j+1);
+       /* Check(A,U,i); */
+     }
+ 
+   free(v);
+   free(w);
+   free(p);
+   return U;
+ 
+ }
+ 
+ 


Index: llvm/test/Programs/MultiSource/McCat-05-eks/Triang.h
diff -c /dev/null llvm/test/Programs/MultiSource/McCat-05-eks/Triang.h:1.1
*** /dev/null	Mon May 12 13:56:49 2003
--- llvm/test/Programs/MultiSource/McCat-05-eks/Triang.h	Mon May 12 13:56:38 2003
***************
*** 0 ****
--- 1,26 ----
+ /************************************************************************/
+ /*  author :   Mikkel Damsgaard                                         */
+ /*             Kirsebaerhaven 85b                                        */
+ /*                                                                      */
+ /*             DK-8520 Lystrup                                          */
+ /*             email mikdam at daimi.aau.dk                                */
+ /*                                                                      */
+ /*  files :                                                             */
+ /*  Divsol.c           QRfact.h           Divsol.h           Jacobi.c   */     
+ /*  Jacobi.h           Triang.c           print.c            MM.c       */   
+ /*  Triang.h           print.h            MM.h               QRfact.c   */   
+ /*  main.c             main.h                                           */
+ /*                                                                      */
+ /*  It calculates the eigenvalues for 4 different matrixes. It does not */
+ /*  take any input; those 4 matrixes are calculated by MakeMatrix       */
+ /*  function. Output is given as 4 files: val2, val3, val4, val5, that  */
+ /*  contains the eigenvalues for each of the matrixes.                  */
+ /*                                                                      */
+ /************************************************************************/
+ #include "main.h"
+ #include "MM.h"
+ 
+ Matrix Trianglelise(Matrix A,int i);
+ void House(Matrix A,Vector v,int col,int sr,int er);
+ double norm(Matrix A,int col,int rs,int re);
+ double xty(Vector x,Vector y,int start,int end);


Index: llvm/test/Programs/MultiSource/McCat-05-eks/main.c
diff -c /dev/null llvm/test/Programs/MultiSource/McCat-05-eks/main.c:1.1
*** /dev/null	Mon May 12 13:56:49 2003
--- llvm/test/Programs/MultiSource/McCat-05-eks/main.c	Mon May 12 13:56:38 2003
***************
*** 0 ****
--- 1,166 ----
+ 
+ /****
+     Copyright (C) 1996 McGill University.
+     Copyright (C) 1996 McCAT System Group.
+     Copyright (C) 1996 ACAPS Benchmark Administrator
+                        benadmin at acaps.cs.mcgill.ca
+ 
+     This program is free software; you can redistribute it and/or modify
+     it provided this copyright notice is maintained.
+ 
+     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.  
+ ****/
+ 
+ /************************************************************************/
+ /*  author :   Mikkel Damsgaard                                         */
+ /*             Kirsebaerhaven 85b                                        */
+ /*                                                                      */
+ /*             DK-8520 Lystrup                                          */
+ /*             email mikdam at daimi.aau.dk                                */
+ /*                                                                      */
+ /*  files :                                                             */
+ /*  Divsol.c           QRfact.h           Divsol.h           Jacobi.c   */     
+ /*  Jacobi.h           Triang.c           print.c            MM.c       */   
+ /*  Triang.h           print.h            MM.h               QRfact.c   */   
+ /*  main.c             main.h                                           */
+ /*                                                                      */
+ /*  It calculates the eigenvalues for 4 different matrixes. It does not */
+ /*  take any input; those 4 matrixes are calculated by MakeMatrix       */
+ /*  function. Output is given as 4 files: val2, val3, val4, val5, that  */
+ /*  contains the eigenvalues for each of the matrixes.                  */
+ /*                                                                      */
+ /************************************************************************/
+ #include "main.h"
+ #include "QRfact.h"
+ #include "Triang.h"
+ #include "Jacobi.h"
+ #include <stdio.h>
+ #include <string.h>
+ Matrix A,Q,U;
+ 
+ int comp(const double *a,const double *b)
+ {
+   if (fabs(*a)<fabs(*b)) return 1;
+   else if (fabs(*a)>fabs(*b)) return -1;
+   else return 0;
+ }
+ 
+ main ()
+ {
+   double a,b,c,d;
+   int i,j,k,l,m;
+   Vector v,u,z,w;
+   Matrix V,T,X,Z;
+   FILE *vec;
+   char filename[20],num[3];
+ 
+   for (l=2;l<=5;l++) 
+     {
+       strcpy(filename,"val");
+       sprintf(num,"%i\0",l);
+       strcat(filename,num);
+       /* printf("filename = %s\n",filename); */
+ 
+       A = MakeMatrix(l);
+       /*      if (l==5) printf("%e\n",A[0][5]); */
+ 
+ 
+       /* Bauer-Fike */
+       /*      printf("%i : Norm af E = %e\n",l,2*A[0][l]); */
+ 
+       /*      U = Trianglelise(A,l); */
+       U = Jacobi(A,l); 
+       QRiterate(A,U); 
+ 
+       v = newVector();
+       for (i=0;i<n;i++)
+ 	v[i] = A[i][i];
+       
+       qsort(v,n,sizeof(double),(int (*)(const void*,const void*))comp);
+       
+       for (i=0;i<n;i++)
+ 	fprintf(stdout,"%i %e\n",i,v[i]);
+ 
+       /*      printf("sigma1 = %e, sigman = %e, k2 = %e\n",
+ 	      v[0],v[n-1],v[0]/v[n-1]); */
+ 
+       /*      printf("Kondition af U: %e\n",NormOne(U)*NormInf(U)); */
+ 
+       
+       /*      Check(A,U,l);      */
+       
+       if (l==6)
+ 	{ /* Get the egenvector for the 2 largest and 
+ 	     the 2 smallest egenvalues */
+ 	  
+ 	  for (i=0;i<n;i++)
+ 	    {
+ /*	      j = (i>=2)?n-i+1:i; */
+ 
+ 	      k=0;
+ 	      while (v[i]!=A[k][k]) k++;
+ 
+ 	      strcpy(filename,"vec");
+ 	      sprintf(num,"%i\0",i);
+ 	      strcat(filename,num);
+ 	      printf("filename = %s\n",filename);
+ 	      
+ 	      for (m=0;m<n;m++)
+ 		fprintf(stdout,"%i %e\n",m,U[m][k]);
+ 	    }
+ 
+ 	}
+ 
+       freeMatrix(U);
+       freeMatrix(A);
+     }
+ }
+ 
+ void Check(Matrix A, Matrix U, int l)
+ {  /* TEST SUITE */
+ 
+   Matrix X,T;
+   double a;
+   int i,j;
+ 
+   X = newMatrix();
+   T = MakeMatrix(l);
+   
+ 
+   /* Beregn U^TXU */
+   matrixMult(X,T,U); 
+   
+   matrixTranspose(U);
+   
+   matrixMult(T,U,X); 
+ 
+   matrixTranspose(U);
+   a = 0.0;
+   for (i=0;i<n;i++)
+     for (j=0;j<n;j++)
+       a += (A[i][j]-T[i][j])*(A[i][j]-T[i][j]);
+   
+   printf("Step: %i !! The frobenius norm of X-T is %e\n",l,sqrt(a));
+   
+   a = 0.0;
+   for (i=0;i<n;i++)
+     for (j=i+1;j<n;j++)
+       a += fabs(A[i][j]-A[j][i]);
+   
+   printf("Is A symmetric? %e\n",a);
+ 
+   /*
+      printMatrix(A);
+      
+      printMatrix(T);
+      
+      printMatrix(U); */
+ 
+ 
+   printf("\n\n");
+   freeMatrix(X);
+   freeMatrix(T);
+ }
+ 


Index: llvm/test/Programs/MultiSource/McCat-05-eks/main.h
diff -c /dev/null llvm/test/Programs/MultiSource/McCat-05-eks/main.h:1.1
*** /dev/null	Mon May 12 13:56:49 2003
--- llvm/test/Programs/MultiSource/McCat-05-eks/main.h	Mon May 12 13:56:38 2003
***************
*** 0 ****
--- 1,36 ----
+ /************************************************************************/
+ /*  author :   Mikkel Damsgaard                                         */
+ /*             Kirsebaerhaven 85b                                        */
+ /*                                                                      */
+ /*             DK-8520 Lystrup                                          */
+ /*             email mikdam at daimi.aau.dk                                */
+ /*                                                                      */
+ /*  files :                                                             */
+ /*  Divsol.c           QRfact.h           Divsol.h           Jacobi.c   */     
+ /*  Jacobi.h           Triang.c           print.c            MM.c       */   
+ /*  Triang.h           print.h            MM.h               QRfact.c   */   
+ /*  main.c             main.h                                           */
+ /*                                                                      */
+ /*  It calculates the eigenvalues for 4 different matrixes. It does not */
+ /*  take any input; those 4 matrixes are calculated by MakeMatrix       */
+ /*  function. Output is given as 4 files: val2, val3, val4, val5, that  */
+ /*  contains the eigenvalues for each of the matrixes.                  */
+ /*                                                                      */
+ /************************************************************************/
+ #ifndef MAIN__H__
+ #define MAIN__H__
+ 
+ #include <math.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ 
+ typedef double **Matrix;
+ typedef double *Vector;
+ 
+ #define n 51
+ #define epsilon 1.0e-10
+ 
+ void Check(Matrix A,Matrix U,int l);
+ 
+ #endif
+ 


Index: llvm/test/Programs/MultiSource/McCat-05-eks/print.c
diff -c /dev/null llvm/test/Programs/MultiSource/McCat-05-eks/print.c:1.1
*** /dev/null	Mon May 12 13:56:49 2003
--- llvm/test/Programs/MultiSource/McCat-05-eks/print.c	Mon May 12 13:56:39 2003
***************
*** 0 ****
--- 1,54 ----
+ 
+ /****
+     Copyright (C) 1996 McGill University.
+     Copyright (C) 1996 McCAT System Group.
+     Copyright (C) 1996 ACAPS Benchmark Administrator
+                        benadmin at acaps.cs.mcgill.ca
+ 
+     This program is free software; you can redistribute it and/or modify
+     it provided this copyright notice is maintained.
+ 
+     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.  
+ ****/
+ 
+ /************************************************************************/
+ /*  author :   Mikkel Damsgaard                                         */
+ /*             Kirsebaerhaven 85b                                        */
+ /*                                                                      */
+ /*             DK-8520 Lystrup                                          */
+ /*             email mikdam at daimi.aau.dk                                */
+ /*                                                                      */
+ /*  files :                                                             */
+ /*  Divsol.c           QRfact.h           Divsol.h           Jacobi.c   */     
+ /*  Jacobi.h           Triang.c           print.c            MM.c       */   
+ /*  Triang.h           print.h            MM.h               QRfact.c   */   
+ /*  main.c             main.h                                           */
+ /*                                                                      */
+ /*  It calculates the eigenvalues for 4 different matrixes. It does not */
+ /*  take any input; those 4 matrixes are calculated by MakeMatrix       */
+ /*  function. Output is given as 4 files: val2, val3, val4, val5, that  */
+ /*  contains the eigenvalues for each of the matrixes.                  */
+ /*                                                                      */
+ /************************************************************************/
+ #include "print.h"
+ 
+ void printMatrix(Matrix A)
+ {
+   int i;
+ 
+   for (i=0;i<n;i++)
+     printVector(A[i]);
+   printf("\n");
+ }
+ 
+ void printVector(Vector v)
+ {
+   int i;
+ 
+   for (i=0;i<n;i++)
+     printf("%f ",v[i]);
+   printf("\n");
+ }
+      


Index: llvm/test/Programs/MultiSource/McCat-05-eks/print.h
diff -c /dev/null llvm/test/Programs/MultiSource/McCat-05-eks/print.h:1.1
*** /dev/null	Mon May 12 13:56:49 2003
--- llvm/test/Programs/MultiSource/McCat-05-eks/print.h	Mon May 12 13:56:39 2003
***************
*** 0 ****
--- 1,23 ----
+ /************************************************************************/
+ /*  author :   Mikkel Damsgaard                                         */
+ /*             Kirsebaerhaven 85b                                        */
+ /*                                                                      */
+ /*             DK-8520 Lystrup                                          */
+ /*             email mikdam at daimi.aau.dk                                */
+ /*                                                                      */
+ /*  files :                                                             */
+ /*  Divsol.c           QRfact.h           Divsol.h           Jacobi.c   */     
+ /*  Jacobi.h           Triang.c           print.c            MM.c       */   
+ /*  Triang.h           print.h            MM.h               QRfact.c   */   
+ /*  main.c             main.h                                           */
+ /*                                                                      */
+ /*  It calculates the eigenvalues for 4 different matrixes. It does not */
+ /*  take any input; those 4 matrixes are calculated by MakeMatrix       */
+ /*  function. Output is given as 4 files: val2, val3, val4, val5, that  */
+ /*  contains the eigenvalues for each of the matrixes.                  */
+ /*                                                                      */
+ /************************************************************************/
+ #include "main.h"
+ 
+ void printMatrix(Matrix A);
+ void printVector(Vector v);


Index: llvm/test/Programs/MultiSource/McCat-05-eks/val2
diff -c /dev/null llvm/test/Programs/MultiSource/McCat-05-eks/val2:1.1
*** /dev/null	Mon May 12 13:56:49 2003
--- llvm/test/Programs/MultiSource/McCat-05-eks/val2	Mon May 12 13:56:39 2003
***************
*** 0 ****
--- 1,51 ----
+ 0 9.580243e-01
+ 1 9.517176e-01
+ 2 9.412778e-01
+ 3 9.268108e-01
+ 4 9.084633e-01
+ 5 8.864201e-01
+ 6 8.609027e-01
+ 7 8.321655e-01
+ 8 8.004931e-01
+ 9 7.661966e-01
+ 10 7.296093e-01
+ 11 6.910828e-01
+ 12 6.509824e-01
+ 13 6.096823e-01
+ 14 5.675614e-01
+ 15 5.249981e-01
+ 16 4.823660e-01
+ 17 4.400293e-01
+ 18 3.983382e-01
+ 19 3.576252e-01
+ 20 3.182009e-01
+ 21 2.803509e-01
+ 22 2.443326e-01
+ 23 2.103726e-01
+ 24 1.786647e-01
+ 25 1.493689e-01
+ 26 1.226104e-01
+ 27 9.848053e-02
+ 28 7.704041e-02
+ 29 5.833256e-02
+ 30 4.243741e-02
+ 31 3.268072e-02
+ 32 3.171015e-02
+ 33 2.951476e-02
+ 34 2.933076e-02
+ 35 2.580808e-02
+ 36 2.351502e-02
+ 37 1.895448e-02
+ 38 1.824137e-02
+ 39 1.352809e-02
+ 40 1.157669e-02
+ 41 -8.958077e-03
+ 42 -8.887390e-03
+ 43 6.970729e-03
+ 44 -6.946105e-03
+ 45 -6.682745e-03
+ 46 6.179114e-03
+ 47 -3.640190e-03
+ 48 -3.195620e-03
+ 49 1.221192e-03
+ 50 9.852583e-04


Index: llvm/test/Programs/MultiSource/McCat-05-eks/val3
diff -c /dev/null llvm/test/Programs/MultiSource/McCat-05-eks/val3:1.1
*** /dev/null	Mon May 12 13:56:49 2003
--- llvm/test/Programs/MultiSource/McCat-05-eks/val3	Mon May 12 13:56:39 2003
***************
*** 0 ****
--- 1,51 ----
+ 0 9.932949e-01
+ 1 9.853247e-01
+ 2 9.721723e-01
+ 3 9.540314e-01
+ 4 9.311676e-01
+ 5 9.039119e-01
+ 6 8.726543e-01
+ 7 8.378348e-01
+ 8 7.999344e-01
+ 9 7.594650e-01
+ 10 7.169590e-01
+ 11 6.729582e-01
+ 12 6.280035e-01
+ 13 5.826245e-01
+ 14 5.373296e-01
+ 15 4.925975e-01
+ 16 4.488688e-01
+ 17 4.065396e-01
+ 18 3.659563e-01
+ 19 3.274112e-01
+ 20 2.911404e-01
+ 21 2.573226e-01
+ 22 2.260796e-01
+ 23 1.974779e-01
+ 24 1.715321e-01
+ 25 1.482087e-01
+ 26 1.274313e-01
+ 27 1.090864e-01
+ 28 9.302968e-02
+ 29 7.909270e-02
+ 30 6.708956e-02
+ 31 5.682348e-02
+ 32 4.809316e-02
+ 33 4.069851e-02
+ 34 3.444590e-02
+ 35 2.915270e-02
+ 36 2.465108e-02
+ 37 2.079119e-02
+ 38 1.744349e-02
+ 39 1.450039e-02
+ 40 1.187688e-02
+ 41 9.510226e-03
+ 42 7.358501e-03
+ 43 5.398253e-03
+ 44 3.621430e-03
+ 45 -2.570521e-03
+ 46 -2.153582e-03
+ 47 2.031918e-03
+ 48 -1.469057e-03
+ 49 6.419646e-04
+ 50 -5.313006e-04


Index: llvm/test/Programs/MultiSource/McCat-05-eks/val4
diff -c /dev/null llvm/test/Programs/MultiSource/McCat-05-eks/val4:1.1
*** /dev/null	Mon May 12 13:56:49 2003
--- llvm/test/Programs/MultiSource/McCat-05-eks/val4	Mon May 12 13:56:39 2003
***************
*** 0 ****
--- 1,51 ----
+ 0 9.970055e-01
+ 1 9.887294e-01
+ 2 9.750865e-01
+ 3 9.562986e-01
+ 4 9.326678e-01
+ 5 9.045689e-01
+ 6 8.724397e-01
+ 7 8.367695e-01
+ 8 7.980876e-01
+ 9 7.569499e-01
+ 10 7.139262e-01
+ 11 6.695871e-01
+ 12 6.244921e-01
+ 13 5.791779e-01
+ 14 5.341482e-01
+ 15 4.898656e-01
+ 16 4.467441e-01
+ 17 4.051443e-01
+ 18 3.653701e-01
+ 19 3.276668e-01
+ 20 2.922219e-01
+ 21 2.591665e-01
+ 22 2.285783e-01
+ 23 2.004864e-01
+ 24 1.748760e-01
+ 25 1.516943e-01
+ 26 1.308568e-01
+ 27 1.122534e-01
+ 28 9.575437e-02
+ 29 8.121654e-02
+ 30 6.848827e-02
+ 31 5.741427e-02
+ 32 4.783966e-02
+ 33 3.961321e-02
+ 34 3.258995e-02
+ 35 2.663305e-02
+ 36 2.161501e-02
+ 37 1.741841e-02
+ 38 1.393607e-02
+ 39 1.107095e-02
+ 40 8.735747e-03
+ 41 6.852304e-03
+ 42 5.351017e-03
+ 43 4.170180e-03
+ 44 3.255409e-03
+ 45 2.559159e-03
+ 46 2.040357e-03
+ 47 1.664160e-03
+ 48 1.401852e-03
+ 49 1.230858e-03
+ 50 1.134861e-03


Index: llvm/test/Programs/MultiSource/McCat-05-eks/val5
diff -c /dev/null llvm/test/Programs/MultiSource/McCat-05-eks/val5:1.1
*** /dev/null	Mon May 12 13:56:49 2003
--- llvm/test/Programs/MultiSource/McCat-05-eks/val5	Mon May 12 13:56:39 2003
***************
*** 0 ****
--- 1,51 ----
+ 0 9.972107e-01
+ 1 9.889085e-01
+ 2 9.752248e-01
+ 3 9.563847e-01
+ 4 9.326952e-01
+ 5 9.045362e-01
+ 6 8.723506e-01
+ 7 8.366328e-01
+ 8 7.979161e-01
+ 9 7.567594e-01
+ 10 7.137342e-01
+ 11 6.694111e-01
+ 12 6.243480e-01
+ 13 5.790786e-01
+ 14 5.341027e-01
+ 15 4.898778e-01
+ 16 4.468129e-01
+ 17 4.052634e-01
+ 18 3.655287e-01
+ 19 3.278507e-01
+ 20 2.924144e-01
+ 21 2.593503e-01
+ 22 2.287370e-01
+ 23 2.006057e-01
+ 24 1.749451e-01
+ 25 1.517071e-01
+ 26 1.308122e-01
+ 27 1.121554e-01
+ 28 9.561191e-02
+ 29 8.104247e-02
+ 30 6.829833e-02
+ 31 5.722570e-02
+ 32 4.766957e-02
+ 33 3.947710e-02
+ 34 3.250027e-02
+ 35 2.659804e-02
+ 36 2.163796e-02
+ 37 1.749728e-02
+ 38 1.406368e-02
+ 39 1.123556e-02
+ 40 8.922053e-03
+ 41 7.042840e-03
+ 42 5.527696e-03
+ 43 4.315946e-03
+ 44 3.355820e-03
+ 45 2.603765e-03
+ 46 2.023740e-03
+ 47 1.586555e-03
+ 48 1.269245e-03
+ 49 1.054541e-03
+ 50 9.304308e-04





More information about the llvm-commits mailing list