Uploaded image for project: 'SystemDS'
  1. SystemDS
  2. SYSTEMDS-1241

Matrix initialization with diag() not possible

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • SystemML 0.13
    • 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)
      

      Attachments

        Activity

          Fixed by PR387.

          deron Jon Deron Eriksson added a comment - Fixed by PR387 .

          Thanks for finding that fschueler and describing bug mboehm7. Created https://github.com/apache/incubator-systemml/pull/387

          deron Jon Deron Eriksson added a comment - Thanks for finding that fschueler and describing bug mboehm7 . Created https://github.com/apache/incubator-systemml/pull/387

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

          deron Jon Deron Eriksson added a comment - I'll update the language ref and make the error message more informative.
          mboehm7 Matthias Boehm added a comment -

          it's a documentation bug - it should read "Create diagonal matrix from (n x 1) matrix, or take diagonal from square matrix"

          mboehm7 Matthias Boehm added a comment - it's a documentation bug - it should read "Create diagonal matrix from (n x 1) matrix, or take diagonal from square matrix"

          People

            deron Jon Deron Eriksson
            fschueler Felix Schueler
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: