-
Notifications
You must be signed in to change notification settings - Fork 41
Open
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
endshould 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
endMetadata
Metadata
Assignees
Labels
No labels