summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gmail.com>2008-11-17 04:42:22 +0000
committerMatt Turner <mattst88@gmail.com>2008-11-17 04:42:22 +0000
commita7d42b99065f359a89bff6052a6c4578bf848310 (patch)
treee94294a5c5c223886f9aa5ab9a18125bfc0c1b9c
parente552489427e4d950c182a3a0221896ae65529a85 (diff)
Remove useless variable and function argument
git-svn-id: svn://mattst88.com/svn/cleanbench/trunk@76 0d43b9a7-5ab2-4d7b-af9d-f64450cef757
-rw-r--r--linear.c36
1 files changed, 8 insertions, 28 deletions
diff --git a/linear.c b/linear.c
index 4495f51..f7aeecc 100644
--- a/linear.c
+++ b/linear.c
@@ -48,7 +48,7 @@ static clock_t DoLUIteration(double *a, double *b,
double *abase, double *bbase,
unsigned long num_arrays);
static void build_problem( double a[][LUARRAYCOLS],
- int n, double b[LUARRAYROWS]);
+ double b[LUARRAYROWS]);
static int ludcmp(double a[][LUARRAYCOLS],
int n, int indx[], int *d);
static void lubksb(double a[][LUARRAYCOLS],
@@ -73,7 +73,6 @@ DoLU(void)
double* abase = NULL;
double* bbase = NULL;
LUdblptr ptra;
- int n;
static int num_arrays = 0;
static bool is_adjusted = false;
@@ -85,7 +84,6 @@ DoLU(void)
*/
a = malloc(sizeof(double) * LUARRAYCOLS * LUARRAYROWS);
b = malloc(sizeof(double) * LUARRAYROWS);
- n=LUARRAYROWS;
/*
** We need to allocate a temp vector that is used by the LU
@@ -98,7 +96,7 @@ DoLU(void)
** Build a problem to be solved.
*/
ptra.ptrs.p=a; /* Gotta coerce linear array to 2D array */
- build_problem(*ptra.ptrs.ap,n,b);
+ build_problem(*ptra.ptrs.ap, b);
/*
** Now that we have a problem built, see if we need to do
@@ -238,7 +236,6 @@ for(i=0;i<num_arrays;i++)
** row to another.
*/
static void build_problem(double a[][LUARRAYCOLS],
- int n,
double b[LUARRAYROWS])
{
long i,j,k,k1; /* Indexes */
@@ -255,10 +252,10 @@ randnum((int32_t)13);
** We'll also use this as a chance to load the solution
** vector.
*/
-for(i=0;i<n;i++)
+for(i = 0; i < LUARRAYROWS; i++)
{ /* b[i]=(double)(abs_randwc(100L)+1L); */
b[i]=(double)(abs_randwc((int32_t)100)+(int32_t)1);
- for(j=0;j<n;j++)
+ for(j = 0; j < LUARRAYROWS; j++)
if(i==j)
/* a[i][j]=(double)(abs_randwc(1000L)+1L); */
a[i][j]=(double)(abs_randwc((int32_t)1000)+(int32_t)1);
@@ -266,27 +263,12 @@ for(i=0;i<n;i++)
a[i][j]=(double)0.0;
}
-#ifdef DEBUG
-printf("Problem:\n");
-for(i=0;i<n;i++)
-{
-/*
- for(j=0;j<n;j++)
- printf("%6.2f ",a[i][j]);
-*/
- printf("%.0f/%.0f=%.2f\t",b[i],a[i][i],b[i]/a[i][i]);
-/*
- printf("\n");
-*/
-}
-#endif
-
/*
** Scramble. Do this 8n times. See comment above for
** a description of the scrambling process.
*/
-for(i=0;i<8*n;i++)
+for(i = 0; i < 8 * LUARRAYROWS; i++)
{
/*
** Pick a row and a random constant. Multiply
@@ -305,19 +287,17 @@ for(i=0;i<8*n;i++)
*/
/* k=abs_randwc((long)n); */
/* k1=abs_randwc((long)n); */
- k=abs_randwc((int32_t)n);
- k1=abs_randwc((int32_t)n);
+ k=abs_randwc((int32_t)LUARRAYROWS);
+ k1=abs_randwc((int32_t)LUARRAYROWS);
if(k!=k1)
{
if(k<k1) rcon=(double)1.0;
else rcon=(double)-1.0;
- for(j=0;j<n;j++)
+ for(j = 0; j < LUARRAYROWS; j++)
a[k][j]+=a[k1][j]*rcon;;
b[k]+=b[k1]*rcon;
}
}
-
-return;
}