Blitz logo

Blitz Support :

From: Breeveld, Eddie (Reigate) (Eddie.Breeveld_at_[hidden])
Date: 2005-04-01 10:39:57


Dear Blitz++ Support,

We use a lot of functions that take Blitz++ arrays, and these work fine
provided we do not supply an array expression as an argument. For
instance, if we have a function "Afun", and a Blitz++ array "arrayArg",
our functions work well with

result = Afun (arrayArg);

Here "Afun" is defined as a templated function to take Blitz arrays of
any rank and shape:

template<typename T, int N> inline
T Afun (const Array<T,N> &arrayArg)
{
// some function that returns (in this case) a scalar of type T
...
};

Unfortunately this does not work with expressions as arguments. How do I
define a function that will work with both arrays directly (as above)
and expressions such as

result = Afun (arrayArg + 6);
result = Afun (arrayArg1 * arrayArg2);
result = Afun (arrayArg1 * Bfun(arrayArg2 * arrayArg3) + 11.56);

I can set up temporary arrays to hold the intermediate results, but this
is very awkward in our code, as some of it is automatically generated. I
can also cast the result of the expression back into an array, but again
this works but is awkward. I would much rather have one or more
templated functions that can take arrays directly, as well as
expressions involving arrays.

Thanks in advance for any suggestions,
Eddie

____________________
Edward Breeveld
eSolutions
Watson Wyatt LLP
Watson House, London Road,
Reigate, Surrey, RH2 9PQ, UK
Tel. +44 (0)1737 274151
Fax. +44 (0)1737 241496
www.watsonwyatt.com

_________________________________________________________________

Notice of Confidentiality

This transmission contains information that may be confidential and that may also be privileged. Unless you are the intended recipient of the message (or authorised to receive it for the intended recipient) you may not copy, forward, or otherwise use it, or disclose it or its contents to anyone else. If you have received this transmission in error please notify us immediately and delete it from your system. Please contact the sender if you have any problems with this email.

In the UK, Watson Wyatt LLP is authorised and regulated by the Financial Services Authority and is a member of the General Insurance Standards Council. The services of Watson Wyatt in Ireland are provided by Watson Wyatt LLP, a limited liability partnership incorporated under English Law, with the exception of services which are provided as a Multi-Agency Intermediary, which for regulatory purposes, are provided by Watson Wyatt Partners, which is regulated by the Irish Financial Services Regulatory Authority, on behalf of Watson Wyatt LLP.

_________________________________________________________________