Reduces number of database queries made by triangularisation

Triangularisation references Person when in fact the inner loop does not depend on Person and instead refers solely to the SparseArray.

This commit modifies the triangularisation to only depend on the SpareArray.
Merge pull request #8 from lukegb/patch-1

Reduces number of database queries made by triangularisation