Partial sum implementation

I'll reformat with clang-format. I use emacs but with a completely different formatting settings and every time I try to edit stuff with a different formatting it goes nuts.