Hello Kenjiro: I was thinking yesterday that the alternative to the array-of-array syntax already rejected would have to state the dimensions explicitly. Since the reshape function provides that capability, it appears to be the best option currently available. Thanks for calling that to my attention.
Tom Hildebrandt ________________________________________ From: Kenjiro Taura [[email protected]] Sent: Friday, February 14, 2014 4:31 AM To: Brad Chamberlain Cc: [email protected]; [email protected] Subject: Re: [Chapel-developers] Multidimensional array literals My two cents about multidimensional array literals. I cannot invent anything brilliant. For general high-dimensional arrays, I cannot think of a solution more elegant than what Chapel already has. Chapel already has a reshape operation, allowing: var A = reshape([ 1.1, 1.2, 1.3, 2.1, 2.2, 2.3, 3.1, 3.2, 3.3 ], {1..3,1..3}); It will be a simple matter for a compiler to optimize away redundant array creation here. Any proposed literal must be more elegant than this, but I cannot think of any. numpy is also designed along this line. Arrays have reshape method which does exactly what Chapel's reshape function does. For 2D arrays, we may use something along Matlab. i.e., something like: [ 1.1, 1.2, 1.3; 2.1, 2.2, 2.3; 3.1, 3.2, 3.3 ] but arguably, this is redundant and unnecessary. To summarize, I am proposing not to propose any, but I am happy to be enlightened otherwise. > > Chapel Developers -- > > While we're talking about array literals, we need a syntax for > multidimensional array literals. That is, how should I write the > conceptual 3x3 array of reals: > > 1.1 1.2 1.3 > 2.1 2.2 2.3 > 3.1 3.2 3.3 > > as Chapel source code? > > Note that the following: > > [[1.1, 1.2, 1.3], [2.1, 2.2, 2.3], [3.1, 3.2, 3.3]] > > is probably not the right solution as it more logically reads as an array > of arrays. I.e., '[1..3] [1..3] real' rather than '[1..3, 1..3] real' > > Proposed solutions need to scale to arbitrary dimensions. > > Thanks! > -Brad > > > ------------------------------------------------------------------------------ > Android apps run on BlackBerry 10 > Introducing the new BlackBerry 10.2.1 Runtime for Android apps. > Now with support for Jelly Bean, Bluetooth, Mapview and more. > Get your Android app in front of a whole new audience. Start now. > http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk > _______________________________________________ > Chapel-developers mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/chapel-developers ------------------------------------------------------------------------------ Android apps run on BlackBerry 10 Introducing the new BlackBerry 10.2.1 Runtime for Android apps. Now with support for Jelly Bean, Bluetooth, Mapview and more. Get your Android app in front of a whole new audience. Start now. http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk _______________________________________________ Chapel-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/chapel-developers ------------------------------------------------------------------------------ Android apps run on BlackBerry 10 Introducing the new BlackBerry 10.2.1 Runtime for Android apps. Now with support for Jelly Bean, Bluetooth, Mapview and more. Get your Android app in front of a whole new audience. Start now. http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk _______________________________________________ Chapel-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/chapel-developers
