From f3af3059e0b70413e109442ef82c61d15addd1fb Mon Sep 17 00:00:00 2001 From: David Wells Date: Sat, 21 Nov 2015 18:33:45 -0500 Subject: [PATCH] Prefer boost::math::iround to static_cast. --- source/lac/lapack_full_matrix.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/source/lac/lapack_full_matrix.cc b/source/lac/lapack_full_matrix.cc index 5abe298209..52faaca150 100644 --- a/source/lac/lapack_full_matrix.cc +++ b/source/lac/lapack_full_matrix.cc @@ -22,6 +22,8 @@ #include #include +#include + #include #include @@ -503,7 +505,7 @@ LAPACKFullMatrix::compute_svd() &work[0], &lwork, &ipiv[0], &info); AssertThrow (info==0, LAPACKSupport::ExcErrorCode("gesdd", info)); // Now resize work array and - lwork = static_cast(work[0] + .5); + lwork = boost::math::iround(work[0]); work.resize(lwork); // Do the actual SVD. @@ -655,7 +657,7 @@ LAPACKFullMatrix::compute_eigenvalues(const bool right, // for work, everything else would not be acceptable. Assert (info == 0, ExcInternalError()); // Allocate working array according to suggestion. - lwork = (int) (work[0]+.1); + lwork = boost::math::iround(work[0]); // resize workspace array work.resize((size_type ) lwork); @@ -727,7 +729,7 @@ LAPACKFullMatrix::compute_eigenvalues_symmetric(const number lowe // for work, everything else would not be acceptable. Assert (info == 0, ExcInternalError()); // Allocate working array according to suggestion. - lwork = (int) (work[0]+.1); + lwork = boost::math::iround(work[0]); work.resize(static_cast (lwork)); // Finally compute the eigenvalues. @@ -817,7 +819,7 @@ LAPACKFullMatrix::compute_generalized_eigenvalues_symmetric( // for work, everything else would not be acceptable. Assert (info == 0, ExcInternalError()); // Allocate working array according to suggestion. - lwork = (int) (work[0]+.1); + lwork = boost::math::iround(work[0]); // resize workspace arrays work.resize(static_cast (lwork)); @@ -898,7 +900,7 @@ LAPACKFullMatrix::compute_generalized_eigenvalues_symmetric ( // for work, everything else would not be acceptable. Assert (info == 0, ExcInternalError()); // Allocate working array according to suggestion. - lwork = (int) (work[0]+.1); + lwork = boost::math::iround(work[0]); // resize workspace array work.resize((size_type) lwork); -- 2.39.5