From: Matthias Maier Date: Fri, 10 Apr 2015 22:33:36 +0000 (+0200) Subject: Specialize LAPACKFullMatrix::vmult (etc.) interface X-Git-Tag: v8.3.0-rc1~297^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8d98850fe1b81a53325bbd66ce6c32fc7f3b6ec6;p=dealii.git Specialize LAPACKFullMatrix::vmult (etc.) interface --- diff --git a/include/deal.II/lac/full_matrix.templates.h b/include/deal.II/lac/full_matrix.templates.h index e1a113dcd1..03b4609358 100644 --- a/include/deal.II/lac/full_matrix.templates.h +++ b/include/deal.II/lac/full_matrix.templates.h @@ -17,7 +17,11 @@ #define __deal2__full_matrix_templates_h -//TODO: this file has a lot of operations between matrices and matrices or matrices and vectors of different precision. we should go through the file and in each case pick the more accurate data type for intermediate results. currently, the choice is pretty much random. this may also allow us some operations where one operand is complex and the other is not +// TODO: this file has a lot of operations between matrices and matrices or +// matrices and vectors of different precision. we should go through the +// file and in each case pick the more accurate data type for intermediate +// results. currently, the choice is pretty much random. this may also allow +// us some operations where one operand is complex and the other is not #include #include diff --git a/include/deal.II/lac/lapack_full_matrix.h b/include/deal.II/lac/lapack_full_matrix.h index ddd45f1cf9..b9a90ae988 100644 --- a/include/deal.II/lac/lapack_full_matrix.h +++ b/include/deal.II/lac/lapack_full_matrix.h @@ -1,6 +1,6 @@ // --------------------------------------------------------------------- // -// Copyright (C) 2005 - 2014 by the deal.II authors +// Copyright (C) 2005 - 2015 by the deal.II authors // // This file is part of the deal.II library. // @@ -146,14 +146,14 @@ public: const size_type cols); /** - * Return the dimension of the range space. + * Return the dimension of the codomain (or range) space. * * @note The matrix is of dimension $m \times n$. */ unsigned int m () const; /** - * Return the number of the range space. + * Return the dimension of the domain space. * * @note The matrix is of dimension $m \times n$. */ @@ -193,7 +193,7 @@ public: *
  • If #state is LAPACKSupport::svd or LAPACKSupport::inverse_svd, this * function first multiplies with the right transformation matrix, then with * the diagonal matrix of singular values or their reciprocal values, and - * finally with the left trandformation matrix. + * finally with the left transformation matrix. * * * The optional parameter adding determines, whether the result is @@ -205,20 +205,31 @@ public: * * @note Source and destination must not be the same vector. * - * @note This template only exists for compile-time compatibility with - * FullMatrix. Implementation is only available for - * VECTOR=Vector<number> + * @note The template with @tref number2 only exists for compile-time + * compatibility with FullMatrix. Only the case @tref number2 = @tref + * number is implemented due to limitations in the underlying LAPACK + * interface */ - template - void vmult(VECTOR &dst, const VECTOR &src, const bool adding = false) const; + template + void vmult (Vector &w, + const Vector &v, + const bool adding = false) const; + + void vmult (Vector &w, + const Vector &v, + const bool adding = false) const; /** * Adding Matrix-vector-multiplication. w += A*v * * See the documentation of vmult() for details on the implementation. */ - template - void vmult_add (VECTOR &w, const VECTOR &v) const; + template + void vmult_add (Vector &w, + const Vector &v) const; + + void vmult_add (Vector &w, + const Vector &v) const; /** * Transpose matrix-vector-multiplication. @@ -232,27 +243,25 @@ public: * * See the documentation of vmult() for details on the implementation. */ - template - void Tvmult (VECTOR &w, const VECTOR &v, + template + void Tvmult (Vector &w, + const Vector &v, + const bool adding=false) const; + + void Tvmult (Vector &w, + const Vector &v, const bool adding=false) const; /** - * Adding transpose matrix-vector-multiplication. w += - * AT*v + * Adding transpose matrix-vector-multiplication. + * w += AT*v * * See the documentation of vmult() for details on the implementation. */ - template - void Tvmult_add (VECTOR &w, const VECTOR &v) const; + template + void Tvmult_add (Vector &w, + const Vector &v) const; - void vmult (Vector &w, - const Vector &v, - const bool adding=false) const; - void vmult_add (Vector &w, - const Vector &v) const; - void Tvmult (Vector &w, - const Vector &v, - const bool adding=false) const; void Tvmult_add (Vector &w, const Vector &v) const; @@ -738,38 +747,52 @@ LAPACKFullMatrix::fill ( template -template -inline void -LAPACKFullMatrix::vmult(VECTOR &, const VECTOR &, bool) const +template +void +LAPACKFullMatrix::vmult (Vector &, + const Vector &, + const bool) const { - Assert(false, ExcNotImplemented()); + Assert(false, + ExcMessage("LAPACKFullMatrix::vmult must be called with a " + "matching Vector vector type.")); } template -template -inline void -LAPACKFullMatrix::vmult_add(VECTOR &, const VECTOR &) const +template +void +LAPACKFullMatrix::vmult_add (Vector &, + const Vector &) const { - Assert(false, ExcNotImplemented()); + Assert(false, + ExcMessage("LAPACKFullMatrix::vmult_add must be called with a " + "matching Vector vector type.")); } template -template -inline void -LAPACKFullMatrix::Tvmult(VECTOR &, const VECTOR &, bool) const +template +void +LAPACKFullMatrix::Tvmult (Vector &, + const Vector &, + const bool) const { - Assert(false, ExcNotImplemented()); + Assert(false, + ExcMessage("LAPACKFullMatrix::Tvmult must be called with a " + "matching Vector vector type.")); } template -template -inline void -LAPACKFullMatrix::Tvmult_add(VECTOR &, const VECTOR &) const +template +void +LAPACKFullMatrix::Tvmult_add (Vector &, + const Vector &) const { - Assert(false, ExcNotImplemented()); + Assert(false, + ExcMessage("LAPACKFullMatrix::Tvmult_add must be called with a " + "matching Vector vector type.")); } diff --git a/include/deal.II/lac/vector.h b/include/deal.II/lac/vector.h index a44067ba2e..304cdc0d33 100644 --- a/include/deal.II/lac/vector.h +++ b/include/deal.II/lac/vector.h @@ -955,7 +955,7 @@ protected: /** * LAPACK matrices need access to the data. */ - friend class LAPACKFullMatrix; + template friend class LAPACKFullMatrix; /** * VectorView will access the pointer. diff --git a/source/lac/lapack_full_matrix.cc b/source/lac/lapack_full_matrix.cc index a7ab7759a8..74cde57dc8 100644 --- a/source/lac/lapack_full_matrix.cc +++ b/source/lac/lapack_full_matrix.cc @@ -1,6 +1,6 @@ // --------------------------------------------------------------------- // -// Copyright (C) 2005 - 2014 by the deal.II authors +// Copyright (C) 2005 - 2015 by the deal.II authors // // This file is part of the deal.II library. // @@ -247,6 +247,24 @@ LAPACKFullMatrix::Tvmult ( } +template +void +LAPACKFullMatrix::vmult_add (Vector &w, + const Vector &v) const +{ + vmult(w, v, true); +} + + +template +void +LAPACKFullMatrix::Tvmult_add (Vector &w, + const Vector &v) const +{ + Tvmult(w, v, true); +} + + template void LAPACKFullMatrix::mmult(LAPACKFullMatrix &C, @@ -958,31 +976,6 @@ LAPACKFullMatrix::compute_generalized_eigenvalues_symmetric ( } -// template -// LAPACKFullMatrix::() -// {} - - -template -void -LAPACKFullMatrix::vmult_add ( - Vector &w, - const Vector &v) const -{ - vmult(w, v, true); -} - - -template -void -LAPACKFullMatrix::Tvmult_add ( - Vector &w, - const Vector &v) const -{ - Tvmult(w, v, true); -} - - template void LAPACKFullMatrix::print_formatted ( diff --git a/source/lac/lapack_full_matrix.inst.in b/source/lac/lapack_full_matrix.inst.in index d366afef61..1b2958d53f 100644 --- a/source/lac/lapack_full_matrix.inst.in +++ b/source/lac/lapack_full_matrix.inst.in @@ -1,6 +1,6 @@ // --------------------------------------------------------------------- // -// Copyright (C) 2013 - 2014 by the deal.II authors +// Copyright (C) 2013 - 2015 by the deal.II authors // // This file is part of the deal.II library. //