Example #1
0
        public void Cosh()
        {
            // arrange
            const int NumElements = 3;
            var       targetData  = new double[NumElements];
            var       srcData     = new[] { -Math.PI / 2.0, -0.0, -Math.PI / 2.0 };

            var target = new DataAndLayout <double>(targetData, new FastAccess(new Layout(new int[] { NumElements }, 0, new int[] { 1 })));
            var src    = new DataAndLayout <double>(srcData, new FastAccess(new Layout(new int[] { NumElements }, 0, new int[] { 1 })));

            // action
            ScalarOps.Cosh(target, src);

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

            Assert.IsTrue(Math.Abs(targetData[0] - 2.5091784786580567) < Epsilon);
            Assert.IsTrue(Math.Abs(targetData[1] - 1.0) < Epsilon);
            Assert.IsTrue(Math.Abs(targetData[2] - 2.5091784786580567) < Epsilon);
        }