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

Should map over SVector and Tuple return an SVector? #1286

Open
tscode opened this issue Nov 13, 2024 · 0 comments
Open

Should map over SVector and Tuple return an SVector? #1286

tscode opened this issue Nov 13, 2024 · 0 comments

Comments

@tscode
Copy link

tscode commented Nov 13, 2024

I am not sure whether this is a bug or if it works as intended, but I stumbled upon it when I wanted to rid my code of allocations:

f(x, y) = x * y
a = SVector(1., 1.)
b = (1., 1.)

map(f, a, b)

Since this creates a Vector{Float64} instead of an SVector{2, Float64}, it allocates, while f.(a, b) does not.

@tscode tscode changed the title Should map between SVector and Tuple return an SVector? Should map over SVector and Tuple return an SVector? Nov 13, 2024
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

1 participant