-
Notifications
You must be signed in to change notification settings - Fork 149
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
Move Size
to StaticArraysCore.jl
#1094
Conversation
This LGTM. |
Size(::Type{Adjoint{T, A}}) where {T, A <: AbstractVecOrMat{T}} = Size(Size(A)[2], Size(A)[1]) | ||
Size(::Type{Transpose{T, A}}) where {T, A <: AbstractVecOrMat{T}} = Size(Size(A)[2], Size(A)[1]) | ||
Size(::Type{Symmetric{T, A}}) where {T, A <: AbstractMatrix{T}} = Size(A) | ||
Size(::Type{Hermitian{T, A}}) where {T, A <: AbstractMatrix{T}} = Size(A) | ||
Size(::Type{Diagonal{T, A}}) where {T, A <: AbstractVector{T}} = Size(Size(A)[1], Size(A)[1]) | ||
Size(::Type{<:LinearAlgebra.AbstractTriangular{T, A}}) where {T,A} = Size(A) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be moved to StaticArraysCore as well? Technically it is type piracy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some additional definitions below with types from base.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StaticArraysCore
currently doesn't import LinearAlgebra
so that's why I didn't more them. Is there a use for these methods in StaticArraysCore
without StaticArrays
?
I know this is type piracy but it should be harmless since StaticArrays
in practice "owns" Size
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is type piracy but it should be harmless since StaticArrays in practice "owns" Size.
That's why I assumed it is mostly technical. It would only become an issue if some other package wants to use these Size
functionalities without depending on StaticArrays itself.
Some of the definitions below don't even use LinearAlgebra (or some other standard library), e.g., Base.prod
or definitions for Tuple
s.
Generally, I would assume that it's fine for StaticArraysCore to depend on LinearAlgebra as it is a standard library and I think usually any package with StaticArraysCore in the dependency tree will have LinearAlgebra in the dependency tree anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the PR to core is already merged and tagged, let's leave that to a new PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically all of StaticArrays is type piracy, e.g. *(::SMatrix, ::SVector)
is type piracy since StaticArrays owns neither the function nor the types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this might actually not only be a theoretical problem but cause issues with generated functions: JuliaDiff/ForwardDiff.jl#599 (comment)
Maybe some functions like Defining them later in StaticArrays seems to cause problems for |
I think moving |
Counterpart to JuliaArrays/StaticArraysCore.jl#13