Thank you Mike for bringing this up. To me, this definitely makes sense at
the user (DML) level.
For a Javastyle pseudocode example, currently we require the user to do
the following:
int[][] m = int[][]{1,2,3,4};
int[][] n = m[0][0];
int x = (int) n;
I feel the following would be more 'natural':
int[][] m = int[][]{1,2,3,4};
int x = m[0][0];
If a user asks for a specific cell (and not a range) in DML code, I think
the user clearly wants a value and not a matrix that the user needs to cast
via as.scalar.
Deron
On Fri, Jul 28, 2017 at 3:41 PM, <dusenberrymw@gmail.com> wrote:
> Currently, nonrange matrix indexing, such as `X[1,2]`, returns a 1x1
> matrix in SystemML rather than a single scalar value. This is inconsistent
> with mathematical semantics, and with array indexing semantics of any major
> language, thus leading to confusion for users.
>
> I would like to propose that nonrange indexing at the language level,
> such as `X[1,2]`, should return a single scalar value, and range indexing
> of any kind at the language level, including the trivial example
> `X[1:1,2:2]`, should return a matrix. This would lead to clear semantics
> that are consistent with mathematics and language array indexing, thus
> preventing user confusion. Additionally, these are the semantics that the
> NumPy project uses.
>
> Interested to hear thoughts from the rest of the community!
>
> Mike
>
> 
>
> Mike Dusenberry
> GitHub: github.com/dusenberrymw
> LinkedIn: linkedin.com/in/mikedusenberry
>
> Sent from my iPhone.
>
>
