public static _2By2Matrix operator *(_2By2Matrix m1, _2By2Matrix m2) { var m3 = new _2By2Matrix(); m3.E11 = m1.E11*m2.E11 + m1.E12*m2.E21; m3.E12 = m1.E11*m2.E12 + m1.E12*m2.E22; m3.E21 = m1.E21*m2.E11 + m1.E22*m2.E21; m3.E22 = m1.E21*m2.E12 + m1.E22*m2.E22; return m3; }
public static int Number(int n) { var m = new _2By2Matrix() { E11 = 1, E12 = 1, E21 = 1 }; var m2 = ThreadedPow<_2By2Matrix>.Pow(m, n - 1); return m2.E11; }
public void TestMethod3() { var m = new _2By2Matrix() { E11 = 1, E12 = 1, E21 = 1 }; var m2 = ThreadedPow<_2By2Matrix>.Pow(m, 10); Assert.AreEqual(89, m2.E11); }