Fixed more warnings

release/4.3a0
Frank Dellaert 2018-10-08 21:38:50 -04:00
parent eb4659bcb6
commit ca80678ffc
3 changed files with 19 additions and 19 deletions

View File

@ -206,7 +206,7 @@ int main(int argc, char *argv[]) {
} }
#ifdef GTSAM_USE_TBB #ifdef GTSAM_USE_TBB
std::auto_ptr<tbb::task_scheduler_init> init; std::unique_ptr<tbb::task_scheduler_init> init;
if(nThreads > 0) { if(nThreads > 0) {
cout << "Using " << nThreads << " threads" << endl; cout << "Using " << nThreads << " threads" << endl;
init.reset(new tbb::task_scheduler_init(nThreads)); init.reset(new tbb::task_scheduler_init(nThreads));

View File

@ -1349,27 +1349,26 @@ void gk_csr_Normalize(gk_csr_t *mat, int what, int norm)
} }
} }
if (what&GK_CSR_COL && mat->colval) { if (what & GK_CSR_COL && mat->colval) {
n = mat->ncols; n = mat->ncols;
ptr = mat->colptr; ptr = mat->colptr;
val = mat->colval; val = mat->colval;
#pragma omp parallel if (ptr[n] > OMPMINOPS) #pragma omp parallel if (ptr[n] > OMPMINOPS)
{ {
#pragma omp for private(j,sum) schedule(static) #pragma omp for private(j, sum) schedule(static)
for (i=0; i<n; i++) { for (i = 0; i < n; i++) {
for (sum=0.0, j=ptr[i]; j<ptr[i+1]; j++) for (sum = 0.0, j = ptr[i]; j < ptr[i + 1]; j++)
if (norm == 2) if (norm == 2)
sum += val[j]*val[j]; sum += val[j] * val[j];
else if (norm == 1) else if (norm == 1)
sum += val[j]; sum += val[j];
if (sum > 0) { if (sum > 0) {
if (norm == 2) if (norm == 2)
sum=1.0/sqrt(sum); sum = 1.0 / sqrt(sum);
else if (norm == 1) else if (norm == 1)
sum=1.0/sum; sum = 1.0 / sum;
for (j=ptr[i]; j<ptr[i+1]; j++) for (j = ptr[i]; j < ptr[i + 1]; j++) val[j] *= sum;
val[j] *= sum;
} }
} }
} }

View File

@ -111,8 +111,9 @@ bool choleskyPartial(Matrix& ABC, size_t nFrontal, size_t topleft) {
return true; return true;
assert(ABC.cols() == ABC.rows()); assert(ABC.cols() == ABC.rows());
const Eigen::DenseIndex n = ABC.rows() - topleft; assert(ABC.rows() >= topleft);
assert(n >= 0 && nFrontal <= size_t(n)); const size_t n = static_cast<size_t>(ABC.rows() - topleft);
assert(nFrontal <= size_t(n));
// Create views on blocks // Create views on blocks
auto A = ABC.block(topleft, topleft, nFrontal, nFrontal); auto A = ABC.block(topleft, topleft, nFrontal, nFrontal);