To follow up on my previous response:

* (as I mentioned) the correct way to resize an array is to update its 
domain variable, in this example:

   lifelinesDomain = 0..(p.z-1);

* Currently our compiler also allows you to update lifelines.domain 
directly. This is a bug, do not rely on it.

* 1-D arrays also support vector operations. See the following file for 
examples and limitations:

   $CHPL_HOME/examples/primers/arrayVectorOps.chpl

Vass

On 01/29/15 15:04, Marco Postigo wrote:
> Hello,
> I have some questions about the randomFill(x:[]) function and array 
> reallocation.
> First of all I need to use the Random Module and I'm not sure what the 
> interval
> is of the numbers returned... I've found in a paper where it was stated that 
> it
> returns values between 0 and 1... inclusive? exclusive?
> Is it as in most other languages [0, 1) or are both incluse ( -> [0, 1] )?
> Second is the reallocation of arrays... I haven't found any examples so I've
> tested a bit around and only got it worked with using a domain and reassigning
> it. Is this the correct way or is there another "nicer" solution?
> code snippet:
>     9    /** Domain of lifeline buddies array */
>    10    var lifelinesDomain : domain(rank=1) = 0..0;
>    11    /** Lifeline buddies */
>    12    var lifelines : [lifelinesDomain] uint;
> ...
> 55     lifelinesDomain = 0..(p.z-1); // reallocation in constructor
> Sorry if this questions are duplicates or if I've just overlooked the solution
> in your spec / docs.
> Kind regards,
> Marco


------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Chapel-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-users

Reply via email to