inner matrix compare