Commit cbc1f643 authored by Mathieu Faverge's avatar Mathieu Faverge

Reduce scope of variables

parent 518b651a
......@@ -42,11 +42,8 @@ int
libhqr_check_nbgeqrf( const libhqr_tree_t *qrtree )
{
int check = 1;
int k, nb, m, m0;
int k, m;
int checkTS = (qrtree->facto == LIBHQR_TSQR) || (qrtree->facto == LIBHQR_TSLQ);
int a = qrtree->a;
int p = qrtree->p;
#if defined(DEBUG_WITH_PRINT)
libhqr_print_type( qrtree );
......@@ -54,8 +51,8 @@ libhqr_check_nbgeqrf( const libhqr_tree_t *qrtree )
#endif
for (k=0; k<qrtree->nt; k++) {
nb = 0;
m0 = checkTS ? 0 : k;
int nb = 0;
int m0 = checkTS ? 0 : k;
for (m=m0; m < qrtree->mt; m++) {
if ( qrtree->gettype( qrtree, k, m ) > 0 ) {
nb++;
......@@ -68,7 +65,7 @@ libhqr_check_nbgeqrf( const libhqr_tree_t *qrtree )
" - a = %d, p = %d, M = %d, N = %d\n"
" Check number of geqrt:\n"
" For k=%d => return %d instead of %d",
a, p, qrtree->mt, qrtree->nt, k, qrtree->getnbgeqrf( qrtree, k ), nb );
qrtree->a, qrtree->p, qrtree->mt, qrtree->nt, k, qrtree->getnbgeqrf( qrtree, k ), nb );
}
}
......@@ -87,17 +84,13 @@ libhqr_check_nbgeqrf( const libhqr_tree_t *qrtree )
int
libhqr_check_geti_getm( const libhqr_tree_t *qrtree )
{
int prevm = -1;
int check = 1;
int k, nb, i, m;
int k, i, m;
int checkTS = (qrtree->facto == LIBHQR_TSQR) || (qrtree->facto == LIBHQR_TSLQ);
int a = qrtree->a;
int p = qrtree->p;
for (k=0; k<qrtree->nt; k++) {
nb = qrtree->getnbgeqrf( qrtree, k );
prevm = -1;
int nb = qrtree->getnbgeqrf( qrtree, k );
int prevm = -1;
for (i=0; i < nb; i++) {
m = qrtree->getm( qrtree, k, i );
......@@ -111,20 +104,20 @@ libhqr_check_geti_getm( const libhqr_tree_t *qrtree )
" - a = %d, p = %d, M = %d, N = %d\n"
" Check indices of geqrt:\n"
" getm( k=%d, i=%d ) => m = %d && geti( k=%d, m=%d ) => i = %d\n",
a, p, qrtree->mt, qrtree->nt,
qrtree->a, qrtree->p, qrtree->mt, qrtree->nt,
k, i, m, k, m, qrtree->geti( qrtree, k, m));
}
/*
* Tiles before the diagonal are factorized and
* the m is a growing list (not true with round-robin inside TS)
*/
else if ( !checkTS && (a == 1) && (( m < k ) || ( m < prevm )) ) {
else if ( !checkTS && (qrtree->a == 1) && (( m < k ) || ( m < prevm )) ) {
check = 0;
printf(" ----------------------------------------------------\n"
" - a = %d, p = %d, M = %d, N = %d\n"
" Check indices of geqrt:\n"
" getm( k=%d, i=%d ) => m = %d",
a, p, qrtree->mt, qrtree->nt, k, i, m);
qrtree->a, qrtree->p, qrtree->mt, qrtree->nt, k, i, m);
}
prevm = m;
}
......@@ -145,16 +138,14 @@ libhqr_check_geti_getm( const libhqr_tree_t *qrtree )
int
libhqr_check_next_exit( const libhqr_tree_t *qrtree )
{
int k, m, m0, s, nb;
int k, m, s;
int check = 1;
int checkTS = (qrtree->facto == LIBHQR_TSQR) || (qrtree->facto == LIBHQR_TSLQ);
int a = qrtree->a;
int p = qrtree->p;
for (k=0; k<qrtree->nt; k++) {
m0 = checkTS ? 0 : k;
int m0 = checkTS ? 0 : k;
for(m=m0; m<qrtree->mt; m++) {
nb = 0;
int nb = 0;
for(s=qrtree->mt; s>=m0; s--) {
if ( qrtree->nextpiv(qrtree, k, m, s) == qrtree->mt ) {
nb++;
......@@ -167,7 +158,7 @@ libhqr_check_next_exit( const libhqr_tree_t *qrtree )
printf(" ----------------------------------------------------\n"
" - a = %d, p = %d, M = %d, N = %d\n"
" Next of line %d for step %d contains more than one exit:\n",
a, p, qrtree->mt, qrtree->nt,
qrtree->a, qrtree->p, qrtree->mt, qrtree->nt,
m, k);
check = 0;
}
......@@ -178,7 +169,7 @@ libhqr_check_next_exit( const libhqr_tree_t *qrtree )
printf(" ----------------------------------------------------\n"
" - a = %d, p = %d, M = %d, N = %d\n"
" Next of line %d for step %d needs one exit:\n",
a, p, qrtree->mt, qrtree->nt,
qrtree->a, qrtree->p, qrtree->mt, qrtree->nt,
m, k);
check = 0;
}
......@@ -199,17 +190,15 @@ libhqr_check_next_exit( const libhqr_tree_t *qrtree )
int
libhqr_check_prev_exit( const libhqr_tree_t *qrtree )
{
int k, m, m0, s, nb;
int k, m, s;
int check = 1;
int checkTS = (qrtree->facto == LIBHQR_TSQR) || (qrtree->facto == LIBHQR_TSLQ);
int a = qrtree->a;
int p = qrtree->p;
for (k=0; k<qrtree->nt; k++) {
m0 = checkTS ? 0 : k;
int m0 = checkTS ? 0 : k;
for(m=m0; m<qrtree->mt; m++) {
nb = 0;
int nb = 0;
for(s=m0; s<qrtree->mt; s++) {
if ( qrtree->prevpiv(qrtree, k, m, s) == qrtree->mt ) {
nb++;
......@@ -222,7 +211,7 @@ libhqr_check_prev_exit( const libhqr_tree_t *qrtree )
printf(" ----------------------------------------------------\n"
" - a = %d, p = %d, M = %d, N = %d\n"
" Prev of line %d for step %d contains more than one exit:\n",
a, p, qrtree->mt, qrtree->nt,
qrtree->a, qrtree->p, qrtree->mt, qrtree->nt,
m, k);
check = 0;
}
......@@ -233,7 +222,7 @@ libhqr_check_prev_exit( const libhqr_tree_t *qrtree )
printf(" ----------------------------------------------------\n"
" - a = %d, p = %d, M = %d, N = %d\n"
" Prev of line %d for step %d needs one exit:\n",
a, p, qrtree->mt, qrtree->nt,
qrtree->a, qrtree->p, qrtree->mt, qrtree->nt,
m, k);
check = 0;
}
......@@ -253,17 +242,15 @@ libhqr_check_prev_exit( const libhqr_tree_t *qrtree )
int
libhqr_check_prev_next( const libhqr_tree_t *qrtree )
{
int k, m, m0;
int start, next, prev;
int k, m;
int check = 1;
int checkTS = (qrtree->facto == LIBHQR_TSQR) || (qrtree->facto == LIBHQR_TSLQ);
int a = qrtree->a;
int p = qrtree->p;
for (k=0; k<qrtree->nt; k++) {
start = qrtree->mt;
int start = qrtree->mt;
int m0 = checkTS ? 0 : k;
int next, prev;
m0 = checkTS ? 0 : k;
for(m=m0; m<qrtree->mt; m++) {
do {
......@@ -283,7 +270,7 @@ libhqr_check_prev_next( const libhqr_tree_t *qrtree )
" - a = %d, p = %d, M = %d, N = %d\n"
" Check next/prev:\n"
" next( k=%d, m=%d, start=%d ) => %d && prev( k=%d, m=%d, start=%d ) => %d (instead of %d)\n",
a, p, qrtree->mt, qrtree->nt,
qrtree->a, qrtree->p, qrtree->mt, qrtree->nt,
k, m, start, next, k, m, next, prev, start);
check = 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment