Added flattenTriangular function and test

Replace loop with `k += copy(aFlat[k:], a[i])`