/// <summary>
        /// Compute an interpolated value from a set of known (x,y) values by Cubic Hermite Spline interpolation.
        /// Extrapolation is NOT available.
        /// </summary>
        /// <param name="xArray">Array (row/column) of x-values.</param>
        /// <param name="yArray">Array (row/column) of y-values.</param>
        /// <param name="target">Value at which to compute the interpolation.</param>
        /// <returns></returns>
        public double CubicHermiteSplineInterpolate(double[] xArray, double[] yArray, double target)
        {
            if (xArray == null)
            {
                return(0);
            }
            if (yArray == null)
            {
                return(0);
            }
            var chsi = new CubicHermiteSplineInterpolation();

            chsi.Initialize(xArray, yArray);//CubicSplineInterpolation.InterpolateAkima(xArray, yArray);
            return(chsi.ValueAt(target, true));
        }
        public void TestFindBoundingInterval()
        {
            #region Test: Extrapolation at Left End Detected

            _target = 273d;

            try
            {
                _interpObj.ValueAt(_target, true);
            }
            catch (System.Exception e)
            {
                const string ErrorMessage =
                    "Cubic Hermite Spline does not support extrapolation";

                Assert.AreEqual(ErrorMessage, e.Message);
            }

            #endregion Test: Extrapolation at Left End Detected

            #region Test: Extrapolation at Right End Detected

            _target = 5480.0001d;

            try
            {
                _interpObj.ValueAt(_target, true);
            }
            catch (System.Exception e)
            {
                const string ErrorMessage =
                    "Cubic Hermite Spline does not support extrapolation";

                Assert.AreEqual(ErrorMessage, e.Message);
            }

            #endregion Test: Extrapolation at Right End Detected

            #region Test: Target Point at the Extreme Left

            _target = 274d;
            _interpObj.ValueAt(_target, true);
            Assert.AreEqual(0m, _interpObj.LeftIndex);
            Assert.AreEqual(1m, _interpObj.RightIndex);

            #endregion  Test: Target Point at the Extreme Left

            #region Test: Target Point at the Extreme Right

            _target = 5480d;
            _interpObj.ValueAt(_target, true);
            Assert.AreEqual(_xArray.Length - 2, _interpObj.LeftIndex);
            Assert.AreEqual(_xArray.Length - 1, _interpObj.RightIndex);

            #endregion Test: Target Point at the Extreme Right

            #region Test: Target Point at the Second Knot Point

            _target = 365d;
            _interpObj.ValueAt(_target, true);
            Assert.AreEqual(1, _interpObj.LeftIndex);
            Assert.AreEqual(2, _interpObj.RightIndex);

            #endregion Test: Target Point at the Second Knot Point

            #region Test: Target Point at the Second Last Knot Point

            _target = 3654d;
            _interpObj.ValueAt(_target, true);
            Assert.AreEqual(_xArray.Length - 2, _interpObj.LeftIndex);
            Assert.AreEqual(_xArray.Length - 1, _interpObj.RightIndex);

            #endregion Test: Target Point at the Second Last Knot Point

            #region Test: Target Point Bounded by Second and Third Points

            _target = 500d;
            _interpObj.ValueAt(_target, true);
            Assert.AreEqual(1, _interpObj.LeftIndex);
            Assert.AreEqual(2, _interpObj.RightIndex);

            #endregion Test: Target Point Bounded by Second and Third Points

            #region Test:Target Point Bounded by Second and Third Last Points

            _target = 3000d;
            _interpObj.ValueAt(_target, true);
            Assert.AreEqual(_xArray.Length - 3, _interpObj.LeftIndex);
            Assert.AreEqual(_xArray.Length - 2, _interpObj.RightIndex);

            #endregion Test:Target Point Bounded by Second and Third Last Points
        }