Skip to content
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

Make mapslices accept arbitrary number of inputs an allow broadcasting. #10928

Closed
wants to merge 1 commit into from

Conversation

andreasnoack
Copy link
Member

To allow this, it was necessary to make the dims argument a keyword argument. Examples

julia> A = randn(3,2,2); B = randn(2,2,2);

julia> mapslices(svdvals, A, B, dims = (1,2))
2x1x2 Array{Float64,3}:
[:, :, 1] =
 1.35258
 3.10531

[:, :, 2] =
 7.87285 
 0.160165

julia> mapslices(svdvals, A, B[:,:,1], dims = (1,2))
2x1x2 Array{Float64,3}:
[:, :, 1] =
 1.35258
 3.10531

[:, :, 2] =
 1.28949 
 0.289479

julia> mapslices(norm, A, 1, dims = 1)
1x2x2 Array{Float64,3}:
[:, :, 1] =
 2.67363  2.65857

[:, :, 2] =
 1.16449  2.33811

This generalized version is slightly slower than the old version, but I guess this function is not used much in performance critical code.

cc: @alanedelman

@andreasnoack
Copy link
Member Author

Closing, as this was not the desired solution.

@mschauer
Copy link
Contributor

This seems to be difficult to get right. I think the point is that a multiarray map slices should behave differently. My unhappy try was #5140

@andreasnoack
Copy link
Member Author

@mschauer Thanks for the reference. I didn't know about that one. I've prepared another solution, but the main focus is parallel execution so it might only fo into DistributedArrays.jl.

@andreasnoack andreasnoack deleted the anj/mapslices branch June 18, 2015 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants