[Dune] [#1011] operator* in densevector used as dot product in dune-istl is not suitable for complex vectors

Dune flyspray at dune-project.org
Wed Jan 4 13:57:07 CET 2012


THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.

A new Flyspray task has been opened.  Details are below. 

User who did this - Matthias Wohlmuth (matthias) 

Attached to Project - Dune
Summary - operator* in densevector used as dot product in dune-istl is not suitable for complex vectors
Task Type - Bug Report
Category - Dune Core Modules
Status - Unconfirmed
Assigned To - 
Operating System - Unspecified / All
Severity - Medium
Priority - Normal
Reported Version - SVN (pre2.2)
Due in Version - Undecided
Due Date - Undecided
Details - operator* in densevector is documented (and implemented) as follows:

//! scalar product (x^T y) 
template<class Other>
value_type operator* (const DenseVector< Other > &y) const 


For example in <dune/istl/scalarproducts.hh>, it is used as dot product for the solver classes in 

virtual field_type dot (const X &x, const X &y)

Obviously, this is not the desired scalar product in the case of complex numbers. 

So, how to resolve this issue.... I could provide a patch which takes the conjugate of one of the vectors and adds a type promotion for the case, that one vector is real and one is complex. 

However, this patch has some unfortunate side effects.... For example, if you assemble boundary integrals, you might have to multiply a complex coefficient vector with the boundary normal. The most intuitive way seems to also you use operator*, which then leads to a hidden and probably unwanted complex conjugation. In particular, it depends on wether the implementation of operator* conjugates the first or the second argument. Therefore, this might introduce some trouble which is difficult to trace back....

So, perhaps it would be better to have the functionality of the present operator* together with a second operator (for example x.dot(y)) which is used for the scalar products. Of course, this would be an interface change and istl had to be adapted. 

I'd appreciate your thoughts on that.

Thanks, 
Matthias





More information can be found at the following URL:
http://www.dune-project.org/flyspray/index.php?do=details&task_id=1011

You are receiving this message because you have requested it from the Flyspray bugtracking system.  If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.




More information about the Dune mailing list