From: Daniel Arndt Date: Thu, 9 May 2019 12:51:23 +0000 (-0400) Subject: Avoid signed-unsigned comparison X-Git-Tag: v9.1.0-rc1~100^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=27a329881ddd7b51ad283c56e99efbbd1b498bd5;p=dealii.git Avoid signed-unsigned comparison --- 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,