A General Theory for Kernel Packets: from state space model to compactly supported basis