dualMatrix function

Compile detection matrix for last array