{"action":"created","issue":{"url":"https://api.github.com/repos/apache/incubator-systemml/issues/156","repository_url":"https://api.github.com/repos/apache/incubator-systemml","labels_url":"https://api.github.com/repos/apache/incubator-systemml/issues/156/labels{/name}","comments_url":"https://api.github.com/repos/apache/incubator-systemml/issues/156/comments","events_url":"https://api.github.com/repos/apache/incubator-systemml/issues/156/events","html_url":"https://github.com/apache/incubator-systemml/pull/156","id":154613369,"number":156,"title":"[SYSTEMML-670] Fix PyDML built-in functions random and cdf","user":{"login":"gweidner","id":12058879,"avatar_url":"https://avatars.githubusercontent.com/u/12058879?v=3","gravatar_id":"","url":"https://api.github.com/users/gweidner","html_url":"https://github.com/gweidner","followers_url":"https://api.github.com/users/gweidner/followers","following_url":"https://api.github.com/users/gweidner/following{/other_user}","gists_url":"https://api.github.com/users/gweidner/gists{/gist_id}","starred_url":"https://api.github.com/users/gweidner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gweidner/subscriptions","organizations_url":"https://api.github.com/users/gweidner/orgs","repos_url":"https://api.github.com/users/gweidner/repos","events_url":"https://api.github.com/users/gweidner/events{/privacy}","received_events_url":"https://api.github.com/users/gweidner/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-05-13T01:04:55Z","updated_at":"2016-05-13T01:35:38Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/apache/incubator-systemml/pulls/156","html_url":"https://github.com/apache/incubator-systemml/pull/156","diff_url":"https://github.com/apache/incubator-systemml/pull/156.diff","patch_url":"https://github.com/apache/incubator-systemml/pull/156.patch"},"body":"This patch fixes parsing of PyDML built-in functions random.normal, random.uniform, norm.cdf, expon.cdf, chi.cdf, f.cdf, and t.cdf.  Also added test script to invoke each function to verify parsing issue no longer occurs for PyDML."},"comment":{"url":"https://api.github.com/repos/apache/incubator-systemml/issues/comments/218930849","html_url":"https://github.com/apache/incubator-systemml/pull/156#issuecomment-218930849","issue_url":"https://api.github.com/repos/apache/incubator-systemml/issues/156","id":218930849,"user":{"login":"dusenberrymw","id":5431337,"avatar_url":"https://avatars.githubusercontent.com/u/5431337?v=3","gravatar_id":"","url":"https://api.github.com/users/dusenberrymw","html_url":"https://github.com/dusenberrymw","followers_url":"https://api.github.com/users/dusenberrymw/followers","following_url":"https://api.github.com/users/dusenberrymw/following{/other_user}","gists_url":"https://api.github.com/users/dusenberrymw/gists{/gist_id}","starred_url":"https://api.github.com/users/dusenberrymw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dusenberrymw/subscriptions","organizations_url":"https://api.github.com/users/dusenberrymw/orgs","repos_url":"https://api.github.com/users/dusenberrymw/repos","events_url":"https://api.github.com/users/dusenberrymw/events{/privacy}","received_events_url":"https://api.github.com/users/dusenberrymw/received_events","type":"User","site_admin":false},"created_at":"2016-05-13T01:35:38Z","updated_at":"2016-05-13T01:35:38Z","body":"Thanks for this, @gweidner.  I came across an interesting PyDML error:\r\n\r\nThis code blows up:\r\n```\r\ndef rand(x: int) -> (y: int, z: matrix[float]):\r\n  print(\"hi\")\r\n  z = full(x, rows=4, cols=2)\r\n  y = x*2\r\n\r\nN = 4\r\nD = 3\r\nX = random.normal(N, D, 1)\r\nprint(sum(X))\r\n\r\n[Y, Z] = rand(3)\r\nprint(sum(Z))\r\n```\r\n```\r\n: org.apache.sysml.parser.LanguageException: ERROR: null -- line 5, column 0 -- Assignment statement cannot return multiple values\r\n\tat org.apache.sysml.parser.Statement.raiseValidateError(Statement.java:167)\r\n\tat org.apache.sysml.parser.Statement.raiseValidateError(Statement.java:140)\r\n\tat org.apache.sysml.parser.StatementBlock.rewriteFunctionCallStatements(StatementBlock.java:503)\r\n\tat org.apache.sysml.parser.StatementBlock.validate(StatementBlock.java:552)\r\n\tat org.apache.sysml.parser.DMLTranslator.validateParseTree(DMLTranslator.java:133)\r\n\tat org.apache.sysml.api.MLContext.executeUsingSimplifiedCompilationChain(MLContext.java:1355)\r\n\tat org.apache.sysml.api.MLContext.compileAndExecuteScript(MLContext.java:1257)\r\n\tat org.apache.sysml.api.MLContext.executeScript(MLContext.java:1195)\r\n\tat sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)\r\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n\tat java.lang.reflect.Method.invoke(Method.java:497)\r\n\tat py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:231)\r\n\tat py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:379)\r\n\tat py4j.Gateway.invoke(Gateway.java:259)\r\n\tat py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:133)\r\n\tat py4j.commands.CallCommand.execute(CallCommand.java:79)\r\n\tat py4j.GatewayConnection.run(GatewayConnection.java:207)\r\n\tat java.lang.Thread.run(Thread.java:745)\r\n```\r\nHowever, if you comment out the `X = random.normal....` and associated `print...` statement, it works:\r\n```\r\ndef rand(x: int) -> (y: int, z: matrix[float]):\r\n  print(\"hi\")\r\n  z = full(x, rows=4, cols=2)\r\n  y = x*2\r\n\r\nN = 4\r\nD = 3\r\n#X = random.normal(N, D, 1)\r\n#print(sum(X))\r\n\r\n[Y, Z] = rand(3)\r\nprint(sum(Z))\r\n```\r\n```\r\nhi\r\n24.0\r\n```\r\nNow it gets stranger. Alternatively, just rename `rand` to something else (but keep the `X = random.normal...` lines) and it also works:\r\n```\r\ndef rando(x: int) -> (y: int, z: matrix[float]):\r\n  print(\"hi\")\r\n  z = full(x, rows=4, cols=2)\r\n  y = x*2\r\n\r\nN = 4\r\nD = 3\r\nX = random.normal(N, D, 1)\r\nprint(sum(X))\r\n\r\n[Y, Z] = rando(3)\r\nprint(sum(Z))\r\n```\r\n```\r\nhi\r\n-4.866772632314475\r\n24.0\r\n```"}}