[pooma-dev] [Q]: How to fill an array with random values?
Richard Guenther
rguenth at tat.physik.uni-tuebingen.de
Mon Feb 3 09:16:56 UTC 2003
On Sun, 2 Feb 2003, Gasper Tkacik wrote:
> I browsed through the manuals and the best I could come up with was to
> define a function Random, overload its () operator, create a
> UserFunction<Random> rf and apply it to the array A like this
>
> A = rf(A);
>
> However, I do not know if this is a good solution. Random does not need
> any parameter, but I was forced to put in something to conform to the ()
> syntax, so I just put in the same A array. Is there a more elegant
> solution? I hope the compiler does not generate a temporary copy in the
> above example?
Its ok to do the above, the temporary copy the compiler introduces is only
for metadata. If you want to avoid the syntactically confusing passing of
A you may want to look at PatchFunction which can do something like
Array A;
PatchFunction<FillRandom>()(A);
> BTW: Is this list appropriate for such questions or are there only
> development issues discussed? If the later, I apologize.
I think the list is to be shared between developers and users.
Richard.
--
Richard Guenther <richard.guenther at uni-tuebingen.de>
WWW: http://www.tat.physik.uni-tuebingen.de/~rguenth/
More information about the pooma-dev
mailing list