[Dune] arithmetic operators for FieldVector<K,1> (fwd)

Oliver Sander sander at mi.fu-berlin.de
Mon Dec 11 14:35:43 CET 2006


Hi guys!

I have found a problem when removing operator+ after all.  If you
remove it from FieldVector<K,1>, you can still compile

FieldVector<K,N> a, b;
double norm = (a+b).two_norm();

when N>=2, but not for N==1.
We may want to consider this before removing the operators.

--
Oliver

************************************************************************
* Oliver Sander                ** email: sander at mi.fu-berlin.de        *
* Freie Universität Berlin     ** phone: + 49 (30) 838 75217           *
* Institut für Mathematik II   ** URL  : page.mi.fu-berlin.de/~sander  *
* Arnimallee 6                 ** -------------------------------------*
* 14195 Berlin, Germany        ** Member of MATHEON (www.matheon.de)   *
************************************************************************

---------- Forwarded message ----------
Date: Thu, 7 Dec 2006 13:52:05 +0100 (CET)
From: Oliver Sander <sander at mi.fu-berlin.de>
Cc: dune at dune-project.org
Subject: Re: [Dune] arithmetic operators for FieldVector<K,1>

My scalar codes compile when operator+ is removed from FieldVector<K,1>.
It does seem redundant and I vote for its removal.

--
Oliver

************************************************************************
* Oliver Sander                ** email: sander at mi.fu-berlin.de        *
* Freie Universität Berlin     ** phone: + 49 (30) 838 75217           *
* Institut für Mathematik II   ** URL  : page.mi.fu-berlin.de/~sander  *
* Arnimallee 6                 ** -------------------------------------*
* 14195 Berlin, Germany        ** Member of MATHEON (www.matheon.de)   *
************************************************************************

On Thu, 7 Dec 2006, Sven Marnach wrote:

> Hi all,
> 
> I hit the same issue independently and I agree with Carsten.
> 
> Carsten Graeser schrieb am Di, 05. Dez 2006, um 12:29:34 +0100:
>> The only point I can see is, that the operator only use '+=' and
>> not '+' of K. So if you use a type K that does not implement '+' in the
>> present version FieldVector<K,1> has operator '+'. But K is assumed
>> to be compatible with double and why should FieldVector<K,1> have '+'
>> if K has not ?
> 
> Moreover, the operator + of FieldVector<K,1> can be used _only_ if K
> doesn't have an operator +; otherwise there would be an ambiguity.  So
> this operator is really useless!
> 
> Greetings,
>    Sven
> 
> _______________________________________________
> Dune mailing list
> Dune at dune-project.org
> http://www.dune-project.org/cgi-bin/mailman/listinfo/dune


More information about the Dune mailing list