[Q]: How to fill an array with random values?
Gasper Tkacik
gtkacik at Princeton.EDU
Mon Feb 3 04:43:18 UTC 2003
Hello!
I am a first year graduate student at Princeton and am considering using
Pooma for cosmological simulations. I have just downloaded and compiled
it sucessfully and ran some very simple examples. I have the following
question: how do I efficiently (without explicit looping) fill the array
with random values?
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?
BTW: Is this list appropriate for such questions or are there only
development issues discussed? If the later, I apologize.
Best regards, Gasper.
More information about the pooma-dev
mailing list