Hi,

I'm new in X10 and I see that arrays in X10 are really "awesome" ... but 
will take me some time to fully understand how to work with them. I 
understand that arrays are indexed by points, etc., and are "different" 
from C or java-like arrays. For now lets talk about the simple, not 
distributed arrays.

Now, before I go in detailed reading of the specifications, I would like 
to see fairly straightforward example that would help me understand what 
are the best ways to handle multi-dimensional arrays.

Let's start with a simple case of dynamically allocated matrix 
representation in array. In C one might do something like that:

int rows, columns;
double **matrix;

// typically would be set dynamically from some kind of input,
// let's just make it simple for this example
rows = 2;
columns = 3;

matrix = malloc(rows * sizeof(double*));
for (i = 0; i < rows; i++) {
        matrix[i] = malloc(columns * sizeof(double*));
}

// typically would be set dynamically from some kind of input,
// let's just make it simple for this example
m1[0][0] = 1.01;
m1[0][1] = 2.19;
m1[0][2] = 3.28;
m1[1][0] = 2.12;
m1[1][1] = 4.61;
m1[1][2] = 3.44;

---

No, how would one do this in X10? As I understand there is probably more 
that one way to do it? There are probably "performance-wise" and 
"c/java-like" ways to do it?

Many thanks for help!


Kind regards, Marko Kobal


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users

Reply via email to