Changed non-orthogonality check to handle both SP and DP.