From 911b30675bfe85e26cc1021d539323334bfd0db1 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Mon, 19 Jun 2006 11:20:21 +0000 Subject: [PATCH] change array containing indeces from double to int [r7942] --- ir/adt/gaussjordan.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/ir/adt/gaussjordan.c b/ir/adt/gaussjordan.c index 678e43b94..f575a584a 100644 --- a/ir/adt/gaussjordan.c +++ b/ir/adt/gaussjordan.c @@ -45,10 +45,10 @@ int firm_gaussjordansolve(double *A, double *vec, int nsize) { - int i, j, row, col, col2, biggest_r, biggest_c; + int i, j, row, col, col2, biggest_r, biggest_c, t; double big, temp, sum; - double *x = xmalloc(nsize * sizeof(double)); - double *scramvec = xmalloc(nsize * sizeof(double)); + double *scramvec = xmalloc(nsize * sizeof(*scramvec)); + int *x = xmalloc(nsize * sizeof(*x)); #define _A(row,col) A[(row)*nsize + (col)] /* init x[] */ @@ -62,12 +62,12 @@ int firm_gaussjordansolve(double *A, double *vec, int nsize) /* find the largest left in LRH box */ for(row=col;row big) { - biggest_r = row; - biggest_c = col2; - big = temp; /* largest element left */ - } + temp = fabs(_A(row,col2)); + if (temp > big) { + biggest_r = row; + biggest_c = col2; + big = temp; /* largest element left */ + } } } if (big < SMALL) { @@ -91,9 +91,9 @@ int firm_gaussjordansolve(double *A, double *vec, int nsize) _A(i,biggest_c) = temp; } /* swap unknowns */ - temp = x[col]; + t = x[col]; x[col] = x[biggest_c]; - x[biggest_c] = temp; + x[biggest_c] = t; /* partially annihilate this col */ /* zero columns below diag */ @@ -104,13 +104,13 @@ int firm_gaussjordansolve(double *A, double *vec, int nsize) /* annihilates A[][] */ for(i=col;i