Example #1
0
 public void SetRowException2()
 {
     MatrixD m = new MatrixD(3, 4, rowMajor, MatrixOrder.RowMajor);
       m.SetRow(3, new VectorD(4));
 }
Example #2
0
        public void SetRow()
        {
            MatrixD m = new MatrixD(3, 4, rowMajor, MatrixOrder.RowMajor);
              m.SetRow(0, new VectorD(new double[]{ 0.1, 0.2, 0.3, 0.4 }));
              Assert.AreEqual(new VectorD(new double[] { 0.1, 0.2, 0.3, 0.4 }), m.GetRow(0));
              Assert.AreEqual(new VectorD(new double[] { 5.0, 6.0, 7.0, 8.0 }), m.GetRow(1));
              Assert.AreEqual(new VectorD(new double[] { 9.0, 10.0, 11.0, 12.0 }), m.GetRow(2));

              m.SetRow(1, new VectorD(new double[] { 0.4, 0.5, 0.6, 0.7 }));
              Assert.AreEqual(new VectorD(new double[] { 0.1, 0.2, 0.3, 0.4 }), m.GetRow(0));
              Assert.AreEqual(new VectorD(new double[] { 0.4, 0.5, 0.6, 0.7 }), m.GetRow(1));
              Assert.AreEqual(new VectorD(new double[] { 9.0, 10.0, 11.0, 12.0 }), m.GetRow(2));

              m.SetRow(2, new VectorD(new double[] { 0.7, 0.8, 0.9, 1.0 }));
              Assert.AreEqual(new VectorD(new double[] { 0.1, 0.2, 0.3, 0.4 }), m.GetRow(0));
              Assert.AreEqual(new VectorD(new double[] { 0.4, 0.5, 0.6, 0.7 }), m.GetRow(1));
              Assert.AreEqual(new VectorD(new double[] { 0.7, 0.8, 0.9, 1.0 }), m.GetRow(2));
        }