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

Mike Dusenberry commented on SYSTEMML-1444:
-------------------------------------------

Thanks, [~return_01] for working on this!  For the multiple output case, I 
think we would need full support for tuples, complete with indexing and 
automatic packing & unpacking.  Then, functions with "multiple outputs" would 
actually be returning a single tuple of outputs, with syntax that would allow 
for automatic unpacking on assignment.  This is how Python and others handle 
this problem.

Using your example, we could assign the results to a tuple variable as

{code}
my_tuple = udf(a, b)
{code}

or we could unpack into variables as

{code}
X, x = udf(a, b)
{code}

which is equivalent to

{code}
(X, x) = udf(a, b)
{code}

and we could use it inline by indexing into the tuple as

{code}
Y = udf(a, b)[1] + c  # assuming 1-indexing like the rest of DML
{code}.


Having support for tuples would be incredibly useful in the general case.  I 
agree that it may take a large amount of work, so I would recommend starting 
with the single-output case, and keeping the tuple case in mind so that it is 
reasonable to expand to that afterwards.

> UDFs w/ single output in expressions
> ------------------------------------
>
>                 Key: SYSTEMML-1444
>                 URL: https://issues.apache.org/jira/browse/SYSTEMML-1444
>             Project: SystemML
>          Issue Type: Sub-task
>          Components: APIs, Compiler, Runtime
>            Reporter: Matthias Boehm
>            Assignee: Janardhan
>             Fix For: SystemML 1.0
>
>




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to