JuliaGaussianProcesses / JuliaGaussianProcesses/KernelFunctions.jl
Remove hard-coded `Vector` fields and add vectors constructors
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 275
- Forks
- 41
- PR merge metrics
- No merged PRs in 30d
Description
Right now kernels like LinearKernel have two problems: they can only take Real arguments (no way to pass kernel.c) as an argument and also they do not allow for different AbstractVector types to be stored.
The interested use case is when using GPUs, one cannot do kernelmatrix on CuArrays without this.
struct LinearKernel{Tc<:Real} <: SimpleKernel
c::Vector{Tc}
function LinearKernel(c::Real)
@check_args(LinearKernel, c, c >= zero(c), "c ≥ 0")
return new{typeof(c)}([c])
end
end
should be
struct LinearKernel{Tc<:Real,Vc<:AbstractVector{<:Tc}} <: SimpleKernel
c::Vc
function LinearKernel(c::V) where {T<:Real, V<:AbstractVector{T}}
@check_args(LinearKernel, first(c), first(c) >= zero(c), "c ≥ 0")
return new{T,V}(c)
end
function LinearKernel(c::Real)
@check_args(LinearKernel, c, c >= zero(c), "c ≥ 0")
C = [c]
return new{eltype(C),typeof(C)}(C)
end
end
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the LinearKernel definition shown in the issue, then locate the other kernel structs that store hard-coded Vector fields and their constructors. Check how vector-valued parameters are used with GPU arrays, and confirm that the affected kernels accept AbstractVector types while scalar construction still works. Done means the relevant constructors and field types support the intended vector types without breaking existing scalar behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- machine-learning
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100