move spin stuff to asd_spin.h. Also const-correctness fix in sparsematrix.

Minor cleanup included.