From: bangerth Date: Tue, 6 Nov 2007 03:33:06 +0000 (+0000) Subject: Define the scalar product the other way around. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4fded9101c60929e401075846030250e9e2b494b;p=dealii-svn.git Define the scalar product the other way around. git-svn-id: https://svn.dealii.org/trunk@15452 0785d39b-7218-0410-832d-ea1e28bc413d --- 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