From: Patrik J. <pa...@uc...> - 2006-02-23 19:37:26
|
Faheem Mitha wrote: > > Hi, > > blitz::Array supports multiplication by a scalar, but does not seem to > support syntax like > > double a, b; > blitz::Array<double, 3> X, Y; > // initialize a, b, X, Y. > blitz::Array<double, 3> Z = a*X + b*Y > > What is the most compact/efficient way of doing this? Is my only option > to do something like > > X *= a; > Y *= b; > Z = X + Y; > > ? Thanks in advance for any suggestions. For some reason, there is no implicit conversion from the array expressions to arrays. Don't know why that's the case, but the solution is to be more explicit: blitz::Array<double, 3> Z = blitz::Array<double,3>(a*X + b*Y); /Patrik |