From 4fded9101c60929e401075846030250e9e2b494b Mon Sep 17 00:00:00 2001 From: bangerth Date: Tue, 6 Nov 2007 03:33:06 +0000 Subject: [PATCH] Define the scalar product the other way around. git-svn-id: https://svn.dealii.org/trunk@15452 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/lac/include/lac/vector.h | 2 +- deal.II/lac/include/lac/vector.templates.h | 2 +- tests/bits/complex_vector_23.cc | 2 +- tests/bits/complex_vector_23/cmp/generic | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/deal.II/lac/include/lac/vector.h b/deal.II/lac/include/lac/vector.h index bdb2931f9b..476982d2e3 100644 --- a/deal.II/lac/include/lac/vector.h +++ b/deal.II/lac/include/lac/vector.h @@ -406,7 +406,7 @@ class Vector : public Subscriptor * For complex vectors, the * scalar product is implemented * as $\left=\sum_i - * \bar{v_i} w_i$. + * v_i \bar{w_i}$. */ template Number operator * (const Vector &V) const; diff --git a/deal.II/lac/include/lac/vector.templates.h b/deal.II/lac/include/lac/vector.templates.h index f2b23a2672..5fa9e5b5e8 100644 --- a/deal.II/lac/include/lac/vector.templates.h +++ b/deal.II/lac/include/lac/vector.templates.h @@ -237,7 +237,7 @@ Number Vector::operator * (const Vector& v) const // operator*(complex,complex) // is not defined by default for (unsigned int i=0; i::conjugate(val[i]) * Number(v.val[i]); + sum += val[i] * Number(numbers::NumberTraits::conjugate(v.val[i])); return sum; } diff --git a/tests/bits/complex_vector_23.cc b/tests/bits/complex_vector_23.cc index 4c28347b29..348e33f3f7 100644 --- a/tests/bits/complex_vector_23.cc +++ b/tests/bits/complex_vector_23.cc @@ -35,7 +35,7 @@ void test (Vector > &v, if (i%3 == 0) { w(i) = std::complex (i+1., i+2.); - product += 1.*i*std::complex (i+1., i+2.); + product += 1.*i*std::conj(std::complex (i+1., i+2.)); } } diff --git a/tests/bits/complex_vector_23/cmp/generic b/tests/bits/complex_vector_23/cmp/generic index 92bca168fb..2b83286813 100644 --- a/tests/bits/complex_vector_23/cmp/generic +++ b/tests/bits/complex_vector_23/cmp/generic @@ -1,3 +1,3 @@ -DEAL::(114444.,116127.) (114444.,-116127.) (114444.,116127.) (114444.,-116127.) +DEAL::(114444.,-116127.) (114444.,116127.) (114444.,-116127.) (114444.,116127.) DEAL::OK -- 2.39.5