Chunksparsing with segments

~~DO NOT MERGE! I am putting this up to see what Travis thinks. It would also be nice if someone would test if it compiles on windows. I haven't started testing this yet. Also, does anyone object to using ctest for automated test scripts?~~

Improvement to chunk sparsing (#17). Tested working.