![]() |
Blitz Support : |
From: Andre Massing (massing_at_[hidden])
Date: 2004-08-24 16:13:54
Hello,
A few months ago I wrote a numerical programm using the blitz++0.6 libary
and gcc 2.95... The source-code was compiled without any problem.
Meanwhile I updated to blitz0.7 and gcc 3.3.3 and now the the compiler gives
some error messages, especially when I try to compute something inside
the function argument. So here are some pieces of my code:
Operatordefintion:
Array<Real,2> DiffParser:: operator()(const Real& t, const Array<Real,2>& Vars);
critical code:
int newton(..., Array<Real,2>& Z,...)
{
.
.
Z = 0;
.
.
//critical line:
Z(Range::all(),Range(j,j)) = f(t_c[j],x+Z(Range::all(),Range(j,j)));
.
.
}
error-messages:
g++ -c newton.cpp
newton.cpp: In function `int newton(const Real&, const int&, const blitz::Array<Real, 2>&, DiffParser&,
bool, const int&, Real&, bool&, const Real*, const Real*, const bool&, blitz::Array<Real, 2>&,
blitz::Array<Real, 2>&, const int&, int&, const Real&, const Real&)':
newton.cpp:148: error: no match for call to
`(DiffParser) (Real&, blitz::_bz_ArrayExpr<blitz::_bz_ArrayExprOp<blitz::FastArrayIterator<Real, 2>,
blitz::FastArrayIterator<Real, 2>, blitz::Add<Real, Real> > >)'
DiffParser.h:25: error: candidates are:
blitz::Array<Real, 2> DiffParser::operator()(const Real&, const blitz::Array<Real, 2>&)
make: *** [newton.o] error 1
For some reason the compiler complains about trying to compute "x+Z(Range::all(),Range(j,j))"
inside the function f. It was possible to resolve this problem by introducing
a temporary variable:
XTEMP = x+Z(Range::all(),Range(j,j));
Z(Range::all(),Range(j,j)) = f(t_c[j],XTEMP);
Modifying the code this way results in a compilation without any errors, but
it seems to me somewhat complicate, since the original code worked well under older versions
of gcc and blitz++.
Any ideas about the reason for that error?
(Unfortunately I'am not that much experienced using blitz++, so sorry for my probably somewhat
stupid question.)
Best regards
Andre