예제 #1
0
        public void DivideDoubleSingleValues()
        {
            INode <double> left  = Flow.Constant(10.0);
            INode <double> right = Flow.Constant(4.0);

            var divide = Flow.Divide(left, right);

            Assert.AreEqual(left.Rank, divide.Rank);
            Assert.IsTrue(left.Shape.SequenceEqual(right.Shape));

            var result = divide.Evaluate();

            Assert.IsNotNull(result);
            Assert.AreEqual(left.Rank, result.Rank);
            Assert.IsTrue(left.Shape.SequenceEqual(result.Shape));
            Assert.AreEqual(2.5, result.GetValue());
        }
예제 #2
0
        public void DivideIntegerSingleValues()
        {
            INode <int> left  = Flow.Constant(84);
            INode <int> right = Flow.Constant(2);

            var divide = Flow.Divide(left, right);

            Assert.AreEqual(left.Rank, divide.Rank);
            Assert.IsTrue(left.Shape.SequenceEqual(right.Shape));

            var result = divide.Evaluate();

            Assert.IsNotNull(result);
            Assert.AreEqual(left.Rank, result.Rank);
            Assert.IsTrue(left.Shape.SequenceEqual(result.Shape));
            Assert.AreEqual(42, result.GetValue());
        }
예제 #3
0
        public void DivideDoubleVectors()
        {
            INode <double> left  = Flow.Constant(new double[] { 4, 5, 6 });
            INode <double> right = Flow.Constant(new double[] { 1, 2, 3 });

            var divide = Flow.Divide(left, right);

            Assert.AreEqual(left.Rank, divide.Rank);
            Assert.IsTrue(left.Shape.SequenceEqual(right.Shape));

            var result = divide.Evaluate();

            Assert.IsNotNull(result);
            Assert.AreEqual(left.Rank, result.Rank);
            Assert.IsTrue(left.Shape.SequenceEqual(result.Shape));
            Assert.AreEqual(4.0, result.GetValue(0));
            Assert.AreEqual(2.5, result.GetValue(1));
            Assert.AreEqual(2.0, result.GetValue(2));
        }
예제 #4
0
        public void DivideDoubleMatrices()
        {
            INode <double> left  = Flow.Constant(new double[][] { new double[] { 10, 20, 30 }, new double[] { 40, 50, 60 } });
            INode <double> right = Flow.Constant(new double[][] { new double[] { 1, 2, 3 }, new double[] { 4, 5, 6 } });

            var divide = Flow.Divide(left, right);

            Assert.AreEqual(left.Rank, divide.Rank);
            Assert.IsTrue(left.Shape.SequenceEqual(right.Shape));

            var result = divide.Evaluate();

            Assert.IsNotNull(result);
            Assert.AreEqual(left.Rank, result.Rank);
            Assert.IsTrue(left.Shape.SequenceEqual(result.Shape));

            Assert.AreEqual(10, result.GetValue(0, 0));
            Assert.AreEqual(10, result.GetValue(0, 1));
            Assert.AreEqual(10, result.GetValue(0, 2));

            Assert.AreEqual(10, result.GetValue(1, 0));
            Assert.AreEqual(10, result.GetValue(1, 1));
            Assert.AreEqual(10, result.GetValue(1, 2));
        }