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

Broadcast should handle transpose of StaticVector #200

Closed
bshall opened this issue May 29, 2017 · 2 comments · Fixed by #274
Closed

Broadcast should handle transpose of StaticVector #200

bshall opened this issue May 29, 2017 · 2 comments · Fixed by #274

Comments

@bshall
Copy link
Contributor

bshall commented May 29, 2017

If x is a SVector then broadcast(f, x', ...) should return a StaticArray. Currently the broadcasting falls back to Base except for broadcasts with a scalar. For example

x = SVector(1, 1)
1 .+ x'

returns a RowVector{T, SVector{2, T}}.

@andyferris
Copy link
Member

The behavior in the OP is intended.

We can't have that all statically-sized arrays are <: StaticArray. The RowVector code in Base is designed to be compatible with packages like StaticArrays (to wrap RowVector on the outside). Trait-based dispatch would help to express static-sizeness better...

However, the problem is that not all operations work on RowVector{<:StaticArray}. e.g.

julia 0.6> x = SVector(2,3)
2-element SVector{2,Int64}:
 2
 3

julia 0.6> x' .+ x
2×2 Array{Int64,2}:
 4  5
 5  6

We should look into this.

c42f added a commit that referenced this issue Aug 11, 2017
Fix several broadcast issues (fixes #197, #199, #200, #242)
@wsshin
Copy link
Contributor

wsshin commented Aug 14, 2017

@bshall, this has been also resolved by #274. Could you close this issue as well?

@c42f c42f closed this as completed Aug 14, 2017
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 a pull request may close this issue.

4 participants