Re: [X10-users] Defining an Array add

2010-06-10 Thread Igor Peshansky
Christoph Pospiech wrote on 06/10/2010 12:06:58 PM: > On Thursday 10 June 2010, Igor Peshansky wrote: > > Christoph Pospiech wrote on 06/10/2010 > > 04:14:14 AM: > > [...] > > > But running this code, I am getting the error message below. > > > Presumably my type casts are too bold. > > > I

Re: [X10-users] Defining an Array add

2010-06-10 Thread Christoph Pospiech
-- Mit freundlichen Grüßen / Kind regards Dr. Christoph Pospiech High Performance & Parallel Computing Phone: +49-351 86269826 Mobile: +49-171-765 5871 E-Mail: christoph.pospi...@de.ibm.com - IBM Deutschland GmbH Vorsitzender des Aufsichtsrats: Erich Clement

Re: [X10-users] Defining an Array add

2010-06-10 Thread Igor Peshansky
Christoph Pospiech wrote on 06/10/2010 04:14:14 AM: > On Monday 07 June 2010, Igor Peshansky wrote: > > So, since reduce() expects a function with type (T,T)=>T, your closure > > must have the type > > "(Array[Double](1),Array[Double](1))=>Array[Double](1)". > > Maybe that will placate the type

Re: [X10-users] Defining an Array add

2010-06-10 Thread Christoph Pospiech
On Monday 07 June 2010, Igor Peshansky wrote: > So, since reduce() expects a function with type (T,T)=>T, your closure > must have the type > "(Array[Double](1),Array[Double](1))=>Array[Double](1)". > Maybe that will placate the typechecker. > Igor > Heureka ! The following closure compi

Re: [X10-users] Defining an Array add

2010-06-08 Thread Christoph Pospiech
On Monday 07 June 2010, Christoph Pospiech wrote: > On Monday 07 June 2010, Igor Peshansky wrote: > > > And why does it expect > > > > > > x:x10.lang.Double, y:x10.lang.Double) => [...] > > > > > > rather than > > > > > > x:Array[Double],y:Array[Double]) => [...] > > > > > > ? > > > >

Re: [X10-users] Defining an Array add

2010-06-07 Thread Igor Peshansky
Christoph Pospiech wrote on 06/07/2010 04:41:38 PM: > On Monday 07 June 2010, Igor Peshansky wrote: > > > And why does it expect > > > > > > x:x10.lang.Double, y:x10.lang.Double) => [...] > > > > > > rather than > > > > > > x:Array[Double],y:Array[Double]) => [...] > > > > > > ? > >

Re: [X10-users] Defining an Array add

2010-06-07 Thread Christoph Pospiech
On Monday 07 June 2010, Igor Peshansky wrote: > > And why does it expect > > > > x:x10.lang.Double, y:x10.lang.Double) => [...] > > > > rather than > > > > x:Array[Double],y:Array[Double]) => [...] > > > > ? > > I think this is a bug either in the typesystem or in the printing of a >

Re: [X10-users] Defining an Array add

2010-06-07 Thread Yoav Zibin
I compiled the following code without errors: def ArrayD_add(s1:Array[Double],s2:Array[Double]) {s1.region() == s2.region(), s1.rail(), s2.rail()}:Array[Double] { return s1; } def test() { var v_dst:Array[Array[Double]]! = null; var v:Array[Double]! =

Re: [X10-users] Defining an Array add

2010-06-07 Thread Igor Peshansky
Christoph Pospiech wrote on 06/07/2010 03:50:37 PM: > On Thursday 03 June 2010, Igor Peshansky wrote: > > Christoph Pospiech 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 >

Re: [X10-users] Defining an Array add

2010-06-07 Thread Christoph Pospiech
On Thursday 03 June 2010, Igor Peshansky wrote: > Christoph Pospiech 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:

Re: [X10-users] Defining an Array add

2010-06-02 Thread Igor Peshansky
Christoph Pospiech wrote on 06/03/2010 01:50:13 AM: > 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]) >

Re: [X10-users] Defining an Array add

2010-06-02 Thread Christoph Pospiech
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[Doubl

Re: [X10-users] Defining an Array add

2010-06-02 Thread Yoav Zibin
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. On Wed, Jun 2, 2010 at 4:36

Re: [X10-users] Defining an Array add

2010-06-02 Thread Christoph Pospiech
On Wednesday 02 June 2010 06:01:24 pm Yoav Zibin wrote: > Maybe you do the reduce in a static context (so the error is that you refer > to instance method in a static context) ? > > Can you try both: > v = v_dst.reduce(ArrayD_add, v); > and > v = v_dst.reduce(*this.*ArrayD_add, v); > > If both do

Re: [X10-users] Defining an Array add

2010-06-02 Thread Yoav Zibin
Maybe you do the reduce in a static context (so the error is that you refer to instance method in a static context) ? Can you try both: v = v_dst.reduce(ArrayD_add, v); and v = v_dst.reduce(*this.*ArrayD_add, v); If both don't work, email the full code and I'll look into it. On Wed, Jun 2, 2010

Re: [X10-users] Defining an Array add

2010-06-02 Thread Christoph Pospiech
On Tuesday 01 June 2010 07:53:07 pm Dr. Christoph Pospiech wrote: > > On Tuesday 01 June 2010 02:06:08 pm Yoav Zibin wrote: > > > self.home==here > > > This means u need to use ! After the type. > > > > > > > > > Following the recent posts, I tried the following. > > > > global def

Re: [X10-users] Defining an Array add

2010-06-01 Thread Christoph Pospiech
On Tuesday 01 June 2010 07:26:02 pm Dr. Christoph Pospiech wrote: > On Tuesday 01 June 2010 02:06:08 pm Yoav Zibin wrote: > > self.home==here > > This means u need to use ! After the type. > > > > Following the recent posts, I tried the following. > > global def ArrayD_add(s1:Array

Re: [X10-users] Defining an Array add

2010-06-01 Thread Christoph Pospiech
On Tuesday 01 June 2010 02:06:08 pm Yoav Zibin wrote: > self.home==here > This means u need to use ! After the type. > Following the recent posts, I tried the following. global def ArrayD_add(s1:Array[double]!, s2:Array[double]!) {s1.region() == s2.

Re: [X10-users] Defining an Array add

2010-06-01 Thread Yoav Zibin
-DYNAMIC_CALLS option inserts dynamic checks whenever it cannot prove a certain constraint is satisfied. E.g., val i:Int = ; val j:Int{self>0} = i; // with -DYNAMIC_CALLS it inserts code that checks at runtime that the constraint is satisfied. Without -DYNAMIC_CALLS it would fail to compile. I

Re: [X10-users] Defining an Array add

2010-06-01 Thread Christoph Pospiech
On Tuesday 01 June 2010 02:06:08 pm Yoav Zibin wrote: > Do you compile with -DYNAMIC_CALLS ? > Actually, I am using eclipse X10DT, which hides the compilation options from me. Poking around in the eclipse internal files with grep and vi, I found an xml file that stated g++ options and I added -

Re: [X10-users] Defining an Array add

2010-06-01 Thread Christoph Pospiech
On Tuesday 01 June 2010 02:57:46 pm David P Grove wrote: > I would try it first avoiding the use of the typedef ArrayD. We sometimes > have problems with typedefs not always working the same way as the code > would have worked without the typedef. > David, I can confirm this, but possibly not i

Re: [X10-users] Defining an Array add

2010-06-01 Thread David P Grove
Christoph Pospiech wrote on 06/01/2010 06:05:20 AM: > > the following should be trivial, but I am stuck at an error message. Can > someone please fill me in ? > > Here is the code snippet. > >static type ArrayD = Array[double]{rank==1}; > >global def ArrayD_add(s1:ArrayD, s2:ArrayD) >

Re: [X10-users] Defining an Array add

2010-06-01 Thread Yoav Zibin
self.home==here This means u need to use ! After the type. Do you compile with -DYNAMIC_CALLS ? Thanks, Yoav Zibin On 01/06/2010, at 06:05, Christoph Pospiech wrote: > Hi, > > the following should be trivial, but I am stuck at an error message. > Can > someone please fill me in ? > > Here is

[X10-users] Defining an Array add

2010-06-01 Thread Christoph Pospiech
Hi, the following should be trivial, but I am stuck at an error message. Can someone please fill me in ? Here is the code snippet. static type ArrayD = Array[double]{rank==1}; global def ArrayD_add(s1:ArrayD, s2:ArrayD) {s2.region() == s1.region()}: ArrayD {