![]() |
Blitz Support : |
From: Julian Cummings (cummings_at_[hidden])
Date: 2003-09-10 18:45:24
Hi Matthias,
This *should* already work, but it doesn't because of a namespace
problem. The standard C math functions for the blitz::Array type are
defined in namespace blitz, and they apply the math function to each
element of the Array. But they do this by calling the math function
with the proper namespace qualifier (usually std::). Applying
std::conj() to a TinyVector fails because this function is defined in
namespace blitz, not namespace std.
I am not sure what is the best way to solve this problem. One solution
would be to invoke math functions on Array elements without the std::
qualifier when defining their behavior
for blitz Arrays. I think this is OK because in <blitz/blitz.h> we
already include both <cmath> (if available) and <math.h> and then import
the symbols from namespace std into
namespace blitz. So the standard math functions should be found without
any qualifier.
I'll give this approach a try and see if it is a safe and effective
solution.
Regards, Julian C.
Matthias Schillinger wrote:
>Hi Julian,
>
>I'd like to write some generic code for 3D scalar and vector fields. So far
>it is possible to do
>***
>Array<std::complex<double>, 3> A(n,n), B(n,n);
>...//fill A with values
>B=conj(A);
>*******
>though conj() works for TinyVector now (thanks again) it's not possible to do
>the above for
>***
>Array<TinyVector<std::complex<double>,3> , 3> A(n,n), B(n,n);
>******
>
>Would it be possible to add this feature to blitz++?
>
>Regards,
>Matthias
>
>
>
>
>
-- Dr. Julian C. Cummings E-mail: cummings_at_[hidden] California Institute of Technology Phone: 626-395-2543 1200 E. California Blvd., Mail Code 158-79 Fax: 626-584-5917 Pasadena, CA 91125