Hi, Eduardo,
Apologies, I should have tried to compile the example before
hastily sending it out.
It needed to say:
region(:rail) row = [0:7];
and
finish ateach (point p : D | ([1:1, row])) {
...
}
The first change adds a dependent type annotation to the "row"
variable that tells the compiler that it's a 1-D 0-based contiguous
region (which is needed for the constructor of a 2-D rectangular
region).
The second change makes [...] a region constructor instead of a
point constructor.
The rest of the code should work.
Igor
"Eduardo Rocha" <erocha.ssa at gmail.com> wrote on 12/11/2007 08:55:35 AM:
> Hi Igor,
>
> I got the follow error when I tried to compile your example:
>
> teste3.x10:4: The argument, row, should be of type region(:rank==1)
instead of
> x10.lang.region.
> teste3.x10:6: Method point(int[]) in x10.lang.point.factory cannot be
called
> with arguments (int(:self=1), x10.lang.region).
>
> The source is:
>
> public class teste3 {
> public static void main(String args[]) {
> region row = [0:7];
> dist D = dist.factory.block([0:1, row]);
> final double[.] darr = new double[D];
> finish ateach (point p : D | ([1, row])) {
> darr[p] = here.id;
> }
> }
> }
>
> Could you help me?
>
> Thanks,
>
> Eduardo
>
> On Dec 11, 2007 11:41 AM, Igor Peshansky <igorp at us.ibm.com> wrote:
> > "Eduardo Rocha" <[EMAIL PROTECTED]> wrote on 12/11/2007 08:26:31
AM:
> >
> >
> > > Hi,
> > >
> > > I would like to know how to iterate over a single row or column of a
> > > X10 matrix. For instance, I have the follow matrix:
> > >
> > > dist D = dist.factory.block([0:1, 0:7]);
> > > final double[.] darr = new double[D];
> > >
> > > and I want to interact over the second row. How can I do that? The
> > > next code interact over the entire matrix. How can I change it to
> > > interact only over the second row:
> > >
> > > finish ateach(point p: darr) {
> > > darr[p] = here.id;
> > > }
> > >
> > > Thanks in advance,
> > > Eduardo
> >
> > Hi, Eduardo,
> >
> > You can use
> >
> > region row = [0:7];
> > dist D = dist.factory.block([0:1, row]);
> > final double[.] darr = new double[D];
> > finish ateach (point p : D | ([1, row])) {
> > darr[p] = here.id;
> > }
> >
> > In other words, you don't have to iterate over the whole distribution.
> > The above is the simplest way I know to get the right points in the
> > right places for a block distribution.
> > Igor
--
Igor Peshansky (note the spelling change!)
IBM T.J. Watson Research Center
XJ: No More Pain for XML's Gain (http://www.research.ibm.com/xj/)
X10: Parallel Productivity and Performance (http://x10.sf.net/)
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
X10-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/x10-users