public void Setup() { // MATLAB: ma3x2 = [1 -2;-1 4;5 7] _ma3X2 = new Matrix(new double[][] { new double[] { 1, -2 }, new double[] { -1, 4 }, new double[] { 5, 7 } }); // MATLAB: mb3x2 = [10 2.5;-3 -1.5;19 -6] _mb3X2 = new Matrix(new double[][] { new double[] { 10, 2.5 }, new double[] { -3, -1.5 }, new double[] { 19, -6 } }); // MATLAB: mc2x2 = [1 2;3 4] _mc2X2 = new Matrix(new double[][] { new double[] { 1, 2 }, new double[] { 3, 4 } }); // MATLAB: md2x4 = [1 2 -3 12;3 3.1 4 2] _md2X4 = new Matrix(new double[][] { new double[] { 1, 2, -3, 12 }, new double[] { 3, 3.1, 4, 2 } }); // MATLAB: ra3x2 = ma3x2 + 2 _ra3X2 = ComplexMatrix.Create(_ma3X2) + 2; // MATLAB: rb3x2 = mb3x2 - 1 _rb3X2 = ComplexMatrix.Create(_mb3X2) - 1; // MATLAB: rc2x2 = mc2x2 + 5 _rc2X2 = ComplexMatrix.Create(_mc2X2) + 5; // MATLAB: rd2x4 = md2x4 * 2 _rd2X4 = ComplexMatrix.Create(_md2X4) * 2; // MATLAB: ia3x2 = (ra3x2 * 2) * j _ia3X2 = (_ra3X2 * 2) * j; // MATLAB: ib3x2 = (rb3x2 * 3 + 1) * j _ib3X2 = ((_rb3X2 * 3) + 1) * j; // MATLAB: ic2x2 = (rc2x2 + 2) * j _ic2X2 = (_rc2X2 + 2) * j; // MATLAB: id2x4 = (rd2x4 - 5) * j _id2X4 = (_rd2X4 - 5) * j; // MATLAB: ca3x2 = 2*ra3x2 - 2*ia3x2 _ca3X2 = (2 * _ra3X2) - (2 * _ia3X2); // MATLAB: cb3x2 = rb3x2 + 3*ib3x2 _cb3X2 = _rb3X2 + (3 * _ib3X2); // MATLAB: cc2x2 = rc2x2 + 2 - 3*ic2x2 _cc2X2 = _rc2X2 + 2 - (3 * _ic2X2); // MATLAB: cd2x4 = -2*rd2x4 + id2x4 + 1-j _cd2X4 = (-2 * _rd2X4) + _id2X4 + (1 - j); // MATLAB: v2 = [5 -2] _v2 = new Vector(new double[] { 5, -2 }); // MATLAB: cv2 = [5+j, -2+3j] _cv2 = new ComplexVector(new Complex[] { 5 + j, -2 + (3 * j) }); }
public void TestComplexMatrix_Setup() { /* * MATLAB: * ma3x2 = [1 -2;-1 4;5 7] * mb3x2 = [10 2.5;-3 -1.5;19 -6] * mc2x2 = [1 2;3 4] * md2x4 = [1 2 -3 12;3 3.1 4 2] * ra3x2 = ma3x2 + 2 * rb3x2 = mb3x2 - 1 * rc2x2 = mc2x2 + 5 * rd2x4 = md2x4 * 2 * ia3x2 = (ra3x2 * 2) * j * ib3x2 = (rb3x2 * 3 + 1) * j * ic2x2 = (rc2x2 + 2) * j * id2x4 = (rd2x4 - 5) * j * ca3x2 = 2*ra3x2 - 2*ia3x2 * cb3x2 = rb3x2 + 3*ib3x2 * cc2x2 = rc2x2 + 2 - 3*ic2x2 * cd2x4 = -2*rd2x4 + id2x4 + 1-j * v2 = [5 -2] * cv2 = [5+j, -2+3j] */ ma3x2 = new Matrix(new double[][] { new double[] { 1, -2 }, new double[] { -1, 4 }, new double[] { 5, 7 } }); mb3x2 = new Matrix(new double[][] { new double[] { 10, 2.5 }, new double[] { -3, -1.5 }, new double[] { 19, -6 } }); mc2x2 = new Matrix(new double[][] { new double[] { 1, 2 }, new double[] { 3, 4 } }); md2x4 = new Matrix(new double[][] { new double[] { 1, 2, -3, 12 }, new double[] { 3, 3.1, 4, 2 } }); ra3x2 = ComplexMatrix.Create(ma3x2) + 2; rb3x2 = ComplexMatrix.Create(mb3x2) - 1; rc2x2 = ComplexMatrix.Create(mc2x2) + 5; rd2x4 = ComplexMatrix.Create(md2x4) * 2; ia3x2 = (ra3x2 * 2) * j; ib3x2 = (rb3x2 * 3 + 1) * j; ic2x2 = (rc2x2 + 2) * j; id2x4 = (rd2x4 - 5) * j; ca3x2 = 2 * ra3x2 - 2 * ia3x2; cb3x2 = rb3x2 + 3 * ib3x2; cc2x2 = rc2x2 + 2 - 3 * ic2x2; cd2x4 = -2 * rd2x4 + id2x4 + (1 - j); v2 = new Vector(new double[] { 5, -2 }); cv2 = new ComplexVector(new Complex[] { 5 + j, -2 + 3 * j }); }