x10.array
Class DistArray<T>

x10.lang.Object
  extended by x10.array.DistArray<T>
All Implemented Interfaces:
Any

final public class DistArray<T>
extends Object
implements x10.lang. Fun_0_1<Point,T>, Iterable<Point>

Declaration: DistArray[T] extends x10.lang.Object implements (a1:x10.array.Point{self.rank==this(:x10.array.DistArray).dist.region.rank})=>T, x10.lang.Iterable[x10.array.Point{self.rank==this(:x10.array.DistArray).dist.region.rank}].

A distributed array (DistArray) defines a mapping from Points to data values of some type T. The Points in the DistArray's domain are defined by specifying a Region over which the Array is defined. Attempting to access a data value at a Point not included in the Array's Region will result in a ArrayIndexOutOfBoundsException being raised. The array's distribution (Dist) defines a mapping for the Points in the DistArray's region to Places. This defines the Place where the data element for each Point is actually stored. Attempting to access a data element from any other place will result in a BadPlaceException being raised.

The closely related class Array is used to define non-distributed arrays where the data values for the Points in the array's domain are all stored in a single place. Although it is possible to use a DistArray to store data in only a single place by creating a "constant distribution", an Array will significantly outperform a DistArray with a constant distribution.

See Also:
Point, Region, Dist, Array

Nested Class Summary
protected static class DistArray.LocalState<T>
          
 
Field Summary
 Dist dist
          Property.
protected  PlaceLocalHandle<DistArray.LocalState<T>> localHandle
          The place-local backing storage for the DistArray
protected  Boolean cachedRawValid
          Can the backing storage be obtained from cachedRaw?
protected  IndexedMemoryChunk<T> cachedRaw
          Cached pointer to the backing storage
 
Constructor Summary
protected DistArray(DistArray<T> a, Dist d)
          Declaration: this(x10.array.DistArray[T], x10.array.Dist): x10.array.DistArray[T]{self.dist==d}. Create a DistArray that views the same backing data as the argument DistArray using a different distribution.
protected DistArray(Dist d, PlaceLocalHandle<DistArray.LocalState<T>> pls)
          Declaration: this(x10.array.Dist, x10.lang.PlaceLocalHandle[x10.array.DistArray.LocalState[T]]): x10.array.DistArray[T]{self.dist==d}. Create a DistArray from a distribution and a PlaceLocalHandle[LocalState[T]] This constructor is intended for internal use only by operations such as map to enable them to complete with only 1 collective operation instead of 2.
 
Method Summary
 Region region()
          Declaration: region(): x10.array.Region{self.rank==this(:x10.array.DistArray).dist.region.rank}. The region this array is defined over.
 Int rank()
          The rank of this array.
protected  IndexedMemoryChunk<T> raw()
          Method to acquire a pointer to the backing storage for the array's data in the current place.
 Array<T> getLocalPortion()
          Declaration: getLocalPortion(): x10.array.Array[T]{self.rank==this(:x10.array.DistArray).dist.region.rank}.
static
<T> DistArray<T>
make(Dist dist)
          Declaration: make[T](dist:x10.array.Dist){}: x10.array.DistArray[T]{self.dist==dist, self!=null}. Create a zero-initialized distributed array over the argument distribution.
static
<T> DistArray<T>
make(Dist dist, x10.lang. Fun_0_1<Point,T> init)
          Declaration: make[T](dist:x10.array.Dist,init:(a1:x10.array.Point{self.rank==dist.region.rank})=>T): x10.array.DistArray[T]{self.dist==dist, self!=null}. Create a distributed array over the argument distribution whose elements are initialized by executing the given initializer function for each element of the array in the place where the argument Point is mapped.
static
<T> DistArray<T>
make(Dist dist, T init)
          Declaration: make[T](dist:x10.array.Dist,init:T): x10.array.DistArray[T]{self.dist==dist, self!=null}. Create a distributed array over the argument distribution whose elements are initialized to the given initial value.
 T operator()(Point pt)
          Declaration: operator()(pt:x10.array.Point{self.rank==this(:x10.array.DistArray).dist.region.rank}): T. Return the element of this array corresponding to the given point.
 T operator()(Int i0)
          Declaration: operator()(i0:x10.lang.Int){this(:x10.array.DistArray).dist.region.rank==1}: T. Return the element of this array corresponding to the given index.
 T operator()(Int i0, Int i1)
          Declaration: operator()(i0:x10.lang.Int,i1:x10.lang.Int){this(:x10.array.DistArray).dist.region.rank==2}: T. Return the element of this array corresponding to the given pair of indices.
 T operator()(Int i0, Int i1, Int i2)
          Declaration: operator()(i0:x10.lang.Int,i1:x10.lang.Int,i2:x10.lang.Int){this(:x10.array.DistArray).dist.region.rank==3}: T. Return the element of this array corresponding to the given triple of indices.
 T operator()(Int i0, Int i1, Int i2, Int i3)
          Declaration: operator()(i0:x10.lang.Int,i1:x10.lang.Int,i2:x10.lang.Int,i3:x10.lang.Int){this(:x10.array.DistArray).dist.region.rank==4}: T. Return the element of this array corresponding to the given quartet of indices.
 T operator()=(Point pt, T v)
          Declaration: operator()=(pt:x10.array.Point{self.rank==this(:x10.array.DistArray).dist.region.rank},v:T): T. Set the element of this array corresponding to the given point to the given value.
 T operator()=(Int i0, T v)
          Declaration: operator()=(i0:x10.lang.Int,v:T){this(:x10.array.DistArray).dist.region.rank==1}: T. Set the element of this array corresponding to the given index to the given value.
 T operator()=(Int i0, Int i1, T v)
          Declaration: operator()=(i0:x10.lang.Int,i1:x10.lang.Int,v:T){this(:x10.array.DistArray).dist.region.rank==2}: T. Set the element of this array corresponding to the given pair of indices to the given value.
 T operator()=(Int i0, Int i1, Int i2, T v)
          Declaration: operator()=(i0:x10.lang.Int,i1:x10.lang.Int,i2:x10.lang.Int,v:T){this(:x10.array.DistArray).dist.region.rank==3}: T. Set the element of this array corresponding to the given triple of indices to the given value.
 T operator()=(Int i0, Int i1, Int i2, Int i3, T v)
          Declaration: operator()=(i0:x10.lang.Int,i1:x10.lang.Int,i2:x10.lang.Int,i3:x10.lang.Int,v:T){this(:x10.array.DistArray).dist.region.rank==4}: T. Set the element of this array corresponding to the given quartet of indices to the given value.
 DistArray<T> restriction(Dist d)
          Declaration: restriction(d:x10.array.Dist{self.region.rank==this(:x10.array.DistArray).dist.region.rank}): x10.array.DistArray[T]{self.dist.region.rank==this(:x10.array.DistArray).dist.region.rank}. Return a DistArray that access the same backing storage as this array, but only over the Points in the argument distribtion.
 DistArray<T> restriction(Region r)
          Declaration: restriction(r:x10.array.Region{self.rank==this(:x10.array.DistArray).dist.region.rank}): x10.array.DistArray[T]{self.dist.region.rank==this(:x10.array.DistArray).dist.region.rank}. Return a DistArray that is defined over the same distribution and backing storage as this DistArray instance, but is restricted to only allowing access to those points that are contained in the argument region r.
 DistArray<T> restriction(Place p)
          Declaration: restriction(p:x10.lang.Place): x10.array.DistArray[T]{self.dist.region.rank==this(:x10.array.DistArray).dist.region.rank}. Return a DistArray that is defined over the same distribution and backing storage as this DistArray instance, but is restricted to only allowing access to those points that are mapped by the defining distripution to the argument Place.
 DistArray<T> operator|(Region r)
          Declaration: operator|(r:x10.array.Region{self.rank==this(:x10.array.DistArray).dist.region.rank}): x10.array.DistArray[T{r.rank==this(:x10.array.DistArray).dist.region.rank}]{self.dist.region.rank==this(:x10.array.DistArray).dist.region.rank, r.rank==this(:x10.array.DistArray).dist.region.rank}. Return a DistArray that is defined over the same distribution and backing storage as this DistArray instance, but is restricted to only allowing access to those points that are contained in the argument region r.
 DistArray<T> operator|(Place p)
          Declaration: operator|(p:x10.lang.Place): x10.array.DistArray[T]{self.dist.region.rank==this(:x10.array.DistArray).dist.region.rank}. Return a DistArray that is defined over the same distribution and backing storage as this DistArray instance, but is restricted to only allowing access to those points that are mapped by the defining distripution to the argument Place.
 void fill(T v)
          Fill all elements of the array to contain the argument value.
<U> DistArray<U>
map(x10.lang. Fun_0_1<T,U> op)
          Declaration: map[U](op:(a1:T)=>U): x10.array.DistArray[U]{self.dist==this(:x10.array.DistArray).dist}. Map the function onto the elements of this array constructing a new result array such that for all points p in this.dist, result(p) == op(this(p)).
<U> DistArray<U>
map(DistArray<U> dst, x10.lang. Fun_0_1<T,U> op)
          Declaration: map[U](dst:x10.array.DistArray[U]{self.dist==this(:x10.array.DistArray).dist},op:(a1:T)=>U): x10.array.DistArray[U]{self==dst, dst.dist==this(:x10.array.DistArray).dist}. Map the given function onto the elements of this array storing the results in the dst array such that for all points p in this.dist, dst(p) == op(this(p)).
<U> DistArray<U>
map(DistArray<U> dst, Region filter, x10.lang. Fun_0_1<T,U> op)
          Declaration: map[U](dst:x10.array.DistArray[U]{self.dist==this(:x10.array.DistArray).dist},filter:x10.array.Region{self.rank==this(:x10.array.DistArray).dist.region.rank},op:(a1:T)=>U): x10.array.DistArray[U]{self==dst, dst.dist==this(:x10.array.DistArray).dist}. Map the given function onto the elements of this array storing the results in the dst array for the subset of points included in the filter region such that for all points p in filter, dst(p) == op(this(p)).
<S,U> DistArray<S>
map(DistArray<U> src, x10.lang. Fun_0_2<T,U,S> op)
          Declaration: map[S,U](src:x10.array.DistArray[U]{self.dist==this(:x10.array.DistArray).dist},op:(a1:T, a2:U)=>S): x10.array.DistArray[S]{self.dist==this(:x10.array.DistArray).dist}. Map the given function onto the elements of this array and the other src array, storing the results in a new result array such that for all points p in this.dist, result(p) == op(this(p), src(p)).
<S,U> DistArray<S>
map(DistArray<S> dst, DistArray<U> src, x10.lang. Fun_0_2<T,U,S> op)
          Declaration: map[S,U](dst:x10.array.DistArray[S]{self.dist==this(:x10.array.DistArray).dist},src:x10.array.DistArray[U]{self.dist==this(:x10.array.DistArray).dist},op:(a1:T, a2:U)=>S): x10.array.DistArray[S]{self.dist==this(:x10.array.DistArray).dist}. Map the given function onto the elements of this array and the other src array, storing the results in the given dst array such that for all points p in this.dist, dst(p) == op(this(p), src(p)).
<S,U> DistArray<S>
map(DistArray<S> dst, DistArray<U> src, Region filter, x10.lang. Fun_0_2<T,U,S> op)
          Declaration: map[S,U](dst:x10.array.DistArray[S]{self.dist==this(:x10.array.DistArray).dist},src:x10.array.DistArray[U]{self.dist==this(:x10.array.DistArray).dist},filter:x10.array.Region{self.rank==this(:x10.array.DistArray).dist.region.rank},op:(a1:T, a2:U)=>S): x10.array.DistArray[S]{self.dist==this(:x10.array.DistArray).dist}. Map the given function onto the elements of this array and the other src array, storing the results in the given dst array such that for all points in the filter region p in filter, dst(p) == op(this(p), src(p)).
 T reduce(x10.lang. Fun_0_2<T,T,T> op, T unit)
          Declaration: reduce(op:(a1:T, a2:T)=>T,unit:T): T. Reduce this array using the given function and the given initial value.
<U> U
reduce(x10.lang. Fun_0_2<U,T,U> lop, x10.lang. Fun_0_2<U,U,U> gop, U unit)
          Declaration: reduce[U](lop:(a1:U, a2:T)=>U,gop:(a1:U, a2:U)=>U,unit:U): U. Reduce this array using the given function and the given initial value.
 String toString()
          
 Iterator<Point> iterator()
          Declaration: iterator(): x10.lang.Iterator[x10.array.Point{self.rank==this(:x10.array.DistArray).dist.region.rank}]. Return an iterator over the points in the region of this array.
 DistArray<T> x10$array$DistArray$$x10$array$DistArray$this()
          Declaration: x10$array$DistArray$$x10$array$DistArray$this(): x10.array.DistArray[T]{self==this(:x10.array.DistArray)}. A distributed array (DistArray) defines a mapping from Points to data values of some type T.
 
Methods inherited from class x10.lang.Object
equals, hashCode, toString, typeName, x10$lang$Object$$x10$lang$Object$this
 
Methods inherited from interface x10.lang. Fun_0_1
operator()
 
Methods inherited from interface x10.lang.Iterable
iterator
 
Methods inherited from interface x10.lang.Any
toString, typeName, equals, hashCode
 

Field Detail

dist

public final Dist dist
Property.


localHandle

protected final PlaceLocalHandle<DistArray.LocalState<T>> localHandle
The place-local backing storage for the DistArray


cachedRawValid

protected Boolean cachedRawValid
Can the backing storage be obtained from cachedRaw?


cachedRaw

protected IndexedMemoryChunk<T> cachedRaw
Cached pointer to the backing storage

Constructor Detail

DistArray

protected DistArray(DistArray<T> a,
                    Dist d)
Declaration: this(x10.array.DistArray[T], x10.array.Dist): x10.array.DistArray[T]{self.dist==d}.
Create a DistArray that views the same backing data
as the argument DistArray using a different distribution.

An unchecked invariant for this to be correct is that for every point p in d, d.offset(p) == a.dist.offset(p). This invariant is too expensive to be checked dynamically, so it simply must be respected by the DistArray code that calls this constructor.


DistArray

protected DistArray(Dist d,
                    PlaceLocalHandle<DistArray.LocalState<T>> pls)
Declaration: this(x10.array.Dist, x10.lang.PlaceLocalHandle[x10.array.DistArray.LocalState[T]]): x10.array.DistArray[T]{self.dist==d}.
Create a DistArray from a distribution and a PlaceLocalHandle[LocalState[T]]
This constructor is intended for internal use only by operations such as
map to enable them to complete with only 1 collective operation instead of 2.

Method Detail

region

public final Region region()
Declaration: region(): x10.array.Region{self.rank==this(:x10.array.DistArray).dist.region.rank}.
The region this array is defined over.


rank

public final Int rank()
The rank of this array.


raw

protected final IndexedMemoryChunk<T> raw()
Method to acquire a pointer to the backing storage for the array's data in the current place.


getLocalPortion

public Array<T> getLocalPortion()
Declaration: getLocalPortion(): x10.array.Array[T]{self.rank==this(:x10.array.DistArray).dist.region.rank}.

Returns:
the portion of the DistArray that is stored locally at the current place, as an Array

make

public static <T> DistArray<T> make(Dist dist)
Declaration: make[T](dist:x10.array.Dist){}: x10.array.DistArray[T]{self.dist==dist, self!=null}.
Create a zero-initialized distributed array over the argument distribution.

Parameters:
dist - the given distribution
Returns:
the newly created DistArray

make

public static <T> DistArray<T> make(Dist dist,
                                    x10.lang. Fun_0_1<Point,T> init)
Declaration: make[T](dist:x10.array.Dist,init:(a1:x10.array.Point{self.rank==dist.region.rank})=>T): x10.array.DistArray[T]{self.dist==dist, self!=null}.
Create a distributed array over the argument distribution whose elements
are initialized by executing the given initializer function for each
element of the array in the place where the argument Point is mapped.
The function will be evaluated exactly once for each point
in dist in an arbitrary order to compute the initial value for each array element.

Within each place, it is unspecified whether the function evaluations will be done sequentially by a single activity for each point or concurrently for disjoint sets of points by one or more child activities.

Parameters:
dist - the given distribution
init - the initializer function
Returns:
the newly created DistArray
See Also:
make[T](Dist)

make

public static <T> DistArray<T> make(Dist dist,
                                    T init)
Declaration: make[T](dist:x10.array.Dist,init:T): x10.array.DistArray[T]{self.dist==dist, self!=null}.
Create a distributed array over the argument distribution whose elements
are initialized to the given initial value.

Parameters:
dist - the given distribution
init - the initial value
Returns:
the newly created DistArray
See Also:
make[T](Dist)

operator()

public final T operator()(Point pt)
Declaration: operator()(pt:x10.array.Point{self.rank==this(:x10.array.DistArray).dist.region.rank}): T.
Return the element of this array corresponding to the given point.
The rank of the given point has to be the same as the rank of this array.
If the distribution does not map the given Point to the current place,
then a BadPlaceException will be raised.

Parameters:
pt - the given point
Returns:
the element of this array corresponding to the given point.
See Also:
operator(Int), set(T, Point)

operator()

public final T operator()(Int i0)
Declaration: operator()(i0:x10.lang.Int){this(:x10.array.DistArray).dist.region.rank==1}: T.
Return the element of this array corresponding to the given index.
Only applies to one-dimensional arrays.
Functionally equivalent to indexing the array via a one-dimensional point.
If the distribution does not map the specified index to the current place,
then a BadPlaceException will be raised.

Parameters:
i0 - the given index in the first dimension
Returns:
the element of this array corresponding to the given index.
See Also:
operator(Point), set(T, Int)

operator()

public final T operator()(Int i0,
                          Int i1)
Declaration: operator()(i0:x10.lang.Int,i1:x10.lang.Int){this(:x10.array.DistArray).dist.region.rank==2}: T.
Return the element of this array corresponding to the given pair of indices.
Only applies to two-dimensional arrays.
Functionally equivalent to indexing the array via a two-dimensional point.
If the distribution does not map the specified index to the current place,
then a BadPlaceException will be raised.

Parameters:
i0 - the given index in the first dimension
i1 - the given index in the second dimension
Returns:
the element of this array corresponding to the given pair of indices.
See Also:
operator(Point), set(T, Int, Int)

operator()

public final T operator()(Int i0,
                          Int i1,
                          Int i2)
Declaration: operator()(i0:x10.lang.Int,i1:x10.lang.Int,i2:x10.lang.Int){this(:x10.array.DistArray).dist.region.rank==3}: T.
Return the element of this array corresponding to the given triple of indices.
Only applies to three-dimensional arrays.
Functionally equivalent to indexing the array via a three-dimensional point.
If the distribution does not map the specified index to the current place,
then a BadPlaceException will be raised.

Parameters:
i0 - the given index in the first dimension
i1 - the given index in the second dimension
i2 - the given index in the third dimension
Returns:
the element of this array corresponding to the given triple of indices.
See Also:
operator(Point), set(T, Int, Int, Int)

operator()

public final T operator()(Int i0,
                          Int i1,
                          Int i2,
                          Int i3)
Declaration: operator()(i0:x10.lang.Int,i1:x10.lang.Int,i2:x10.lang.Int,i3:x10.lang.Int){this(:x10.array.DistArray).dist.region.rank==4}: T.
Return the element of this array corresponding to the given quartet of indices.
Only applies to four-dimensional arrays.
Functionally equivalent to indexing the array via a four-dimensional point.
If the distribution does not map the specified index to the current place,
then a BadPlaceException will be raised.

Parameters:
i0 - the given index in the first dimension
i1 - the given index in the second dimension
i2 - the given index in the third dimension
i3 - the given index in the fourth dimension
Returns:
the element of this array corresponding to the given quartet of indices.
See Also:
operator(Point), set(T, Int, Int, Int, Int)

operator()=

public final T operator()=(Point pt,
                           T v)
Declaration: operator()=(pt:x10.array.Point{self.rank==this(:x10.array.DistArray).dist.region.rank},v:T): T.
Set the element of this array corresponding to the given point to the given value.
Return the new value of the element.
The rank of the given point has to be the same as the rank of this array.
If the distribution does not map the specified index to the current place,
then a BadPlaceException will be raised.

Parameters:
v - the given value
pt - the given point
Returns:
the new value of the element of this array corresponding to the given point.
See Also:
operator(Point), set(T, Int)

operator()=

public final T operator()=(Int i0,
                           T v)
Declaration: operator()=(i0:x10.lang.Int,v:T){this(:x10.array.DistArray).dist.region.rank==1}: T.
Set the element of this array corresponding to the given index to the given value.
Return the new value of the element.
Only applies to one-dimensional arrays.
Functionally equivalent to setting the array via a one-dimensional point.
If the distribution does not map the specified index to the current place,
then a BadPlaceException will be raised.

Parameters:
v - the given value
i0 - the given index in the first dimension
Returns:
the new value of the element of this array corresponding to the given index.
See Also:
operator(Int), set(T, Point)

operator()=

public final T operator()=(Int i0,
                           Int i1,
                           T v)
Declaration: operator()=(i0:x10.lang.Int,i1:x10.lang.Int,v:T){this(:x10.array.DistArray).dist.region.rank==2}: T.
Set the element of this array corresponding to the given pair of indices to the given value.
Return the new value of the element.
Only applies to two-dimensional arrays.
Functionally equivalent to setting the array via a two-dimensional point.
If the distribution does not map the specified index to the current place,
then a BadPlaceException will be raised.

Parameters:
v - the given value
i0 - the given index in the first dimension
i1 - the given index in the second dimension
Returns:
the new value of the element of this array corresponding to the given pair of indices.
See Also:
operator(Int, Int), set(T, Point)

operator()=

public final T operator()=(Int i0,
                           Int i1,
                           Int i2,
                           T v)
Declaration: operator()=(i0:x10.lang.Int,i1:x10.lang.Int,i2:x10.lang.Int,v:T){this(:x10.array.DistArray).dist.region.rank==3}: T.
Set the element of this array corresponding to the given triple of indices to the given value.
Return the new value of the element.
Only applies to three-dimensional arrays.
Functionally equivalent to setting the array via a three-dimensional point.
If the distribution does not map the specified index to the current place,
then a BadPlaceException will be raised.

Parameters:
v - the given value
i0 - the given index in the first dimension
i1 - the given index in the second dimension
i2 - the given index in the third dimension
Returns:
the new value of the element of this array corresponding to the given triple of indices.
See Also:
operator(Int, Int, Int), set(T, Point)

operator()=

public final T operator()=(Int i0,
                           Int i1,
                           Int i2,
                           Int i3,
                           T v)
Declaration: operator()=(i0:x10.lang.Int,i1:x10.lang.Int,i2:x10.lang.Int,i3:x10.lang.Int,v:T){this(:x10.array.DistArray).dist.region.rank==4}: T.
Set the element of this array corresponding to the given quartet of indices to the given value.
Return the new value of the element.
Only applies to four-dimensional arrays.
Functionally equivalent to setting the array via a four-dimensional point.
If the distribution does not map the specified index to the current place,
then a BadPlaceException will be raised.

Parameters:
v - the given value
i0 - the given index in the first dimension
i1 - the given index in the second dimension
i2 - the given index in the third dimension
i3 - the given index in the fourth dimension
Returns:
the new value of the element of this array corresponding to the given quartet of indices.
See Also:
operator(Int, Int, Int, Int), set(T, Point)

restriction

public DistArray<T> restriction(Dist d)
Declaration: restriction(d:x10.array.Dist{self.region.rank==this(:x10.array.DistArray).dist.region.rank}): x10.array.DistArray[T]{self.dist.region.rank==this(:x10.array.DistArray).dist.region.rank}.
Return a DistArray that access the same backing storage
as this array, but only over the Points in the argument
distribtion.

For this operation to be semantically sound, it should be the case that for every point p in d, this.dist.offset(p) == d.offset. This invariant is not statically or dynamically checked; but must be ensured by the caller's of this API.

Parameters:
d - the Dist to use as the restriction

restriction

public DistArray<T> restriction(Region r)
Declaration: restriction(r:x10.array.Region{self.rank==this(:x10.array.DistArray).dist.region.rank}): x10.array.DistArray[T]{self.dist.region.rank==this(:x10.array.DistArray).dist.region.rank}.
Return a DistArray that is defined over the same distribution
and backing storage as this DistArray instance, but is
restricted to only allowing access to those points that are
contained in the argument region r.

Parameters:
r - the Region to which to restrict the array

restriction

public DistArray<T> restriction(Place p)
Declaration: restriction(p:x10.lang.Place): x10.array.DistArray[T]{self.dist.region.rank==this(:x10.array.DistArray).dist.region.rank}.
Return a DistArray that is defined over the same distribution
and backing storage as this DistArray instance, but is
restricted to only allowing access to those points that are
mapped by the defining distripution to the argument Place.

Parameters:
p - the Place to which to restrict the array

operator|

public DistArray<T> operator|(Region r)
Declaration: operator|(r:x10.array.Region{self.rank==this(:x10.array.DistArray).dist.region.rank}): x10.array.DistArray[T{r.rank==this(:x10.array.DistArray).dist.region.rank}]{self.dist.region.rank==this(:x10.array.DistArray).dist.region.rank, r.rank==this(:x10.array.DistArray).dist.region.rank}.
Return a DistArray that is defined over the same distribution
and backing storage as this DistArray instance, but is
restricted to only allowing access to those points that are
contained in the argument region r.

Parameters:
r - the Region to which to restrict the array

operator|

public DistArray<T> operator|(Place p)
Declaration: operator|(p:x10.lang.Place): x10.array.DistArray[T]{self.dist.region.rank==this(:x10.array.DistArray).dist.region.rank}.
Return a DistArray that is defined over the same distribution
and backing storage as this DistArray instance, but is
restricted to only allowing access to those points that are
mapped by the defining distripution to the argument Place.

Parameters:
p - the Place to which to restrict the array

fill

public void fill(T v)
Fill all elements of the array to contain the argument value.

Parameters:
v - the value with which to fill the array

map

public final <U> DistArray<U> map(x10.lang. Fun_0_1<T,U> op)
Declaration: map[U](op:(a1:T)=>U): x10.array.DistArray[U]{self.dist==this(:x10.array.DistArray).dist}.
Map the function onto the elements of this array
constructing a new result array such that for all points p
in this.dist,
result(p) == op(this(p)).

Parameters:
op - the function to apply to each element of the array
Returns:
a new array with the same distribution as this array where result(p) == op(this(p))

map

public final <U> DistArray<U> map(DistArray<U> dst,
                                  x10.lang. Fun_0_1<T,U> op)
Declaration: map[U](dst:x10.array.DistArray[U]{self.dist==this(:x10.array.DistArray).dist},op:(a1:T)=>U): x10.array.DistArray[U]{self==dst, dst.dist==this(:x10.array.DistArray).dist}.
Map the given function onto the elements of this array
storing the results in the dst array such that for all points p
in this.dist,
dst(p) == op(this(p)).

Parameters:
dst - the destination array for the results of the map operation
op - the function to apply to each element of the array
Returns:
dst after applying the map operation.

map

public final <U> DistArray<U> map(DistArray<U> dst,
                                  Region filter,
                                  x10.lang. Fun_0_1<T,U> op)
Declaration: map[U](dst:x10.array.DistArray[U]{self.dist==this(:x10.array.DistArray).dist},filter:x10.array.Region{self.rank==this(:x10.array.DistArray).dist.region.rank},op:(a1:T)=>U): x10.array.DistArray[U]{self==dst, dst.dist==this(:x10.array.DistArray).dist}.
Map the given function onto the elements of this array
storing the results in the dst array for the subset of points included
in the filter region such that for all points p
in filter,
dst(p) == op(this(p)).

Parameters:
dst - the destination array for the results of the map operation
op - the function to apply to each element of the array
filter - the region to use as a filter on the map operation
Returns:
dst after applying the map operation.

map

public final <S,U> DistArray<S> map(DistArray<U> src,
                                    x10.lang. Fun_0_2<T,U,S> op)
Declaration: map[S,U](src:x10.array.DistArray[U]{self.dist==this(:x10.array.DistArray).dist},op:(a1:T, a2:U)=>S): x10.array.DistArray[S]{self.dist==this(:x10.array.DistArray).dist}.
Map the given function onto the elements of this array
and the other src array, storing the results in a new result array
such that for all points p in this.dist,
result(p) == op(this(p), src(p)).

Parameters:
src - the other src array
op - the function to apply to each element of the array
Returns:
a new array with the same distribution as this array containing the result of the map

map

public final <S,U> DistArray<S> map(DistArray<S> dst,
                                    DistArray<U> src,
                                    x10.lang. Fun_0_2<T,U,S> op)
Declaration: map[S,U](dst:x10.array.DistArray[S]{self.dist==this(:x10.array.DistArray).dist},src:x10.array.DistArray[U]{self.dist==this(:x10.array.DistArray).dist},op:(a1:T, a2:U)=>S): x10.array.DistArray[S]{self.dist==this(:x10.array.DistArray).dist}.
Map the given function onto the elements of this array
and the other src array, storing the results in the given dst array
such that for all points p in this.dist,
dst(p) == op(this(p), src(p)).

Parameters:
dst - the destination array for the map operation
src - the second source array for the map operation
op - the function to apply to each element of the array
Returns:
destination after applying the map operation.

map

public final <S,U> DistArray<S> map(DistArray<S> dst,
                                    DistArray<U> src,
                                    Region filter,
                                    x10.lang. Fun_0_2<T,U,S> op)
Declaration: map[S,U](dst:x10.array.DistArray[S]{self.dist==this(:x10.array.DistArray).dist},src:x10.array.DistArray[U]{self.dist==this(:x10.array.DistArray).dist},filter:x10.array.Region{self.rank==this(:x10.array.DistArray).dist.region.rank},op:(a1:T, a2:U)=>S): x10.array.DistArray[S]{self.dist==this(:x10.array.DistArray).dist}.
Map the given function onto the elements of this array
and the other src array, storing the results in the given dst array
such that for all points in the filter region p in filter,
dst(p) == op(this(p), src(p)).

Parameters:
dst - the destination array for the map operation
src - the second source array for the map operation
op - the function to apply to each element of the array
filter - the region to use to select the subset of points to include in the map
Returns:
destination after applying the map operation.

reduce

public final T reduce(x10.lang. Fun_0_2<T,T,T> op,
                      T unit)
Declaration: reduce(op:(a1:T, a2:T)=>T,unit:T): T.
Reduce this array using the given function and the given initial value.
Each element of the array will be given as an argument to the reduction
function exactly once, but in an arbitrary order.  The reduction function
may be applied concurrently to implement a parallel reduction.

Parameters:
op - the reduction function
unit - the given initial value
Returns:
the final result of the reduction.
See Also:
map((T)=>S), reduce(U,T)=>U,(U,U)=>U,U)

reduce

public final <U> U reduce(x10.lang. Fun_0_2<U,T,U> lop,
                          x10.lang. Fun_0_2<U,U,U> gop,
                          U unit)
Declaration: reduce[U](lop:(a1:U, a2:T)=>U,gop:(a1:U, a2:U)=>U,unit:U): U.
Reduce this array using the given function and the given initial value.
Each element of the array will be given as an argument to the reduction
function exactly once, but in an arbitrary order.  The reduction function
may be applied concurrently to implement a parallel reduction.

Parameters:
lop - the local reduction function
gop - the global reduction function
unit - the given initial value
Returns:
the final result of the reduction.
See Also:
map((T)=>S)

toString

public String toString()


iterator

public Iterator<Point> iterator()
Declaration: iterator(): x10.lang.Iterator[x10.array.Point{self.rank==this(:x10.array.DistArray).dist.region.rank}].
Return an iterator over the points in the region of this array.

Returns:
an iterator over the points in the region of this array.
See Also:
x10.lang.Iterable[T]#iterator()

x10$array$DistArray$$x10$array$DistArray$this

public final DistArray<T> x10$array$DistArray$$x10$array$DistArray$this()
Declaration: x10$array$DistArray$$x10$array$DistArray$this(): x10.array.DistArray[T]{self==this(:x10.array.DistArray)}.

A distributed array (DistArray) defines a mapping from Points to data values of some type T. The Points in the DistArray's domain are defined by specifying a Region over which the Array is defined. Attempting to access a data value at a Point not included in the Array's Region will result in a ArrayIndexOutOfBoundsException being raised. The array's distribution (Dist) defines a mapping for the Points in the DistArray's region to Places. This defines the Place where the data element for each Point is actually stored. Attempting to access a data element from any other place will result in a BadPlaceException being raised.

The closely related class Array is used to define non-distributed arrays where the data values for the Points in the array's domain are all stored in a single place. Although it is possible to use a DistArray to store data in only a single place by creating a "constant distribution", an Array will significantly outperform a DistArray with a constant distribution.

See Also:
Point, Region, Dist, Array