Algebraic Algorithm for Stability Testing of Discrete Systems and Its Application to Stability Testing of 2 Dimensional Systems