![]() |
Blitz Support : |
From: Peter Bienstman (Peter.Bienstman_at_[hidden])
Date: 2004-12-21 10:08:12
(apologies if you recieve this twice)
Hi,
I'm playing around a bit with stencils on arrays containing complex numbers,
but without much success.
This program is essentially stencilet.cpp from the example directory, but
replacing double with complex<double>:
#include <blitz/array.h>
#include <blitz/array/stencil-et.h>
using namespace blitz;
int main()
{
Array< complex<float> ,2> A(Range(-7,7),Range(-7,7));
Array< complex<float> ,2> B(Range(-7,7),Range(-7,7));
A = 0.0;
A(0,0) = 1.0;
B = 0.0;
Range I(-5,5), J(-5,5);
Array< complex<float> ,2> Ai = A(I,J), Bi = B(I,J);
Bi = Laplacian2D4n(Ai);
cout << Bi << endl;
}
These are the compiler errors with blitz 0.8:
if g++ -DHAVE_CONFIG_H -I. -I.. -I.. -MT stencilet.o -MD -MP -MF
".deps/stencilet.Tpo" -c -o stencilet.o stencilet.cpp; \
then mv -f ".deps/stencilet.Tpo" ".deps/stencilet.Po"; else rm -f
".deps/stencilet.Tpo"; exit 1; fi
../blitz/array/stencilops.h: In function `typename T::T_numtype
blitz::Laplacian2D4(T&) [with T =
blitz::FastArrayIterator<std::complex<float>, 2>]':
../blitz/array/stencilops.h:93: instantiated from `typename T::T_numtype
blitz::Laplacian2D4n(T&) [with T =
blitz::FastArrayIterator<std::complex<float>, 2>]'
../blitz/array/stencil-et.h:224: instantiated from `P_numtype
blitz::Laplacian2D4n_et<P_numtype, N_rank>::operator()(const
blitz::TinyVector<int, N_destRank>&) [with P_numtype = std::complex<float>,
int N_rank = 2]'
../blitz/array/expr.h:149: instantiated from `typename P_expr::T_numtype
blitz::_bz_ArrayExpr<P_expr>::operator()(const blitz::TinyVector<int,
N_rank>&) [with int N_rank = 2, P_expr =
blitz::Laplacian2D4n_et<std::complex<float>, 2>]'
../blitz/array/eval.cc:670: instantiated from `blitz::Array<T, N>&
blitz::Array<T, N>::evaluateWithIndexTraversal1(T_expr, T_update) [with
T_expr = blitz::_bz_ArrayExpr<blitz::Laplacian2D4n_et<std::complex<float>, 2>
>, T_update = blitz::_bz_update<std::complex<float>, std::complex<float> >,
P_numtype = std::complex<float>, int N_rank = 2]'
../blitz/array/eval.cc:171: instantiated from `blitz::Array<T, N>&
blitz::Array<T, N>::evaluate(T_expr, T_update) [with T_expr =
blitz::_bz_ArrayExpr<blitz::Laplacian2D4n_et<std::complex<float>, 2> >,
T_update = blitz::_bz_update<std::complex<float>, std::complex<float> >,
P_numtype = std::complex<float>, int N_rank= 2]'
../blitz/array/ops.cc:51: instantiated from `blitz::Array<T, N>&
blitz::Array<T, N>::operator=(const blitz::ETBase<T_expr>&) [with T_expr =
blitz::_bz_ArrayExpr<blitz::Laplacian2D4n_et<std::complex<float>, 2> >,
P_numtype = std::complex<float>, int N_rank = 2]'
stencilet.cpp:19: instantiated from here
../blitz/array/stencilops.h:87: error: no match for 'operator*' in '1.6e+1 *
std::operator+(const std::complex<_Tp>&, const std::complex<_Tp>&) [with
_Tp
= float]((&blitz::FastArrayIterator<T_numtype, N_rank>::shift(int, int)
[with P_numtype = std::complex<float>, int N_rank = 2](1, 1)))'
../blitz/meta/metaprog.h:41: error: candidates are: T blitz::operator*(const
T&, blitz::_bz_meta_nullOperand) [with T = double]
../blitz/array/stencilops.h:93: instantiated from `typename T::T_numtype
blitz::Laplacian2D4n(T&) [with T =
blitz::FastArrayIterator<std::complex<float>, 2>]'
../blitz/array/stencil-et.h:224: instantiated from `P_numtype
blitz::Laplacian2D4n_et<P_numtype, N_rank>::operator()(const
blitz::TinyVector<int, N_destRank>&) [with P_numtype = std::complex<float>,
int N_rank = 2]'
../blitz/array/expr.h:149: instantiated from `typename P_expr::T_numtype
blitz::_bz_ArrayExpr<P_expr>::operator()(const blitz::TinyVector<int,
N_rank>&) [with int N_rank = 2, P_expr =
blitz::Laplacian2D4n_et<std::complex<float>, 2>]'
../blitz/array/eval.cc:670: instantiated from `blitz::Array<T, N>&
blitz::Array<T, N>::evaluateWithIndexTraversal1(T_expr, T_update) [with
T_expr = blitz::_bz_ArrayExpr<blitz::Laplacian2D4n_et<std::complex<float>, 2>
>, T_update = blitz::_bz_update<std::complex<float>, std::complex<float> >,
P_numtype = std::complex<float>, int N_rank = 2]'
../blitz/array/eval.cc:171: instantiated from `blitz::Array<T, N>&
blitz::Array<T, N>::evaluate(T_expr, T_update) [with T_expr =
blitz::_bz_ArrayExpr<blitz::Laplacian2D4n_et<std::complex<float>, 2> >,
T_update = blitz::_bz_update<std::complex<float>, std::complex<float> >,
P_numtype = std::complex<float>, int N_rank= 2]'
../blitz/array/ops.cc:51: instantiated from `blitz::Array<T, N>&
blitz::Array<T, N>::operator=(const blitz::ETBase<T_expr>&) [with T_expr =
blitz::_bz_ArrayExpr<blitz::Laplacian2D4n_et<std::complex<float>, 2> >,
P_numtype = std::complex<float>, int N_rank = 2]'
stencilet.cpp:19: instantiated from here
../blitz/array/stencilops.h:87: error: no match for 'operator*' in '-6.0e+1 *
blitz::FastArrayIterator<T_numtype, N_rank>::operator*() [with P_numtype =
std::complex<float>, int N_rank = 2]()'
../blitz/meta/metaprog.h:41: error: candidates are: T blitz::operator*(const
T&, blitz::_bz_meta_nullOperand) [with T = double]
../blitz/array/stencilops.h: In function `typename T::T_numtype
blitz::Laplacian2D4n(T&) [with T =
blitz::FastArrayIterator<std::complex<float>, 2>]':
../blitz/array/stencil-et.h:224: instantiated from `P_numtype
blitz::Laplacian2D4n_et<P_numtype, N_rank>::operator()(const
blitz::TinyVector<int, N_destRank>&) [with P_numtype = std::complex<float>,
int N_rank = 2]'
../blitz/array/expr.h:149: instantiated from `typename P_expr::T_numtype
blitz::_bz_ArrayExpr<P_expr>::operator()(const blitz::TinyVector<int,
N_rank>&) [with int N_rank = 2, P_expr =
blitz::Laplacian2D4n_et<std::complex<float>, 2>]'
../blitz/array/eval.cc:670: instantiated from `blitz::Array<T, N>&
blitz::Array<T, N>::evaluateWithIndexTraversal1(T_expr, T_update) [with
T_expr = blitz::_bz_ArrayExpr<blitz::Laplacian2D4n_et<std::complex<float>, 2>
>, T_update = blitz::_bz_update<std::complex<float>, std::complex<float> >,
P_numtype = std::complex<float>, int N_rank = 2]'
../blitz/array/eval.cc:171: instantiated from `blitz::Array<T, N>&
blitz::Array<T, N>::evaluate(T_expr, T_update) [with T_expr =
blitz::_bz_ArrayExpr<blitz::Laplacian2D4n_et<std::complex<float>, 2> >,
T_update = blitz::_bz_update<std::complex<float>, std::complex<float> >,
P_numtype = std::complex<float>, int N_rank= 2]'
../blitz/array/ops.cc:51: instantiated from `blitz::Array<T, N>&
blitz::Array<T, N>::operator=(const blitz::ETBase<T_expr>&) [with T_expr =
blitz::_bz_ArrayExpr<blitz::Laplacian2D4n_et<std::complex<float>, 2> >,
P_numtype = std::complex<float>, int N_rank = 2]'
stencilet.cpp:19: instantiated from here
../blitz/array/stencilops.h:93: error: no match for 'operator*' in '
blitz::Laplacian2D4(T&) [with T =
blitz::FastArrayIterator<std::complex<float>, 2>]() * blitz::recip_12'
../blitz/meta/metaprog.h:41: error: candidates are: T blitz::operator*(const
T&, blitz::_bz_meta_nullOperand) [with T = std::complex<float>]
make: *** [stencilet.o] Error 1
Thanks!
Peter
-- ------------------------------------------------ Peter Bienstman Ghent University, Dept. of Information Technology Sint-Pietersnieuwstraat 41, B-9000 Gent, Belgium tel: +32 9 264 34 45, fax: +32 9 264 35 93 WWW: http://photonics.intec.UGent.be email: Peter.Bienstman_at_[hidden] ------------------------------------------------