output affinity matrix