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

Dune flyspray at dune-project.org
Thu Jun 21 19:16:22 CEST 2012


THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.

The following task has a new comment added:

FS#1011 - operator* in densevector used as dot product in dune-istl is not suitable for complex vectors
User who did this - Jö Fahlke (joe)

----------
More specifically, the distinction between fundamental type, complex, and
vector types can be done like this for the free function dot():

  template<class T>
  struct AlwaysVoid { typedef void type; }

  template<class T, class = void>
  struct IsVector : false_type {};

  template<class T>
  struct IsVector<T, typename AlwaysVoid<typename T::FieldType>::type>
  : true_type {};

  // fundamental type
  template<class A, class B>
  typename enable_if<!IsVector<A>::value,
                     PromotionTraits<A,B>::Result>::type
  dot(A a, B b) { /*...*/; }

  // complex (and combinations with fundamental types)
  template<class A, class B>
  std::complex<PromotionTraits<A,B>::Result>
  dot(std::complex<A> a, B b) { /*...*/; }

  template<class A, class B>
  std::complex<PromotionTraits<A,B>::Result>
  dot(A a, std::complex<B> b) { /*...*/; }

  template<class A, class B>
  std::complex<PromotionTraits<A,B>::Result>
  dot(std::complex<A> a, std::complex<B> b) { /*...*/; }

  // vectors
  template<class A, class B>
  PromotionTraits<typename A::FieldType, typename B::FieldType>::Result
  dot(A a, B b) { return a.dot(b); }


----------

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

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