Use the appropriate construtors on Array:
val region = (0..10)*(0..10); // define whatever region you want
val gridInfo=new Array[Double](region); // each point initialized with 0.0d
val g2 = new Array[Double](region, (p:Point(2))=>p(0)*1.0d)); // use an
explicit initializer for each point in the array
How do you find out the constructors on Array?
If you use X10DT, open (click on) the X10 Runtime Container in Package
Explorer. This will expand to show you all the packages. Open a package
-- you will see the X10 source there. Open x10.array.Array. You will see
all the constructors listed there that you can use.
Otherwise, just type x10.array.Array into google.
This takes you to
http://x10-lang.org/documentation/x10-standard-library.html
Now click on the Online Documentation for the X10 Standard Library link.
That takes you to x10doc.
Best,
Vijay
On 2/3/13 5:30 PM, Sparsh Mittal wrote:
Hello
I want to declare a square 2d array in x10. Would you please tell me
how to do that.
I saw pguide.pdf,
http://x10-lang.org/documentation/code-examples/small-examples.html,
x10-latest.pdf etc., but could not deduce and also could not find
clearly on web.
This one:
val gridInfo = new Array[double](2);
compiles fine and if I am correct, (2) shows it is 2d. But still how
to specify the dimension? The dimension is statically known.
I would be thankful for your help.
Thanks and Regards
Sparsh Mittal
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_jan
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_jan
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users