From dev-return-1961-apmail-systemml-dev-archive=systemml.apache.org@systemml.apache.org Fri Jul 28 23:03:30 2017 Return-Path: X-Original-To: apmail-systemml-dev-archive@minotaur.apache.org Delivered-To: apmail-systemml-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E5D6619F5C for ; Fri, 28 Jul 2017 23:03:30 +0000 (UTC) Received: (qmail 77975 invoked by uid 500); 28 Jul 2017 23:03:30 -0000 Delivered-To: apmail-systemml-dev-archive@systemml.apache.org Received: (qmail 77925 invoked by uid 500); 28 Jul 2017 23:03:30 -0000 Mailing-List: contact dev-help@systemml.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@systemml.apache.org Delivered-To: mailing list dev@systemml.apache.org Received: (qmail 77913 invoked by uid 99); 28 Jul 2017 23:03:30 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Jul 2017 23:03:30 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 179D0C039F for ; Fri, 28 Jul 2017 23:03:30 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.379 X-Spam-Level: ** X-Spam-Status: No, score=2.379 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id w4neU_wUMQUx for ; Fri, 28 Jul 2017 23:03:28 +0000 (UTC) Received: from mail-oi0-f41.google.com (mail-oi0-f41.google.com [209.85.218.41]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id E88D15F523 for ; Fri, 28 Jul 2017 23:03:27 +0000 (UTC) Received: by mail-oi0-f41.google.com with SMTP id e124so184763452oig.2 for ; Fri, 28 Jul 2017 16:03:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:reply-to:in-reply-to:references:from:date:message-id :subject:to; bh=B4lNgVC2pfXF+I9pv3+CBEEdkLQs+qowcSxF+XGRCEs=; b=W7qY/0yxyRqZ2rQ06pNXq15GroU5Vw2NOUO7LaHeGHefXi6Bp6q58+4vghyHk6htwr bfqZAfE08m1A3cCsrk4ZNN0JfacmCM4nB2oLCPcTAKMC5rPY0clnfdCXbrpoD5yCrwH0 DxoOT3aqlGKZxXM8R+9VTwoGpeIkB+6Yzxnj9j3hYY9oqvD4CLmk/PaxPrBMSzMK6nO+ 5WlIP72g6Z+sKKoIc3rTIQaXGDPXItRtbMO4GCE1QE5dDjItu//Bj/YpEa1uk/Ex72u4 X8ivZszzG5sNTNeZjl+HgqmNctsqg+FJiU/qvjtosId7dRX6nXS5M9pNSMpMAbN/F1pL ochA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to; bh=B4lNgVC2pfXF+I9pv3+CBEEdkLQs+qowcSxF+XGRCEs=; b=nzb2TtXRfP1U9T9AwV/r2jUXfs9qj4upwUSilAYMXbaqbXmBkbBV0NH31w4DZgZFpe LjTOSRcnslwlc+QiZDMhBjsYPof9HIvWjq5ijAFzSQxeF+x7nJYqbt3F7g4V1QMnDYuQ yCrVpeCa9hFKm4PJMwj9dN5eeUPHl1MfY1G+tDSdguG1wUsn5bCVeaAfs4qpLWABb+Uk Z5cAkBjTYCa/jaU3jswlsFETmPcDg56oGn0dZub40t7GF3OWxCKO3i8PxUzYsB1k2U3S ygoJp38afXfbwCk2DWWnsXq9v5I4Q3g8hOJ53XRwDtJT+uGmSBw2xhi2FGRSd7yTQRsS DxLw== X-Gm-Message-State: AIVw113h7Pgq/LkgEaXWXrBSovJCgi7jncleSeEakyUb/bY8KkKktInK xizQtv2F/W+we7OQ3t5AJLsILvoZbdM4 X-Received: by 10.202.83.143 with SMTP id h137mr7718080oib.187.1501283001138; Fri, 28 Jul 2017 16:03:21 -0700 (PDT) MIME-Version: 1.0 Received: by 10.202.230.18 with HTTP; Fri, 28 Jul 2017 16:03:20 -0700 (PDT) Reply-To: deron@apache.org In-Reply-To: <7EEF4991-035F-40E8-AB84-84FD115896BF@gmail.com> References: <7EEF4991-035F-40E8-AB84-84FD115896BF@gmail.com> From: Deron Eriksson Date: Fri, 28 Jul 2017 16:03:20 -0700 Message-ID: Subject: Re: Matrix non-range indexing should return a scalar To: dev@systemml.apache.org Content-Type: multipart/alternative; boundary="001a1147c00efd8557055568afc3" --001a1147c00efd8557055568afc3 Content-Type: text/plain; charset="UTF-8" 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, 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. > > --001a1147c00efd8557055568afc3--