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

Is the type parameter <: intentional? #306

Open
jishnub opened this issue Feb 2, 2023 · 1 comment
Open

Is the type parameter <: intentional? #306

jishnub opened this issue Feb 2, 2023 · 1 comment

Comments

@jishnub
Copy link
Member

jishnub commented Feb 2, 2023

function convert(::Type{BandedMatrix{<:, C}}, M::BandedMatrix) where C
M.data isa C && return M
_BandedMatrix(convert(C, M.data), M.raxis, M.l, M.u)
end

And

function convert(::Type{BandedMatrix{<:,C,OneTo{Int}}}, M::AbstractMatrix) where {C}
Container = typeof(convert(C, similar(M, 0, 0)))
T = eltype(Container)
copyto!(BandedMatrix{T, Container}(undef, size(M), bandwidths(M)), M)
end

Or is this supposed to be <:Any?

julia> B = BandedMatrix{<:,Matrix{<:},Base.OneTo{Int}}
BandedMatrix{<:, Matrix{<:}, Base.OneTo{Int64}}

julia> Base.isconcretetype(B)
true

julia> eltype(B)
<: (built-in function)

Is this for a banded matrix of the subtype function?

@dlfivefifty
Copy link
Member

It's 5 year old code by an RSE who was a Julia beginner so I think it is meant to be <: Any....

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

2 participants