示例#1
0
        public void CanAdd()
        {
            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 = dv1.Add(dv2);

            Assert.AreEqual(3, dv3[0]);
            Assert.AreEqual(5, dv3[1]);
        }
示例#2
0
        public void CannotAddMismatched()
        {
            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 = dv1.Add(dv2);

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