systemml-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nakul Jindal <naku...@gmail.com>
Subject Re: Matrix non-range indexing should return a scalar
Date Sat, 29 Jul 2017 00:21:21 GMT
+1 to Mike & Deron.

Two other languages/packages that behave like this:
R : http://www.r-tutor.com/r-introduction/matrix
Octave :
https://www.gnu.org/software/octave/doc/interpreter/Index-Expressions.html


-Nakul




On Fri, Jul 28, 2017 at 4:03 PM, Deron Eriksson <deroneriksson@gmail.com>
wrote:

> Thank you Mike for bringing this up. To me, this definitely makes sense at
> the user (DML) level.
>
> For a Java-style 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, non-range 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 non-range 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.
> >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message