Esempio n. 1
0
 /*************************************************************************
 *  This subroutine differentiates the spline.
 *
 *  INPUT PARAMETERS:
 *   C   -   spline interpolant.
 *   X   -   point
 *
 *  Result:
 *   S   -   S(x)
 *   DS  -   S'(x)
 *   D2S -   S''(x)
 *
 *  -- ALGLIB PROJECT --
 *    Copyright 24.06.2007 by Bochkanov Sergey
 *************************************************************************/
 public static void spline1ddiff(Spline1dinterpolant c, double x, out double s, out double ds, out double d2s)
 {
     s   = 0;
     ds  = 0;
     d2s = 0;
     Spline1d.spline1ddiff(c.innerobj, x, ref s, ref ds, ref d2s);
     return;
 }
Esempio n. 2
0
        public static void spline1dbuildlinear(double[] x, double[] y, out Spline1dinterpolant c)
        {
            int n;

            if ((ap.len(x) != ap.len(y)))
            {
                throw new alglibexception("Ошибка при вызове 'spline1dbuildlinear': похоже, что один из аргументов имеет неправильный размер");
            }
            c = new Spline1dinterpolant();
            n = ap.len(x);
            Spline1d.spline1dbuildlinear(x, y, n, c.innerobj);
        }
Esempio n. 3
0
 /*************************************************************************
 *  This subroutine builds Catmull-Rom spline interpolant.
 *
 *  INPUT PARAMETERS:
 *   X           -   spline nodes, array[0..N-1].
 *   Y           -   function values, array[0..N-1].
 *
 *  OPTIONAL PARAMETERS:
 *   N           -   points count:
 * N>=2
 * if given, only first N points are used to build spline
 * if not given, automatically detected from X/Y sizes
 *                     (len(X) must be equal to len(Y))
 *   BoundType   -   boundary condition type:
 * -1 for periodic boundary condition
 *  0 for parabolically terminated spline (default)
 *   Tension     -   tension parameter:
 * tension=0   corresponds to classic Catmull-Rom spline (default)
 * 0<tension<1 corresponds to more general form - cardinal spline
 *
 *  OUTPUT PARAMETERS:
 *   C           -   spline interpolant
 *
 *
 *  ORDER OF POINTS
 *
 *  Subroutine automatically sorts points, so caller may pass unsorted array.
 *
 *  PROBLEMS WITH PERIODIC BOUNDARY CONDITIONS:
 *
 *  Problems with periodic boundary conditions have Y[first_point]=Y[last_point].
 *  However, this subroutine doesn't require you to specify equal  values  for
 *  the first and last points - it automatically forces them  to  be  equal by
 *  copying  Y[first_point]  (corresponds  to the leftmost,  minimal  X[])  to
 *  Y[last_point]. However it is recommended to pass consistent values of Y[],
 *  i.e. to make Y[first_point]=Y[last_point].
 *
 *  -- ALGLIB PROJECT --
 *    Copyright 23.06.2007 by Bochkanov Sergey
 *************************************************************************/
 public static void spline1dbuildcatmullrom(double[] x, double[] y, int n, int boundtype, double tension, out Spline1dinterpolant c)
 {
     c = new Spline1dinterpolant();
     Spline1d.spline1dbuildcatmullrom(x, y, n, boundtype, tension, c.innerobj);
     return;
 }
Esempio n. 4
0
 /*************************************************************************
 *  Эта подпрограмма строит интеполянт линейного сплайна
 *
 *  ВХОДНЫЕ ПАРАМЕТРЫ:
 *   X   -   узлы сплайна, массив[0..N-1]
 *   Y   -   значения функци, массив[0..N-1]
 *   N   -   число точек (опционально):
 * N>=2
 * если задано, для построения сплайна используются только первые N точек
 * если не указано, автоматически определяется по размерам X / Y
 *             (length(X) должно быть равно length(Y))
 *
 *  ВЫХОДНЫЕ ПАРАМЕТРЫ:
 *   C   -   интерполянт сплайна
 *
 *
 *  ПОРЯДОК ТОЧЕК:
 *
 *  Подпрограмма автоматически сортирует точки, поэтому вызывающий может передать несортированный массив.
 *
 *  -- ALGLIB PROJECT --
 *    Copyright 24.06.2007 by Bochkanov Sergey
 *************************************************************************/
 public static void spline1dbuildlinear(double[] x, double[] y, int n, out Spline1dinterpolant c)
 {
     c = new Spline1dinterpolant();
     Spline1d.spline1dbuildlinear(x, y, n, c.innerobj);
 }
Esempio n. 5
0
        /*************************************************************************
        *  This subroutine integrates the spline.
        *
        *  INPUT PARAMETERS:
        *   C   -   spline interpolant.
        *   X   -   right bound of the integration interval [a, x],
        *           here 'a' denotes min(x[])
        *  Result:
        *   integral(S(t)dt,a,x)
        *
        *  -- ALGLIB PROJECT --
        *    Copyright 23.06.2007 by Bochkanov Sergey
        *************************************************************************/
        public static double spline1dintegrate(Spline1dinterpolant c, double x)
        {
            double result = Spline1d.spline1dintegrate(c.innerobj, x);

            return(result);
        }
Esempio n. 6
0
 /*************************************************************************
 *  This subroutine builds Akima spline interpolant
 *
 *  INPUT PARAMETERS:
 *   X           -   spline nodes, array[0..N-1]
 *   Y           -   function values, array[0..N-1]
 *   N           -   points count (optional):
 * N>=2
 * if given, only first N points are used to build spline
 * if not given, automatically detected from X/Y sizes
 *                     (len(X) must be equal to len(Y))
 *
 *  OUTPUT PARAMETERS:
 *   C           -   spline interpolant
 *
 *
 *  ORDER OF POINTS
 *
 *  Subroutine automatically sorts points, so caller may pass unsorted array.
 *
 *  -- ALGLIB PROJECT --
 *    Copyright 24.06.2007 by Bochkanov Sergey
 *************************************************************************/
 public static void spline1dbuildakima(double[] x, double[] y, int n, out Spline1dinterpolant c)
 {
     c = new Spline1dinterpolant();
     Spline1d.spline1dbuildakima(x, y, n, c.innerobj);
     return;
 }