![]() |
Blitz Support : |
From: Matthias Schillinger (matthias_at_[hidden])
Date: 2003-09-10 06:30:36
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
On Wednesday, 3. September 2003 00:09, you wrote:
> Hi Matthias,
>
> The problem here was that the expression template machinery used by arrays
> is separate from that used by vector types, and they are somewhat out of
> sync.
> In the blitz cvs repository, I have added to the generated header file
> <blitz/vecuops.cc>
> support for the conj() function. You can now use conj() on all
> vector-like types
> including TinyVector. Note that in your example program below, you
> should be
> including the header <blitz/tinyvec-et.h> in order to get the headers
> for TinyVector
> expression template support. This is no longer included by default by
> <blitz/array.h>.
>
> Regards, Julian C.
>
> Matthias Schillinger wrote:
> >Hi,
> >
> >if I try to compile this small program with gcc-3.2
> >/******************************************/
> >#include <iostream>
> >#include <complex>
> >#include <blitz/array.h>
> >using namespace blitz;
> >typedef TinyVector< std::complex<double> ,2> cVector2D;
> >
> >int main()
> >{
> > cVector2D a( std::complex<double>(1.0,1.0),
> > std::complex<double>(2.0,2.0)); cVector2D b;
> > b=conj(a);
> > return 0;
> >};
> >/*****************************************/
> >
> >I get the following error message:
> >
> >tinytest.cpp: In function `int main()':
> >tinytest.cpp:11: cannot convert `cVector2D' to `__complex__ double' for
> > argument `1' to `__complex__ double std::conj(__complex__ double)'
> >
> >For Arrays conj() works fine and following the blitz++ user guide it
> > should also work for TinyVector.
> >
> >Thanks for any suggestions!
> >
> >Matthias
> >_______________________________________________
> >Blitz-support mailing list
> >Blitz-support_at_[hidden]
> >http://www.oonumerics.org/mailman/listinfo.cgi/blitz-support