BZDEV: arithmetic if in Blitz++?

From: Martin Reinecke (martin@mpa-garching.mpg.de)
Date: Tue Jun 23 1998 - 01:59:01 EST


Hi all,

during my port of a scientific code to C++/Blitz++ I discovered a
problem I'd like
to hear your opinion about.

Consider the following C code:

float a[100], b[100], c[100], d[100];
do (i=0; i<100; ++i)
   a[i] = (b[i] < 0) ? c[i] : d[i];

The obvious Blitz++ equivalent

Array<float,1> a(100), b(100), c(100), d(100);
a = (b < 0) ? c : d;

won't work because the C++ standard doesn't allow overloading the ?:
operator
(BTW, can anyone explain me why?).

Is there an elegant and efficient way to formulate 'arithmetic if'
constructs for Blitz++ arrays?
They are quite essential for my code.

Thanks in advance,

Martin

--------------------- blitz-dev list --------------------------------
* To subscribe/unsubscribe: mail to majordomo@oonumerics.org, with
"subscribe blitz-dev" or "unsubscribe blitz-dev" in the body of the message
* Blitz++ web page: http://oonumerics.org/blitz/



This archive was generated by hypermail 2b29 : Wed Feb 20 2002 - 04:30:05 EST