From fd253650283456fe1e137979811619b96516971d Mon Sep 17 00:00:00 2001 From: "denis.davydov" Date: Mon, 19 May 2014 14:07:42 +0000 Subject: [PATCH] modified matrix_scalar_product to do conjugate(u)*M*v git-svn-id: https://svn.dealii.org/branches/branch_petscscalar_complex@32937 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/include/deal.II/lac/petsc_parallel_sparse_matrix.h | 4 ++-- deal.II/source/lac/petsc_parallel_sparse_matrix.cc | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/deal.II/include/deal.II/lac/petsc_parallel_sparse_matrix.h b/deal.II/include/deal.II/lac/petsc_parallel_sparse_matrix.h index 115bb94bfc..eaed3fec81 100644 --- a/deal.II/include/deal.II/lac/petsc_parallel_sparse_matrix.h +++ b/deal.II/include/deal.II/lac/petsc_parallel_sparse_matrix.h @@ -449,7 +449,7 @@ namespace PETScWrappers /** * Compute the matrix scalar - * product $\left(u,Mv\right)$. + * product $\left(conjugate(u),Mv\right)$. * * The implementation of this function * is not as efficient as the one in @@ -457,7 +457,7 @@ namespace PETScWrappers * deal.II (i.e. the original one, not * the PETSc wrapper class) since PETSc * doesn't support this operation and - * needs a temporary vector. + * needs two temporary vectors. */ PetscScalar matrix_scalar_product (const Vector &u, const Vector &v) const; diff --git a/deal.II/source/lac/petsc_parallel_sparse_matrix.cc b/deal.II/source/lac/petsc_parallel_sparse_matrix.cc index f514ad7d72..114d1ff207 100644 --- a/deal.II/source/lac/petsc_parallel_sparse_matrix.cc +++ b/deal.II/source/lac/petsc_parallel_sparse_matrix.cc @@ -863,8 +863,10 @@ namespace PETScWrappers const Vector &v) const { Vector tmp (v); + Vector copy_u (u); + Vector & conj = dynamic_cast(copy_u.conjugate()); vmult (tmp, v); - return u*tmp; + return conj*tmp; } } -- 2.39.5