You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@systemml.apache.org by "Mike Dusenberry (JIRA)" <ji...@apache.org> on 2016/05/06 20:59:13 UTC

[jira] [Updated] (SYSTEMML-294) Print matrix capability

     [ https://issues.apache.org/jira/browse/SYSTEMML-294?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mike Dusenberry updated SYSTEMML-294:
-------------------------------------
    Assignee: Nakul Jindal  (was: Mike Dusenberry)

> Print matrix capability
> -----------------------
>
>                 Key: SYSTEMML-294
>                 URL: https://issues.apache.org/jira/browse/SYSTEMML-294
>             Project: SystemML
>          Issue Type: Improvement
>          Components: APIs
>            Reporter: Deron Eriksson
>            Assignee: Nakul Jindal
>
> The ability to output a matrix or a part of a matrix to standard output would be very useful to have while developing DML and PyDML scripts. By having the functionality as a built-in function, capabilities such as alignment of cell values could be performed. Such a built-in function could also optionally take parameters to limit the output to a certain subset of cells in the matrix. Such a function would be useful for small matrices. An error could be thrown if an attempt is made to use the function with a matrix that is too large.
> Here's an example of a printMatrix function in DML:
> {code}
> printMatrix = function(matrix[double] mat) {
> 	for (i in 1:nrow(mat)) {
> 		colVals = '| '
> 		for (j in 1:ncol(mat)) {
> 			n = mat[i,j]
> 			colVals = colVals + as.scalar(n) + ' | '
> 		}
> 		print(colVals)
> 	}
> }
> m = matrix("1 2 3 4 5 6 7 8 9 10 11 12", rows=4, cols=3)
> z = printMatrix(m)
> {code}
> Here's an example of a printMatrix function in PyDML:
> {code}
> def printMatrix(mat:matrix[float]):
> 	for (i in 1:nrow(mat)):
> 		colVals = '| '
> 		for (j in 1:ncol(mat)):
> 			n = mat[i,j]
> 			colVals = colVals + scalar(n) + ' | '
> 		print(colVals)
> m = full("1 2 3 4 5 6 7 8 9 10 11 12", rows=4, cols=3)
> z = printMatrix(m)
> {code}
> Here is the output:
> {code}
> | 1.0 | 2.0 | 3.0 | 
> | 4.0 | 5.0 | 6.0 | 
> | 7.0 | 8.0 | 9.0 | 
> | 10.0 | 11.0 | 12.0 | 
> {code}
> Notice how alignment readily becomes an issue if an attempt is made to do this with DML or PyDML.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)