[ 
https://issues.apache.org/jira/browse/SYSTEMML-1241?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15861639#comment-15861639
 ] 

Deron Eriksson commented on SYSTEMML-1241:
------------------------------------------

I'll update the language ref and make the error message more informative.

> Matrix initialization with diag() not possible
> ----------------------------------------------
>
>                 Key: SYSTEMML-1241
>                 URL: https://issues.apache.org/jira/browse/SYSTEMML-1241
>             Project: SystemML
>          Issue Type: Bug
>            Reporter: Felix Schüler
>            Assignee: Deron Eriksson
>            Priority: Minor
>
> The documentation for diag() states that
> {quote}
> Create diagonal matrix from (n x 1) or (1 x n) matrix, or take diagonal from 
> square matrix
> {quote}
> This snippet
> {code}
> mlctx.execute(dml("D = diag(matrix(1.0, rows=1, cols=2))"))
> {code}
> fails with 
> {code}
> Name: org.apache.sysml.api.mlcontext.MLContextException
> Message: Exception when executing script
> StackTrace:   at 
> org.apache.sysml.api.mlcontext.MLContext.execute(MLContext.java:307)
>   at org.apache.sysml.api.mlcontext.MLContext.execute(MLContext.java:276)
>   ... 48 elided
> Caused by: org.apache.sysml.api.mlcontext.MLContextException: Exception 
> occurred while validating script
>   at 
> org.apache.sysml.api.mlcontext.ScriptExecutor.validateScript(ScriptExecutor.java:553)
>   at 
> org.apache.sysml.api.mlcontext.ScriptExecutor.execute(ScriptExecutor.java:307)
>   at org.apache.sysml.api.mlcontext.MLContext.execute(MLContext.java:299)
>   ... 49 more
> Caused by: org.apache.sysml.parser.LanguageException: Invalid Parameters : 
> ERROR: null -- line 1, column 0 -- Invoking diag on matrix with dimensions 
> (1,2) in 
> DIAG(RAND(,lambda=1.0,min=1.0,pdf=uniform,seed=-1,max=1.0,sparsity=1.0,rows=1,cols=2
>  ))
>   at 
> org.apache.sysml.parser.Expression.raiseValidateError(Expression.java:556)
>   at 
> org.apache.sysml.parser.BuiltinFunctionExpression.validateExpression(BuiltinFunctionExpression.java:630)
>   at org.apache.sysml.parser.StatementBlock.validate(StatementBlock.java:567)
>   at 
> org.apache.sysml.parser.DMLTranslator.validateParseTree(DMLTranslator.java:140)
>   at 
> org.apache.sysml.api.mlcontext.ScriptExecutor.validateScript(ScriptExecutor.java:551)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to