[MRG+1] ENH: Refactoring and optimisation of sparsfuncs.pyx

Some refactoring and optimisation in sparsefuncs.pyx. should not matter much, but is definitely faster.