Commit fed225b4 authored by Mathieu Faverge's avatar Mathieu Faverge

Silent a bunch of sonarqube warnings

parent 5a8bb0ed
......@@ -285,8 +285,9 @@ static void
drawsvg_lines_stepk( const libhqr_tree_t *qrtree, FILE *file,
int full, int k, int *tiles, int *step )
{
int i, m, p, end;
int i;
int imax = qrtree->mt - 1;
if (!full) {
imax -= k;
}
......@@ -295,10 +296,9 @@ drawsvg_lines_stepk( const libhqr_tree_t *qrtree, FILE *file,
libhqr_walk_stepk( qrtree, k, tiles );
for(i = 0; i < imax; i++){
m = tiles[i];
p = qrtree->currpiv(qrtree, k, m);
end = libhqr_imax( step[p], step[m] ) + 1;
int m = tiles[i];
int p = qrtree->currpiv(qrtree, k, m);
int end = libhqr_imax( step[p], step[m] ) + 1;
/* Draw horizontal lines for rows p and m */
drawsvg_lines_rowm( file, k, p, m, step[p], step[m], end );
......
......@@ -73,7 +73,7 @@ hqr_high_binary_prevpiv(const hqr_subpiv_t *arg, int k, int p, int start)
myassert( start >= p && ( start == p || hqr_high_binary_currpiv( arg, k, start ) == p ) );
if ( (start == p) && ( offset%2 == 0 ) ) {
int i, bit, tmp;
int i, bit;
if ( offset == 0 ) {
bit = (int)( log( (double)( libhqr_imin(arg->p, arg->ldd - k) ) ) / log( 2. ) );
}
......@@ -84,7 +84,7 @@ hqr_high_binary_prevpiv(const hqr_subpiv_t *arg, int k, int p, int start)
}
}
for( i=bit; i>-1; i--){
tmp = offset | (1 << i);
int tmp = offset | (1 << i);
if ( ( offset != tmp ) && ( tmp < arg->p ) && (tmp+k < arg->ldd) ) {
return tmp+k;
}
......
......@@ -156,13 +156,12 @@ hqr_getnbgeqrf( const libhqr_tree_t *qrtree, int k )
static int
hqr_getm( const libhqr_tree_t *qrtree, int k, int i )
{
int a = qrtree->a;
int p = qrtree->p;
int domino = qrtree->domino;
int pos1, j, pa = p * a;
int a = qrtree->a;
int p = qrtree->p;
int domino = qrtree->domino;
int pa = p * a;
int nbextra1 = nbextra1_formula;
int nb23 = p + (domino ? k*(p-1) : nbextra1 );
int nb23 = p + (domino ? k*(p-1) : nbextra1 );
/* Tile of type 2 or 3 or the 1 between the diagonal and the multiple after the diagonal */
if ( i < nb23 ) {
......@@ -170,7 +169,9 @@ hqr_getm( const libhqr_tree_t *qrtree, int k, int i )
}
/* Tile of type 1 */
else {
j = i - nb23;
int j, pos1;
j = i - nb23;
pa = p * a;
if ( domino ) {
pos1 = ( ( (p * (k+1)) + pa - 1 ) / pa ) * pa;
......@@ -196,7 +197,7 @@ hqr_geti( const libhqr_tree_t *qrtree, int k, int m )
int domino = qrtree->domino;
int lm = m;
int pos1, j, pa = p * a;
int pa = p * a;
int nbextra1 = nbextra1_formula;
int nb23 = p + ( domino ? k*(p-1) : nbextra1 );
int end2 = p + ( domino ? k*p : k + nbextra1 );
......@@ -207,6 +208,8 @@ hqr_geti( const libhqr_tree_t *qrtree, int k, int m )
}
/* Tile of type 1 */
else {
int pos1, j;
if ( domino ) {
pos1 = ( ( (p * (k+1)) + pa - 1 ) / pa ) * pa;
}
......@@ -266,7 +269,7 @@ static int
hqr_currpiv(const libhqr_tree_t *qrtree, int k, int m)
{
hqr_args_t *arg = (hqr_args_t*)(qrtree->args);
int tmp, tmpk;
int tmp;
int lm, rank;
int a = qrtree->a;
int p = qrtree->p;
......@@ -306,6 +309,8 @@ hqr_currpiv(const libhqr_tree_t *qrtree, int k, int m)
}
}
else {
int tmpk;
switch( hqr_gettype( qrtree, k, m ) )
{
case 0:
......@@ -956,7 +961,6 @@ int
libhqr_walk_stepk( const libhqr_tree_t *qrtree,
int k, int *tiles )
{
int tsid = -1, ttid = -1;
int p, pivot;
int m = 0;
libhqr_queue_tile_t *tt = libhqr_queue_tile_new();
......@@ -969,6 +973,8 @@ libhqr_walk_stepk( const libhqr_tree_t *qrtree,
while( tt )
{
int tsid, ttid;
/* Stack all elements killed on the way down */
p = qrtree->prevpiv(qrtree, k, pivot, p);
while( p != qrtree->mt ) {
......
......@@ -82,7 +82,7 @@ hqr_low_binary_prevpiv(const hqr_subpiv_t *arg, int k, int p, int start_pa)
hqr_low_binary_currpiv( arg, k, start_pa*arg->a*arg->p ) == p_pa ) );
if ( (start_pa == p_pa) && ( offset%2 == 0 ) ) {
int i, bit, tmp;
int i, bit;
if ((p_pa - k_a) == 0) {
bit = (int)( log( (double)(arg->ldd - k_a) ) / log( 2. ) );
}
......@@ -93,7 +93,7 @@ hqr_low_binary_prevpiv(const hqr_subpiv_t *arg, int k, int p, int start_pa)
}
}
for( i=bit; i>-1; i--){
tmp = offset | (1 << i);
int tmp = offset | (1 << i);
if ( ( offset != tmp ) && ( tmp+k_a < arg->ldd ) ) {
return tmp+k_a;
}
......
......@@ -91,7 +91,7 @@ hqr_low_greedy_init(hqr_subpiv_t *arg, int minMN) {
if ( domino )
{
int j, k, height, start, end, firstk = 0;
int j, k, start, end, firstk = 0;
int *nT, *nZ;
arg->minMN = libhqr_imin( minMN, mt*a );
......@@ -108,8 +108,9 @@ hqr_low_greedy_init(hqr_subpiv_t *arg, int minMN) {
k = 0;
while ( (!( ( nT[minMN-1] == mt - ( (minMN - 1) / a ) ) &&
( nZ[minMN-1]+1 == nT[minMN-1] ) ) )
&& ( firstk < minMN ) ) {
height = (nT[k] - nZ[k]) / 2;
&& ( firstk < minMN ) )
{
int height = (nT[k] - nZ[k]) / 2;
if ( height == 0 ) {
while ( (firstk < minMN) &&
( nT[firstk] == mt - ( firstk / a ) ) &&
......@@ -148,7 +149,7 @@ hqr_low_greedy_init(hqr_subpiv_t *arg, int minMN) {
}
else
{
int j, k, myrank, height, start, end, firstk = 0;
int j, k, myrank, height, start, end;
int *nT2DO = (int*)malloc(minMN*sizeof(int));
int *nT = (int*)malloc(minMN*sizeof(int));
int *nZ = (int*)malloc(minMN*sizeof(int));
......@@ -157,6 +158,7 @@ hqr_low_greedy_init(hqr_subpiv_t *arg, int minMN) {
ipiv = arg->ipiv;
for ( myrank=0; myrank<p; myrank++ ) {
int firstk;
int lminMN = minMN;
memset( nT2DO, 0, minMN*sizeof(int));
......
......@@ -31,7 +31,6 @@ libhqr_print_type( const libhqr_tree_t *qrtree )
{
int minMN = qrtree->nt;
int m, k;
int lm = 0;
int lmg = 0;
int rank = 0;
......@@ -53,12 +52,10 @@ libhqr_print_type( const libhqr_tree_t *qrtree )
for (k=libhqr_imin(minMN, lmg+1); k<minMN; k++) {
printf( " " );
}
lm++;
lmg += qrtree->p;
if ( lmg >= qrtree->mt ) {
rank++;
lmg = rank;
lm = 0;
}
printf("\n");
}
......@@ -74,7 +71,6 @@ libhqr_print_pivot( const libhqr_tree_t *qrtree )
{
int minMN = qrtree->nt;
int m, k;
int lm = 0;
int lmg = 0;
int rank = 0;
printf("\n------------ Current Pivot--------------\n");
......@@ -95,12 +91,10 @@ libhqr_print_pivot( const libhqr_tree_t *qrtree )
for (k=libhqr_imin(minMN, lmg+1); k<minMN; k++) {
printf( " " );
}
lm++;
lmg += qrtree->p;
if ( lmg >= qrtree->mt ) {
rank++;
lmg = rank;
lm = 0;
}
printf("\n");
}
......@@ -170,8 +164,7 @@ libhqr_print_prev_k( const libhqr_tree_t *qrtree, int k )
void
libhqr_print_nbgeqrt( const libhqr_tree_t *qrtree )
{
int minMN = qrtree->nt;
int m, k, nb;
int k, minMN = qrtree->nt;
printf("\n------------ Nb GEQRT per k --------------\n");
printf(" k : ");
......@@ -181,7 +174,7 @@ libhqr_print_nbgeqrt( const libhqr_tree_t *qrtree )
printf( "\n" );
printf(" Compute: ");
for (k=0; k<minMN; k++) {
nb = 0;
int m, nb = 0;
for (m=k; m < qrtree->mt; m++) {
if ( qrtree->gettype(qrtree, k, m) > 0 ) {
nb++;
......@@ -207,14 +200,14 @@ libhqr_print_nbgeqrt( const libhqr_tree_t *qrtree )
void
libhqr_print_geqrt_k( const libhqr_tree_t *qrtree, int k )
{
int i, m, nb;
int i, nb;
printf("\n------------ Liste of geqrt for k = %d --------------\n", k);
printf( " m:");
nb = qrtree->getnbgeqrf( qrtree, k );
for (i=0; i < nb; i++) {
m = qrtree->getm( qrtree, k, i );
int m = qrtree->getm( qrtree, k, i );
if ( i == qrtree->geti( qrtree, k, m) ) {
printf( "%3d ", m );
}
......
......@@ -29,8 +29,8 @@ 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;
libhqr_queue_tile_t *p_l;
libhqr_queue_tile_t *p_p;
assert( (*queue_tile) == NULL || (*queue_tile)->prev == NULL );
p_l = *queue_tile;
......@@ -71,8 +71,8 @@ libhqr_queue_tile_pop ( libhqr_queue_tile_t **queue_tile )
int ret = -1;
if (queue_tile != NULL)
{
libhqr_queue_tile_t *p_l = NULL;
libhqr_queue_tile_t *p_p = NULL;
libhqr_queue_tile_t *p_l;
libhqr_queue_tile_t *p_p;
p_l = *queue_tile;
p_p = p_l->next;
......
......@@ -144,7 +144,7 @@ svd_getm( const libhqr_tree_t *qrtree,
int p = qrtree->p;
int a = svd_geta(arg, k);
int pos1, j, pa = p * a;
int pa = p * a;
int nbextra1 = nbextra1_formula;
int nb23 = p + nbextra1;
......@@ -154,9 +154,8 @@ svd_getm( const libhqr_tree_t *qrtree,
}
/* Tile of type 1 */
else {
j = i - nb23;
pa = p * a;
pos1 = ( ( (p + k ) + pa - 1 ) / pa ) * pa;
int j = i - nb23;
int pos1 = ( ( (p + k ) + pa - 1 ) / pa ) * pa;
return pos1 + (j/p) * pa + j%p;
}
}
......@@ -175,9 +174,8 @@ svd_geti( const libhqr_tree_t *qrtree,
int p = qrtree->p;
int a = svd_geta(arg, k);
int pos1, j, pa = p * a;
int pa = p * a;
int nbextra1 = nbextra1_formula;
int nb23 = p + nbextra1;
int end2 = p + k + nbextra1;
/* Tile of type 2 or 3 or the 1 between the diagonal and the multiple after the diagonal */
......@@ -186,8 +184,9 @@ svd_geti( const libhqr_tree_t *qrtree,
}
/* Tile of type 1 */
else {
pos1 = ( ( (p + k ) + pa - 1 ) / pa ) * pa;
j = m - pos1;
int pos1 = ( ( (p + k) + pa - 1 ) / pa ) * pa;
int j = m - pos1;
int nb23 = p + nbextra1;
return nb23 + (j / pa) * p + j%pa;
}
}
......@@ -362,7 +361,7 @@ static int svd_nextpiv(const libhqr_tree_t *qrtree, int k, int pivot, int start)
/* no next of type 1, we reset start to search the next 2 */
start = gmt;
lstart = ldd * a;
/* lstart = ldd * a; */
libhqr_attr_fallthrough;
case LIBHQR_KILLED_BY_DISTTREE:
......
......@@ -332,7 +332,6 @@ libhqr_initmtx_tphqr( libhqr_tree_t *qrtree,
}
assert( killer_index <= qrtree->mt );
/* assert( killer_index <= (low_mt*p) ); */
args->nbgeqrf[k] = killer_index;
/* Add the new element when performing a TT kernel */
......
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