Fixed warnings flagged by Ubuntu g++

release/4.3a0
Frank Dellaert 2018-10-08 21:00:22 -04:00
parent 98f42bd1e6
commit 366b2485c1
4 changed files with 66 additions and 62 deletions

View File

@ -1560,8 +1560,9 @@ PUBLIC Int CCOLAMD_2 /* returns TRUE if successful, FALSE otherwise */
Int *dead_cols ;
Int set1 ;
Int set2 ;
#ifndef NDEBUG
Int cs ;
#endif
int ok ;
#ifndef NDEBUG
@ -1909,8 +1910,10 @@ PUBLIC Int CCOLAMD_2 /* returns TRUE if successful, FALSE otherwise */
p [k] = col ;
ASSERT (A [col] == EMPTY) ;
cs = CMEMBER (col) ;
#ifndef NDEBUG
cs = CMEMBER (col) ;
ASSERT (k >= cset_start [cs] && k < cset_start [cs+1]) ;
#endif
A [col] = k ;
k++ ;
@ -1926,11 +1929,11 @@ PUBLIC Int CCOLAMD_2 /* returns TRUE if successful, FALSE otherwise */
if (A [col] == EMPTY)
{
k = Col [col].shared2.order ;
cs = CMEMBER (col) ;
#ifndef NDEBUG
cs = CMEMBER (col) ;
dead_cols [cs]-- ;
#endif
ASSERT (k >= cset_start [cs] && k < cset_start [cs+1]) ;
#endif
DEBUG1 (("ccolamd output ordering: k "ID" col "ID
" (dense or null col)\n", k, col)) ;
p [k] = col ;

View File

@ -1323,29 +1323,27 @@ void gk_csr_Normalize(gk_csr_t *mat, int what, int norm)
ssize_t *ptr;
float *val, sum;
if (what&GK_CSR_ROW && mat->rowval) {
n = mat->nrows;
if (what & GK_CSR_ROW && mat->rowval) {
n = mat->nrows;
ptr = mat->rowptr;
val = mat->rowval;
#pragma omp parallel if (ptr[n] > OMPMINOPS)
#pragma omp parallel if (ptr[n] > OMPMINOPS)
{
#pragma omp for private(j,sum) schedule(static)
for (i=0; i<n; i++) {
for (sum=0.0, j=ptr[i]; j<ptr[i+1]; j++){
if (norm == 2)
sum += val[j]*val[j];
else if (norm == 1)
sum += val[j]; /* assume val[j] > 0 */
#pragma omp for private(j, sum) schedule(static)
for (i = 0; i < n; i++) {
for (sum = 0.0, j = ptr[i]; j < ptr[i + 1]; j++) {
if (norm == 2)
sum += val[j] * val[j];
else if (norm == 1)
sum += val[j]; /* assume val[j] > 0 */
}
if (sum > 0) {
if (norm == 2)
sum=1.0/sqrt(sum);
else if (norm == 1)
sum=1.0/sum;
for (j=ptr[i]; j<ptr[i+1]; j++)
val[j] *= sum;
if (norm == 2)
sum = 1.0 / sqrt(sum);
else if (norm == 1)
sum = 1.0 / sum;
for (j = ptr[i]; j < ptr[i + 1]; j++) val[j] *= sum;
}
}
}

View File

@ -341,10 +341,10 @@ static int gk_getopt_internal(int argc, char **argv, char *optstring,
if (gk_optind == 0 || !gk_getopt_initialized) {
if (gk_optind == 0)
gk_optind = 1; /* Don't scan ARGV[0], the program name. */
optstring = gk_getopt_initialize (argc, argv, optstring);
gk_getopt_initialized = 1;
}
gk_optind = 1; /* Don't scan ARGV[0], the program name. */
optstring = gk_getopt_initialize(argc, argv, optstring);
gk_getopt_initialized = 1;
}
/* Test whether ARGV[gk_optind] points to a non-option argument.
Either it does not have option syntax, or there is an environment flag
@ -670,37 +670,38 @@ static int gk_getopt_internal(int argc, char **argv, char *optstring,
if (temp[1] == ':') {
if (temp[2] == ':') {
/* This is an option that accepts an argument optionally. */
if (*nextchar != '\0') {
gk_optarg = nextchar;
gk_optind++;
}
else
gk_optarg = NULL;
nextchar = NULL;
}
else {
/* This is an option that requires an argument. */
if (*nextchar != '\0') {
gk_optarg = nextchar;
/* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */
gk_optind++;
}
else if (gk_optind == argc) {
if (print_errors) {
/* 1003.2 specifies the format of this message. */
fprintf(stderr, "%s: option requires an argument -- %c\n", argv[0], c);
}
gk_optopt = c;
if (optstring[0] == ':')
c = ':';
else
c = '?';
}
else
/* We already incremented `gk_optind' once; increment it again when taking next ARGV-elt as argument. */
gk_optarg = argv[gk_optind++];
nextchar = NULL;
/* This is an option that accepts an argument optionally. */
if (*nextchar != '\0') {
gk_optarg = nextchar;
gk_optind++;
} else {
gk_optarg = NULL;
}
nextchar = NULL;
} else {
/* This is an option that requires an argument. */
if (*nextchar != '\0') {
gk_optarg = nextchar;
/* If we end this ARGV-element by taking the rest as an arg, we must
* advance to the next element now. */
gk_optind++;
} else if (gk_optind == argc) {
if (print_errors) {
/* 1003.2 specifies the format of this message. */
fprintf(stderr, "%s: option requires an argument -- %c\n", argv[0],
c);
}
gk_optopt = c;
if (optstring[0] == ':')
c = ':';
else
c = '?';
} else {
/* We already incremented `gk_optind' once; increment it again when
* taking next ARGV-elt as argument. */
gk_optarg = argv[gk_optind++];
}
nextchar = NULL;
}
}
return c;

View File

@ -83,26 +83,28 @@ namespace gtsam {
std::string parent = out.str();
parent += "[label=\"";
for(Key index: clique->conditional_->frontals()) {
if(!first) parent += ","; first = false;
for (Key index : clique->conditional_->frontals()) {
if (!first) parent += ",";
first = false;
parent += indexFormatter(index);
}
if(clique->parent()){
if (clique->parent()) {
parent += " : ";
s << parentnum << "->" << num << "\n";
}
first = true;
for(Key sep: clique->conditional_->parents()) {
if(!first) parent += ","; first = false;
for (Key sep : clique->conditional_->parents()) {
if (!first) parent += ",";
first = false;
parent += indexFormatter(sep);
}
parent += "\"];\n";
s << parent;
parentnum = num;
for(sharedClique c: clique->children) {
for (sharedClique c : clique->children) {
num++;
saveGraph(s, c, indexFormatter, parentnum);
}