Christoph Pospiech <christoph.pospi...@de.ibm.com> wrote on 01/04/2011 10:57:24 AM:
> Hi, > > the following code snippet > > public class matmul { > [...] > static type Array1D = Array[Double]{rank==1}; > [...] > val v_loc: Array[Array1D]{rank==1}; > val r_loc: Array[RemoteArray]{rank==1}; > > /** > * special constructor > */ > public def this(n:Int, axis:Int, Dprint: Boolean) { > [...] > v_loc = new Array[Array1D](Dv_tmp.region(), > (r:Point) => {(new Array[Double]((0..n-1), > ( 0.0 as Double))) } ); > r_loc = new Array[RemoteArray](Dv_tmp.region(), > (r:Point) => {(new RemoteArray(v_loc(r))) } ); > } > [...] > } > > produces this compiler error message. > > /home/cp/xample/MatMul/mm_X10/src/matmul.x10:92-93: > Constructor this(reg: x10.array.Region, init: > (a1:x10.array.Point{self.rank==reg.rank})=> x10.array.RemoteArray): > x10.array.Array[x10.array.RemoteArray]{self.region==reg} > cannot be invoked with arguments > (x10.array.Region{self==Dv_tmp.region}, <anonymous class>). > > Why ? I would look for hints in the following part of the message: init: (a1:x10.array.Point{self.rank==reg.rank})=> x10.array.RemoteArray You are passing in a closure of type (Point)=>RemoteArray, and the constructor expects a closure of type (Point{rank==Dv_tmp.region().rank})=>RemoteArray . Of course, the type system cannot express the above constraint directly, so you would have to write the code in the following manner: [...] val r_tmp = Dv_tmp.region(); v_loc = new Array[Array1D](r_tmp, (r:Point(r_tmp.rank))=> (new Array[Double](0..(n-1), (0.0 as Double))) ); r_loc = new Array[RemoteArray](r_tmp, (r:Point(r_tmp.rank)) => (new RemoteArray(v_loc(r))) ); [...] or, if Dv_tmp is statically known to be of rank 1, you can also write: [...] v_loc = new Array[Array1D](Dv_tmp.region(), (r:Point(1))=>(new Array[Double](0..(n-1), (0.0 as Double))) ); r_loc = new Array[RemoteArray](Dv_tmp.region(), (r:Point(1)) => (new RemoteArray(v_loc(r))) ); [...] Hope this helps, Igor -- Igor Peshansky (note the spelling change!) IBM T.J. Watson Research Center X10: Parallel Productivity and Performance (http://x10-lang.org/) XJ: No More Pain for XML's Gain (http://www.research.ibm.com/xj/) "I hear and I forget. I see and I remember. I do and I understand" -- Xun Zi ------------------------------------------------------------------------------ Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ X10-users mailing list X10-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/x10-users