fixed some type stability issues in scalar.jl, fixed a bunch of addition bugs in diracmatrix, wrote some more tests