Refactoring code: moving computation of affinity matrix to MutableMatrix class.  Not yet complete.