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

OffsetArray of size 1 from elementwise multiplication #360

Open
liamh opened this issue Sep 9, 2024 · 1 comment
Open

OffsetArray of size 1 from elementwise multiplication #360

liamh opened this issue Sep 9, 2024 · 1 comment

Comments

@liamh
Copy link

liamh commented Sep 9, 2024

See forum discussion with examples.

When I elementwise multiply an offset array by a regular array, I get the result I expect - the resulting array is offset properly - except when the size is 1. When the input array dimension is 6:10, for example, the multiplication result is 6:10 in the first dimension. This is as I expect, and all dimensions of size greater than 1 result in the same first dimension as the input. However, when the input array is 10:10, the multiplication result is 1:1 in the first dimension. I expect 10:10 as the first dimension, consistent with the size > 1 case.

@jishnub
Copy link
Member

jishnub commented Dec 23, 2024

MWE:

julia> a = [1];

julia> b = OffsetArray([1], 2);

julia> Broadcast.combine_axes(axes(a,1), axes(b,1))
(3:3,)

julia> Broadcast.combine_axes(axes(b,1), axes(a,1))
(1:1,)

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

No branches or pull requests

2 participants