KernelFunctions.jl
KernelFunctions.jl copied to clipboard
Adding `AbstractKernel`
This might be a controversial point, but I have a few times been surprised by the fact that Kernel
is an abstract type.
I would like to propose/ consider adding AbstractKernel
, with the subtypes SimpleKernel
, MOKernel
and Kernel
, where Kernel
would further be the supertype of the various kernels that are not mentioned.
This would be in line with how kernelmatrix
is defined, which is specialized for SimpleKernel
s and for all concrete instances of MOKernel
s, but falls back to kernel.(x, permutedims(y))
for Kernels
, which should continue.
I don't have a strong opinion on the name Kernel
vs AbstractKernel
- there is no consensus in Julia (not even in Base - AbstractArray
, Real
and Number
are all abstract types) about whether abstract types should be named Abstract...
or not. Sometimes Abstract...
seems nice because then the non-Abstract
name can be used for a concrete default implementation - but that's not an argument here since there is no default kernel type. Also with this proposal SimpleKernel
etc. would be abstract types that are not of the form Abstract...
.
In any case, I think at most Kernel
could be renamed to AbstractKernel
but I don't see a reason to add a new abstract sub-type for kernels that are neither SimpleKernel
nor MOKernel
.