[
https://issues.apache.org/jira/browse/SYSTEMML-475?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Mike Dusenberry closed SYSTEMML-475.
------------------------------------
Resolution: Later
> Add Implicit Conversion Between Scalar Values and 1x1 Matrices
> --------------------------------------------------------------
>
> Key: SYSTEMML-475
> URL: https://issues.apache.org/jira/browse/SYSTEMML-475
> Project: SystemML
> Issue Type: Improvement
> Components: Compiler, Parser
> Reporter: Mike Dusenberry
> Assignee: Mike Dusenberry
>
> Currently, any DML functions that require scalars will not accept 1x1
> matrices. Matrix indexing always returns a matrix, so a statement such as
> {{A[1,1]}} from the following simple example will return a single-valued
> matrix, even though it logically represents a scalar. Thus, in order to use
> this value as a scalar, the {{as.scalar(...)}} function is required.
> {code}
> A = matrix(7, rows=10, cols=10)
>
> print( "A[1,1]: " + as.scalar(A[1,1])) // 7
> {code}
> In this scenario, the required usage of {{as.scalar(...)}} can cause
> confusion, and can be viewed as a violation of SystemML's goal of hiding the
> underlying data representation from the user.
> Additionally, many of the built-in functions, such as {{rowVars(...)}},
> accept matrices without other requirements of dimensionality, and thus will
> accept a 1x1 matrix, yet will not accept a scalar value. We should allow any
> such functions that accept 1x1 matrices to also accept scalar values.
> {code}
> a = 4
> print("Row variances of scalar are: " + rowVars(a)) // 0
> {code}
> In order to achieve this, we can add implicit casting between scalar values
> and 1x1 matrices within the parser during the validation stage as needed.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)