From: Denis Davydov Date: Wed, 27 Sep 2017 14:47:01 +0000 (+0200) Subject: move thread mutex X-Git-Tag: v9.0.0-rc1~1015^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F5154%2Fhead;p=dealii.git move thread mutex --- diff --git a/source/lac/lapack_full_matrix.cc b/source/lac/lapack_full_matrix.cc index 28961749ad..dc71210063 100644 --- a/source/lac/lapack_full_matrix.cc +++ b/source/lac/lapack_full_matrix.cc @@ -178,8 +178,6 @@ LAPACKFullMatrix::vmult ( const Vector &v, const bool adding) const { - Threads::Mutex::ScopedLock lock (mutex); - const int mm = this->n_rows(); const int nn = this->n_cols(); const number alpha = 1.; @@ -199,6 +197,7 @@ LAPACKFullMatrix::vmult ( } case svd: { + Threads::Mutex::ScopedLock lock (mutex); AssertDimension(v.size(), this->n_cols()); AssertDimension(w.size(), this->n_rows()); // Compute V^T v @@ -213,6 +212,7 @@ LAPACKFullMatrix::vmult ( } case inverse_svd: { + Threads::Mutex::ScopedLock lock (mutex); AssertDimension(w.size(), this->n_cols()); AssertDimension(v.size(), this->n_rows()); // Compute U^T v @@ -238,8 +238,6 @@ LAPACKFullMatrix::Tvmult ( const Vector &v, const bool adding) const { - Threads::Mutex::ScopedLock lock (mutex); - const int mm = this->n_rows(); const int nn = this->n_cols(); const number alpha = 1.; @@ -259,6 +257,7 @@ LAPACKFullMatrix::Tvmult ( } case svd: { + Threads::Mutex::ScopedLock lock (mutex); AssertDimension(w.size(), this->n_cols()); AssertDimension(v.size(), this->n_rows()); @@ -271,21 +270,22 @@ LAPACKFullMatrix::Tvmult ( // Multiply with V gemv("T", &nn, &nn, &alpha, &svd_vt->values[0], &nn, &work[0], &one, &beta, w.val, &one); break; - case inverse_svd: - { - AssertDimension(v.size(), this->n_cols()); - AssertDimension(w.size(), this->n_rows()); - - // Compute V^T v - work.resize(std::max(mm,nn)); - gemv("N", &nn, &nn, &alpha, &svd_vt->values[0], &nn, v.val, &one, &null, &work[0], &one); - // Multiply by singular values - for (size_type i=0; ivalues[0], &mm, &work[0], &one, &beta, w.val, &one); - break; - } + } + case inverse_svd: + { + Threads::Mutex::ScopedLock lock (mutex); + AssertDimension(v.size(), this->n_cols()); + AssertDimension(w.size(), this->n_rows()); + + // Compute V^T v + work.resize(std::max(mm,nn)); + gemv("N", &nn, &nn, &alpha, &svd_vt->values[0], &nn, v.val, &one, &null, &work[0], &one); + // Multiply by singular values + for (size_type i=0; ivalues[0], &mm, &work[0], &one, &beta, w.val, &one); + break; } default: Assert (false, ExcState(state));