On Thursday 03 June 2010, Igor Peshansky wrote:
> Christoph Pospiech <[email protected]> wrote on 06/03/2010
>
> > On Wednesday 02 June 2010 11:41:04 pm Yoav Zibin wrote:
> > > The definition of reduce is:
> > > def reduce(op:(T,T)=>T, unit:T):T
> > >
> > > You pass it a function with a guard:
> > > ArrayD_add(s1:Array[Double],
> > > s2:Array[Double])
> > > *{s1.region() == s2.region(), s1.rail(), s2.rail()}*:
> > > Array[Double]
> > >
> > > remove the guard, and it should fit.
> > >
> >
> >
> > Is there a type cast for function types ? Something along the lines
> > ArrayD_add as op:(T,T)=>T ?
> >
> > Otherwise, I have to find a guard-free implementation for ArrayD_add...
>
> You can always wrap it in a closure that casts appropriately, namely:
>
> (x:Array[Double],y:Array[Double])=>ArrayD_add(x as Array[Double]{rail}, y
> as Array[Double]{rail&®ion==x.region})
>
> HTH,
> Igor
>
Igor,
thank you for your helpful answer.
I was bold enough to plug your suggestion directly into the call to reduce,
namely:
v = v_dst.reduce(
(x:Array[Double],y:Array[Double])
=>ArrayD_add(x as Array[Double]{rail},
y as
Array[Double]{rail&®ion==x.region}),
v);
X10DT complains as follows.
Multiple messages at this line.
-Method reduce((x:x10.lang.Double, y:x10.lang.Double)=> T, T) in
x10.array.DistArray
[x10.array.Array[x10.lang.Double]{self.region.rank==1}]
{self==matmul#this.v_dst,
matmul#this.v_dst.dist.region.rank==1} cannot be called with arguments
((x:x10.lang.Double,
y:x10.lang.Double)=> x10.array.Array[x10.lang.Double],
x10.array.Array[x10.lang.Double]
{self==matmul#this.v, matmul#this.v.region.rank==1}); Invalid
Parameter.
expected type:
(x:x10.lang.Double, y:x10.lang.Double)=>
x10.array.Array[x10.lang.Double]
{self.region.rank==1}
found: (x:x10.lang.Double, y:x10.lang.Double)=>
x10.array.Array[x10.lang.Double]
-Method reduce((x:x10.lang.Double, y:x10.lang.Double)=> T, T) in
x10.array.DistArray
[x10.array.Array[x10.lang.Double]{self.region.rank==1}]
{self==matmul#this.v_dst,
matmul#this.v_dst.dist.region.rank==1} cannot be called with arguments
((x:x10.lang.Double,
y:x10.lang.Double)=> x10.array.Array[x10.lang.Double],
x10.array.Array[x10.lang.Double]
{self==matmul#this.v, matmul#this.v.region.rank==1}); Invalid
Parameter.
expected type:
(x:x10.lang.Double, y:x10.lang.Double)=>
x10.array.Array[x10.lang.Double]
{self.region.rank==1}
found: (x:x10.lang.Double, y:x10.lang.Double)=>
x10.array.Array[x10.lang.Double]
Am I correct that I disposed too many guards now, i.e. {self.region.rank==1}
is missing ? And why does it expect
x:x10.lang.Double, y:x10.lang.Double) => [...]
rather than
x:Array[Double],y:Array[Double]) => [...]
?
--
Mit freundlichen Grüßen / Kind regards
Dr. Christoph Pospiech
High Performance & Parallel Computing
Phone: +49-351 86269826
Mobile: +49-171-765 5871
E-Mail: [email protected]
-------------------------------------
IBM Deutschland GmbH
Vorsitzender des Aufsichtsrats: Erich Clementi
Geschäftsführung: Martin Jetter (Vorsitzender),
Reinhard Reschke, Christoph Grandpierre,
Klaus Lintelmann, Michael Diemer, Martina Koederitz
Sitz der Gesellschaft: Ehningen / Registergericht: Amtsgericht Stuttgart, HRB
14562 WEEE-Reg.-Nr. DE 99369940
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
X10-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/x10-users