]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
updated operator * (VectorBase), its description and the corresponding test
authordenis.davydov <denis.davydov@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 21 May 2014 19:04:18 +0000 (19:04 +0000)
committerdenis.davydov <denis.davydov@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 21 May 2014 19:04:18 +0000 (19:04 +0000)
git-svn-id: https://svn.dealii.org/branches/branch_petscscalar_complex@32959 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/lac/petsc_vector_base.h
deal.II/source/lac/petsc_vector_base.cc
tests/petsc_complex/20.cc
tests/petsc_complex/20.output

index b8195d78ea38d49744fc5cdd3ffa0624ee9b0093..d19932da4efd3167838b839d349f86e1c19782a8 100644 (file)
@@ -544,6 +544,9 @@ namespace PETScWrappers
      * Return the scalar product of two
      * vectors. The vectors must have the
      * same size.
+     *
+     * For complex valued vector, this gives
+     * $\left(v^\ast,vec\right)$.
      */
     PetscScalar operator * (const VectorBase &vec) const;
 
index 3233797c69efbaea90e0eefcc46e9a6aa1f27758..e441b03e647bccc3ac85a9949c549f25b40de9b7 100644 (file)
@@ -357,7 +357,11 @@ namespace PETScWrappers
 
     PetscScalar result;
 
-    const int ierr = VecDot (vector, vec.vector, &result);
+    //For complex vectors, VecDot() computes
+    //    val = (x,y) = y^H x,
+    //where y^H denotes the conjugate transpose of y.
+    //Note that this corresponds to the usual "mathematicians" complex inner product where the SECOND argument gets the complex conjugate.
+    const int ierr = VecDot (vec.vector, vector, &result);
     AssertThrow (ierr == 0, ExcPETScError(ierr));
 
     return result;
index f983727ff49a299bd8673920acf83c626c481e4d..0774b2cef247f2bac82ac9678806930a6ab43b70 100644 (file)
@@ -41,7 +41,7 @@ void test (PETScWrappers::Vector &v,
         {
           const PetscScalar wi = std::complex<double> (5.0-i,2.5*(i%6));
           w(i) = wi;
-          product += vi*wi;
+          product += PetscConj(vi)*wi;
         }
     }
 
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0fd8fc12f0b442283edd8868867114c242b04d11 100644 (file)
@@ -0,0 +1,2 @@
+
+DEAL::OK

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.