Skip to content

broadcasting and multiple values #23734

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tpapp opened this issue Sep 16, 2017 · 2 comments
Closed

broadcasting and multiple values #23734

tpapp opened this issue Sep 16, 2017 · 2 comments
Labels
broadcast Applying a function over a collection

Comments

@tpapp
Copy link
Contributor

tpapp commented Sep 16, 2017

Sometimes it would be advantageous to broadcast functions which return multiple values, without creating intermediate arrays of tuples. Eg

f(x) = x, x+1
x = reshape(1:6,2,3)
@syntax_to_be_determined a, b = f.(x) # creating new arrays
a2 = similar(a)
b2 = similar(b)
a2, b2 .= f.(x) # in-place syntax is free, currently gives MethodError for broadcast!

so that

a == a2 == x
b == b2 == x.+1

would hold.

(short discussion in Discourse)

@TotalVerb
Copy link
Contributor

#22129

@mbauman
Copy link
Member

mbauman commented Apr 23, 2018

Let's close this as a dup of #22129 — I think that captures the same idea.

@mbauman mbauman closed this as completed Apr 23, 2018
@mbauman mbauman added broadcast broadcast Applying a function over a collection labels Apr 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
broadcast Applying a function over a collection
Projects
None yet
Development

No branches or pull requests

3 participants