Esempio n. 1
0
        public void CanSubtract()
        {
            BiasesVector bv1 = new BiasesVector(Vector <double> .Build.DenseOfArray(new double[] { 1, 2 }));
            BiasesVector bv2 = new BiasesVector(Vector <double> .Build.DenseOfArray(new double[] { 2, 3 }));
            BiasesVector bv3 = bv2.Subtract(bv1);

            Assert.AreEqual(1, bv3[0]);
            Assert.AreEqual(1, bv3[1]);
        }
Esempio n. 2
0
        public void CanAdd()
        {
            BiasesVector bv1 = new BiasesVector(Vector <double> .Build.DenseOfArray(new double[] { 1, 2 }));
            BiasesVector bv2 = new BiasesVector(Vector <double> .Build.DenseOfArray(new double[] { 2, 3 }));
            BiasesVector bv3 = bv1.Add(bv2);

            Assert.AreEqual(3, bv3[0]);
            Assert.AreEqual(5, bv3[1]);
        }
Esempio n. 3
0
 public void CannotMakeBad()
 {
     try
     {
         BiasesVector bv1 = new BiasesVector(Vector <double> .Build.Dense(0));
         BiasesVector bv2 = new BiasesVector(0);
         Assert.Fail("BiasesVector constructor failed to throw an exception: ");
     }
     catch (ArgumentOutOfRangeException)
     { }
 }
Esempio n. 4
0
 public void CanMake()
 {
     try
     {
         BiasesVector bv1 = new BiasesVector(Vector <double> .Build.Dense(1));
         BiasesVector bv2 = new BiasesVector(1);
     }
     catch (Exception e)
     {
         Assert.Fail("BiasesVector constructor threw and exception: " + e.Message);
     }
 }
Esempio n. 5
0
        public void CannotSubractMismatched()
        {
            try
            {
                BiasesVector bv1 = new BiasesVector(Vector <double> .Build.DenseOfArray(new double[] { 1, 2 }));
                BiasesVector bv2 = new BiasesVector(Vector <double> .Build.DenseOfArray(new double[] { 2, 3, 4 }));
                BiasesVector bv3 = bv2.Subtract(bv1);

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