BUG: fix integer divisions + complexwarnings

Fix some cases of integer division issues revealed by the test suite. (Didn't find other points with similar issues by grepping the source code.)

Also fix some spurious ComplexWarnings raised by scipy.sparse tests.