Esempio n. 1
0
        public void Abs()
        {
            // arrange
            var srcArray = NdArray <int> .Linspace(HostDevice.Instance, -4, 4, 8);

            // action
            var newArray = ElementWiseMathFunction <int> .Abs(srcArray);

            // assert
            Assert.IsTrue(newArray[0].Value > 0);
        }
Esempio n. 2
0
        public void Ceiling()
        {
            // arrange
            var srcArray = NdArray <double> .Linspace(HostDevice.Instance, -1, 1, 6);

            // action
            var newArray = ElementWiseMathFunction <double> .Ceiling(srcArray);

            // assert
            Assert.AreEqual(-1.0, newArray[0].Value);
            Assert.AreEqual(0.0, newArray[1].Value);
            Assert.AreEqual(1.0, newArray[4].Value);
        }
Esempio n. 3
0
        public void Atan()
        {
            // arrange
            var srcArray = NdArray <double> .Linspace(HostDevice.Instance, -1, 1, 3);

            // action
            var newArray = ElementWiseMathFunction <double> .Atan(srcArray);

            // assert
            const double Epsilon = 1e-8;

            Assert.IsTrue(Math.Abs(newArray[0].Value - (-Math.PI / 4.0)) < Epsilon);
            Assert.IsTrue(Math.Abs(newArray[1].Value - 0.0) < Epsilon);
            Assert.IsTrue(Math.Abs(newArray[2].Value - (Math.PI / 4.0)) < Epsilon);
        }