From 4e2328e15d989753556095c17e85f65e68125721 Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Tue, 7 Nov 2017 10:03:45 +0100 Subject: [PATCH] Replace std::fabs() by std::abs() for complex numbers. --- source/lac/lapack_full_matrix.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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 -- 2.39.5