remove unnecessary squareform transformations

I can nest these all within if statements. Better to keep the c-matrix
as a full square array for the whole algorithm, since switching between
forms is expensive.