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

Fix curl calling 3d function for 1d and 2d vectors #222

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

KnutAM
Copy link
Member

@KnutAM KnutAM commented Dec 23, 2024

Noticed that

curl(x -> rotate(x, angle::Real), rand(Vec{2}))

failed since rotate(::Vec{3}, angle::Real) is not defined.

The new implementation should be faster as well, se below.

@KnutAM
Copy link
Member Author

KnutAM commented Dec 23, 2024

Benchmarks,

julia> foo(x::Vec) = (x[1] * x[2]) * x
foo (generic function with 1 method)

julia> x = rand(Vec{2});

julia> @btime curl($foo, $x);
  1.916 ns (0 allocations: 0 bytes) # PR 
  3.542 ns (0 allocations: 0 bytes) # master

@KnutAM
Copy link
Member Author

KnutAM commented Jan 6, 2025

Ready for review, @fredrikekre or @KristofferC

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.

1 participant