-
Notifications
You must be signed in to change notification settings - Fork 151
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
Fully FieldVector Broadcasts Drop Names #314
Comments
You need to overload |
Should this be done on the abstract type so that way by default this works properly? |
Overloading StaticArrays.similar_type(a::T) where T<:FieldVector = T
similar_type(a) # ##FVector#661
b = a.+a
3-element SVector{3,Float64}:
2.0
4.0
6.0 |
Oh, sorry, the docs aren't clear enough here! For 3 vectors, please overload: similar_type(::Type{<:MyFieldVector}, ::Type{T}, ::Size{(3,)}) where {T} = MyFieldVector{T} The 3-argument form is what gets used in practice. You can't overload all of |
To follow up, we copy the pattern from |
Did overloading that method work for you? |
It worked |
Using #313 for simplicity:
The type of
b
here isSVector
and the type ofd
here isSVector
as well. It would be nice if in this case where the types are all known to be the sameFieldVector
that it can stay thatFieldVector
so that the return type has the same naming.The text was updated successfully, but these errors were encountered: