freepooma-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pooma-dev] [Q]: How to fill an array with random values?


From: Richard Guenther
Subject: Re: [pooma-dev] [Q]: How to fill an array with random values?
Date: Mon, 3 Feb 2003 10:16:56 +0100 (CET)

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 <address@hidden>
WWW: http://www.tat.physik.uni-tuebingen.de/~rguenth/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]