From: Martin Kronbichler Date: Tue, 7 Nov 2017 09:03:45 +0000 (+0100) Subject: Replace std::fabs() by std::abs() for complex numbers. X-Git-Tag: v9.0.0-rc1~813^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F5415%2Fhead;p=dealii.git Replace std::fabs() by std::abs() for complex numbers. --- diff --git a/source/lac/lapack_full_matrix.cc b/source/lac/lapack_full_matrix.cc index 8d00a95018..f53a0bb94d 100644 --- a/source/lac/lapack_full_matrix.cc +++ b/source/lac/lapack_full_matrix.cc @@ -718,7 +718,7 @@ LAPACKFullMatrix::compute_svd() AssertThrow (info==0, LAPACKSupport::ExcErrorCode("gesdd", info)); // Resize the work array. Add one to the size computed by LAPACK to be on // the safe side. - lwork = static_cast(std::fabs(work[0]) + 1); + lwork = static_cast(std::abs(work[0]) + 1); work.resize(lwork); // Do the actual SVD. @@ -743,10 +743,10 @@ LAPACKFullMatrix::compute_inverse_svd(const double threshold) Assert (state==LAPACKSupport::svd, ExcState(state)); - const double lim = std::fabs(wr[0])*threshold; + const double lim = std::abs(wr[0])*threshold; for (size_type i=0; i lim) + if (std::abs(wr[i]) > lim) wr[i] = number(1.)/wr[i]; else wr[i] = 0.; @@ -911,7 +911,7 @@ LAPACKFullMatrix::compute_eigenvalues(const bool right, Assert (info == 0, ExcInternalError()); // Allocate working array according to suggestion (same strategy as was // noted in compute_svd). - lwork = static_cast(std::fabs(work[0]) + 1); + lwork = static_cast(std::abs(work[0]) + 1); // resize workspace array work.resize((size_type ) lwork); @@ -984,7 +984,7 @@ LAPACKFullMatrix::compute_eigenvalues_symmetric(const number lowe Assert (info == 0, ExcInternalError()); // Allocate working array according to suggestion (same strategy as was noted in // compute_svd). - lwork = static_cast(std::fabs(work[0]) + 1); + lwork = static_cast(std::abs(work[0]) + 1); work.resize(static_cast (lwork)); // Finally compute the eigenvalues. @@ -1075,7 +1075,7 @@ LAPACKFullMatrix::compute_generalized_eigenvalues_symmetric( Assert (info == 0, ExcInternalError()); // Allocate working array according to suggestion (same strategy as was // noted in compute_svd). - lwork = static_cast(std::fabs(work[0]) + 1); + lwork = static_cast(std::abs(work[0]) + 1); // resize workspace arrays work.resize(static_cast (lwork)); @@ -1157,7 +1157,7 @@ LAPACKFullMatrix::compute_generalized_eigenvalues_symmetric ( Assert (info == 0, ExcInternalError()); // Allocate working array according to suggestion (same strategy as was // noted in compute_svd). - lwork = static_cast(std::fabs(work[0]) + 1); + lwork = static_cast(std::abs(work[0]) + 1); // resize workspace array work.resize(static_cast(lwork)); @@ -1230,7 +1230,7 @@ LAPACKFullMatrix::print_formatted ( // since there is no isnan on complex numbers if (std::isnan(std::abs((*this)(i,j)))) out << std::setw(width) << (*this)(i,j) << ' '; - else if (std::fabs(this->el(i,j)) > threshold) + else if (std::abs(this->el(i,j)) > threshold) out << std::setw(width) << this->el(i,j) * denominator << ' '; else