Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
-
None
-
None
Description
The documentation for diag() states that
Create diagonal matrix from (n x 1) or (1 x n) matrix, or take diagonal from square matrix
This snippet
mlctx.execute(dml("D = diag(matrix(1.0, rows=1, cols=2))"))
fails with
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)
Fixed by PR387.