Calculates the number of various relationships present in square boolean matrices.