Added flattenTriangular function and test

Done, though I left off the explicit 0.