I'm trying to understand how to code the distributions and arrays. Can someone explain what's going on here?
This code compiles and executes. class ComplexArrayDist { public static def main(args: Rail[String] ) { var region: Region{rank == 1}; region = [0..9]; var dist: Dist = Dist.makeBlock(region,0); var complexArray: Array[Complex](region); complexArray = Array.makeVar[Complex](region, ((p):Point) => new Complex() ); for (var i:Int = 0; i < 10; i++){ complexArray(i) = new Complex(0,(i as double)/((i+1) as double)); Console.OUT.println(complexArray(i)); } } } But this code won't compile. class ComplexArrayDist { public static def main(args: Rail[String] ) { var region: Region{rank == 1}; region = [0..9]; var dist: Dist = Dist.makeBlock(region,0); var complexArray: Array[Complex](dist); //changed from region to dist complexArray = Array.makeVar[Complex](dist, //changed from region to dist ((p):Point) => new Complex() ); for (var i:Int = 0; i < 10; i++){ complexArray(i) = new Complex(0,(i as double)/((i+1) as double)); Console.OUT.println(complexArray(i)); } } } tests$ x10c ComplexArrayDist.x10 delta:tests$ x10c ComplexArrayDist.x10 /Users/jlagrone/GradSchool/Research/workspace/X10-code/tests/ ComplexArrayDist.x10:15: Cannot assign to element of x10.lang.Array[Complex]{}; Method set(T, x10 .lang .Point {self .x10 .lang .Point #rank = = x10 .lang .Array #this.x10.lang.Array#dist.x10.lang.Dist#region.x10.lang.Region#rank}) in x10.lang.Array[Complex] cannot be called with arguments (Complex, x10.lang.Int); Call invalid; actual parameter of type x10.lang.Int cannot be assigned to formal parameter type x10 .lang .Point {self .x10 .lang .Point #rank ==_2458.x10.lang.Array#dist.x10.lang.Dist#region.x10.lang.Region#rank}. /Users/jlagrone/GradSchool/Research/workspace/X10-code/tests/ ComplexArrayDist.x10:16: Method complexArray(x10.lang.Int) not found. /Users/jlagrone/GradSchool/Research/workspace/X10-code/tests/ ComplexArrayDist.x10:15: Cannot assign to element of x10.lang.Array[Complex]{}; Method set(T, x10 .lang .Point {self .x10 .lang .Point #rank = = x10 .lang .Array #this.x10.lang.Array#dist.x10.lang.Dist#region.x10.lang.Region#rank}) in x10.lang.Array[Complex] cannot be called with arguments (Complex, x10.lang.Int); Call invalid; actual parameter of type x10.lang.Int cannot be assigned to formal parameter type x10 .lang .Point {self .x10 .lang .Point #rank ==_4906.x10.lang.Array#dist.x10.lang.Dist#region.x10.lang.Region#rank}. /Users/jlagrone/GradSchool/Research/workspace/X10-code/tests/ ComplexArrayDist.x10:16: Method complexArray(x10.lang.Int) not found. 4 errors. ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ X10-users mailing list X10-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/x10-users