Commit 34b5619c authored by Mathieu Faverge's avatar Mathieu Faverge

Fix missing curly braces

parent 95d37516
......@@ -202,14 +202,17 @@ hqr_geti( const libhqr_tree_t *qrtree, int k, int m )
int end2 = p + ( domino ? k*p : k + nbextra1 );
/* Tile of type 2 or 3 or the 1 between the diagonal and the multiple after the diagonal */
if ( lm < end2 )
if ( lm < end2 ) {
return lm-k;
}
/* Tile of type 1 */
else {
if ( domino )
if ( domino ) {
pos1 = ( ( (p * (k+1)) + pa - 1 ) / pa ) * pa;
else
}
else {
pos1 = ( ( (p + k ) + pa - 1 ) / pa ) * pa;
}
j = lm - pos1;
return nb23 + (j / pa) * p + j%pa;
}
......
......@@ -116,8 +116,9 @@ libhqr_print_next_k( const libhqr_tree_t *qrtree, int k )
printf("\n------------ Next (k = %d)--------------\n", k);
printf( " " );
for(s=qrtree->mt; s>0; s--)
for(s=qrtree->mt; s>0; s--) {
printf( "%3d ", s );
}
printf( "\n" );
for(m=0; m<qrtree->mt; m++) {
......@@ -143,8 +144,9 @@ libhqr_print_prev_k( const libhqr_tree_t *qrtree, int k )
printf("\n------------ Prev (k = %d)--------------\n", k);
printf( " " );
for(s=qrtree->mt; s>-1; s--)
for(s=qrtree->mt; s>-1; s--) {
printf( "%3d ", s );
}
printf( "\n" );
for(m=0; m<qrtree->mt; m++) {
......
......@@ -21,46 +21,48 @@
libhqr_queue_tile_t *
libhqr_queue_tile_new(void)
{
return NULL;
return NULL;
}
void
libhqr_queue_tile_push( libhqr_queue_tile_t **queue_tile, int numero )
{
if (queue_tile != NULL)
{
libhqr_queue_tile_t *p_l = NULL;
libhqr_queue_tile_t *p_p = NULL;
if (queue_tile != NULL)
{
libhqr_queue_tile_t *p_l = NULL;
libhqr_queue_tile_t *p_p = NULL;
assert( (*queue_tile) == NULL || (*queue_tile)->prev == NULL );
p_l = *queue_tile;
p_p = malloc (sizeof (*p_p));
if (p_p != NULL)
{
p_p->numero = numero;
p_p->next = p_l;
p_p->prev = NULL;
if (p_l != NULL)
p_l->prev = p_p;
*queue_tile = p_p;
}
else
{
fprintf (stderr, "Memoire insuffisante\n");
exit (EXIT_FAILURE);
}
}
return;
assert( (*queue_tile) == NULL || (*queue_tile)->prev == NULL );
p_l = *queue_tile;
p_p = malloc (sizeof (*p_p));
if (p_p != NULL)
{
p_p->numero = numero;
p_p->next = p_l;
p_p->prev = NULL;
if (p_l != NULL) {
p_l->prev = p_p;
}
*queue_tile = p_p;
}
else
{
fprintf (stderr, "Memoire insuffisante\n");
exit (EXIT_FAILURE);
}
}
return;
}
int
libhqr_queue_tile_head( libhqr_queue_tile_t **queue_tile )
{
if (queue_tile != NULL && *queue_tile != NULL)
{
return (*queue_tile)->numero;
}
return -1;
if ( ( queue_tile != NULL) &&
(*queue_tile != NULL) )
{
return (*queue_tile)->numero;
}
return -1;
}
int
......@@ -74,8 +76,9 @@ libhqr_queue_tile_pop ( libhqr_queue_tile_t **queue_tile )
p_l = *queue_tile;
p_p = p_l->next;
if (p_p != NULL)
if (p_p != NULL) {
p_p->prev = NULL;
}
ret = p_l->numero;
free (p_l);
*queue_tile = p_p;
......
......@@ -149,8 +149,9 @@ svd_getm( const libhqr_tree_t *qrtree,
int nb23 = p + nbextra1;
/* Tile of type 2 or 3 or the 1 between the diagonal and the multiple after the diagonal */
if ( i < nb23 )
if ( i < nb23 ) {
return k+i;
}
/* Tile of type 1 */
else {
j = i - nb23;
......@@ -180,8 +181,9 @@ svd_geti( const libhqr_tree_t *qrtree,
int end2 = p + k + nbextra1;
/* Tile of type 2 or 3 or the 1 between the diagonal and the multiple after the diagonal */
if ( m < end2 )
if ( m < end2 ) {
return m-k;
}
/* Tile of type 1 */
else {
pos1 = ( ( (p + k ) + pa - 1 ) / pa ) * pa;
......@@ -214,10 +216,12 @@ svd_gettype( const libhqr_tree_t *qrtree,
}
/* Lower triangle of the matrix */
else {
if( (m / p) % a == 0 )
if( (m / p) % a == 0 ) {
return 1;
else
}
else {
return 0;
}
}
}
......
......@@ -54,15 +54,17 @@ systolic_gettype( const libhqr_tree_t *qrtree, int k, int m ) {
int pq = p * q;
/* Local eliminations with a TS kernel */
if ( m >= k + pq )
if ( m >= k + pq ) {
return 0;
}
/* Element to be reduce with a single pivot */
else if ( m >= k+p )
else if ( m >= k+p ) {
return 1;
}
/* Element to be reduced with sq_p pivot */
else return 3;
else {
return 3;
}
}
......@@ -230,15 +232,16 @@ systolic_prevpiv(const libhqr_tree_t *qrtree, int k, int pivot, int start)
rpivot = pivot % pq; /* Staring index in this distribution */
myassert( start >= pivot && pivot >= k && start < mt );
myassert( start == pivot || pivot == systolic_currpiv( qrtree, k, start ) );
myassert( (start >= pivot) && (pivot >= k) && (start < mt) );
myassert( (start == pivot) || (pivot == systolic_currpiv( qrtree, k, start )) );
/* TS level common to every case */
ls = systolic_gettype( qrtree, k, start );
lp = systolic_gettype( qrtree, k, pivot );
if ( lp == LIBHQR_KILLED_BY_TS )
if ( lp == LIBHQR_KILLED_BY_TS ) {
return mt;
}
myassert( lp >= ls );
switch( ls )
......@@ -249,7 +252,7 @@ systolic_prevpiv(const libhqr_tree_t *qrtree, int k, int pivot, int start)
if ( start == pivot ) {
nextp = start + p-1;
while( pivot < nextp && nextp >= mt ) {
while( (pivot < nextp) && (nextp >= mt) ) {
nextp--;
}
} else {
......
......@@ -89,8 +89,11 @@ main(int argc, char ** argv)
for( tsrr=0; tsrr<2; tsrr++) {
/* Useless case */
if (tsrr==1 && a==1)
if ((tsrr == 1) &&
(a == 1))
{
continue;
}
libhqr_init_hqr( &qrtree, LIBHQR_QR, &matrix,
llvl, hlvl, qr_a, qr_p, domino, tsrr );
......@@ -118,8 +121,9 @@ main(int argc, char ** argv)
* Tests w/ high level trees
*/
for( domino=0; domino<2; domino++) { /* Domino */
if ((domino == 1) && (llvl == LIBHQR_GREEDY1P_TREE))
if ((domino == 1) && (llvl == LIBHQR_GREEDY1P_TREE)) {
continue;
}
/* High level tree */
for( h=0; h<nb_hlvl; h++) {
......@@ -151,8 +155,11 @@ main(int argc, char ** argv)
for( tsrr=0; tsrr<2; tsrr++) {
/* Useless case */
if (tsrr==1 && a==1)
if ((tsrr == 1) &&
(a == 1))
{
continue;
}
libhqr_init_hqr( &qrtree, LIBHQR_QR, &matrix,
llvl, hlvl, qr_a, qr_p, domino, tsrr );
......
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