From 27a329881ddd7b51ad283c56e99efbbd1b498bd5 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Thu, 9 May 2019 08:51:23 -0400 Subject: [PATCH] Avoid signed-unsigned comparison --- include/deal.II/lac/full_matrix.templates.h | 32 +++++++++------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/include/deal.II/lac/full_matrix.templates.h b/include/deal.II/lac/full_matrix.templates.h index d05222e9b8..7118415e0d 100644 --- a/include/deal.II/lac/full_matrix.templates.h +++ b/include/deal.II/lac/full_matrix.templates.h @@ -529,13 +529,12 @@ FullMatrix::mmult(FullMatrix & dst, // works for us (it is usually not efficient to use BLAS for very small // matrices): #ifdef DEAL_II_WITH_LAPACK + const size_type max_blas_int = std::numeric_limits::max(); if ((std::is_same::value || std::is_same::value) && std::is_same::value) - if (this->n() * this->m() * src.n() > 300 && - src.n() <= std::numeric_limits::max() && - this->m() <= std::numeric_limits::max() && - this->n() <= std::numeric_limits::max()) + if (this->n() * this->m() * src.n() > 300 && src.n() <= max_blas_int && + this->m() <= max_blas_int && this->n() <= max_blas_int) { // In case we have the BLAS function gemm detected by CMake, we // use that algorithm for matrix-matrix multiplication since it @@ -613,13 +612,12 @@ FullMatrix::Tmmult(FullMatrix & dst, // works for us (it is usually not efficient to use BLAS for very small // matrices): #ifdef DEAL_II_WITH_LAPACK + const size_type max_blas_int = std::numeric_limits::max(); if ((std::is_same::value || std::is_same::value) && std::is_same::value) - if (this->n() * this->m() * src.n() > 300 && - src.n() <= std::numeric_limits::max() && - this->n() <= std::numeric_limits::max() && - this->m() <= std::numeric_limits::max()) + if (this->n() * this->m() * src.n() > 300 && src.n() <= max_blas_int && + this->n() <= max_blas_int && this->m() <= max_blas_int) { // In case we have the BLAS function gemm detected by CMake, we // use that algorithm for matrix-matrix multiplication since it @@ -718,13 +716,12 @@ FullMatrix::mTmult(FullMatrix & dst, // works for us (it is usually not efficient to use BLAS for very small // matrices): #ifdef DEAL_II_WITH_LAPACK + const size_type max_blas_int = std::numeric_limits::max(); if ((std::is_same::value || std::is_same::value) && std::is_same::value) - if (this->n() * this->m() * src.m() > 300 && - src.m() <= std::numeric_limits::max() && - this->n() <= std::numeric_limits::max() && - this->m() <= std::numeric_limits::max()) + if (this->n() * this->m() * src.m() > 300 && src.m() <= max_blas_int && + this->n() <= max_blas_int && this->m() <= max_blas_int) { // In case we have the BLAS function gemm detected by CMake, we // use that algorithm for matrix-matrix multiplication since it @@ -821,13 +818,12 @@ FullMatrix::TmTmult(FullMatrix & dst, // works for us (it is usually not efficient to use BLAS for very small // matrices): #ifdef DEAL_II_WITH_LAPACK + const size_type max_blas_int = std::numeric_limits::max(); if ((std::is_same::value || std::is_same::value) && std::is_same::value) - if (this->n() * this->m() * src.m() > 300 && - src.m() <= std::numeric_limits::max() && - this->n() <= std::numeric_limits::max() && - this->m() <= std::numeric_limits::max()) + if (this->n() * this->m() * src.m() > 300 && src.m() <= max_blas_int && + this->n() <= max_blas_int && this->m() <= max_blas_int) { // In case we have the BLAS function gemm detected by CMake, we // use that algorithm for matrix-matrix multiplication since it @@ -1829,8 +1825,8 @@ FullMatrix::gauss_jordan() // matrices): #ifdef DEAL_II_WITH_LAPACK if (std::is_same::value || std::is_same::value) - if (this->n_cols() > 15 && - this->n_cols() <= std::numeric_limits::max()) + if (this->n_cols() > 15 && static_cast(this->n_cols()) <= + std::numeric_limits::max()) { // In case we have the LAPACK functions // getrf and getri detected by CMake, -- 2.39.5