From 4397df94ad05fe0bf0731c64f4ae78a27a67379a Mon Sep 17 00:00:00 2001 From: Denis Davydov Date: Wed, 27 Sep 2017 16:47:01 +0200 Subject: [PATCH] move thread mutex --- source/lac/lapack_full_matrix.cc | 38 ++++++++++++++++---------------- 1 file changed, 19 insertions(+), 19 deletions(-) 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)); -- 2.39.5