Example #1
0
        public void CanSubtract()
        {
            DataVector dv1 = new DataVector(Vector <double> .Build.DenseOfArray(new double[] { 1, 2 }));
            DataVector dv2 = new DataVector(Vector <double> .Build.DenseOfArray(new double[] { 2, 3 }));
            DataVector dv3 = dv2.Subtract(dv1);

            Assert.AreEqual(1, dv3[0]);
            Assert.AreEqual(1, dv3[1]);
        }
Example #2
0
        public void CannotSubractMismatched()
        {
            try
            {
                DataVector dv1 = new DataVector(Vector <double> .Build.DenseOfArray(new double[] { 1, 2 }));
                DataVector dv2 = new DataVector(Vector <double> .Build.DenseOfArray(new double[] { 2, 3, 4 }));
                DataVector dv3 = dv2.Subtract(dv1);

                Assert.Fail("Subtract failed to throw an ArgumentOutOfRangeException.");
            }
            catch (ArgumentOutOfRangeException)
            { }
        }