Spectral Alignment of Kernel Matrices and Applications