Exemplo n.º 1
0
        public CubicInterpolationImpl(List <double> xBegin, int size, List <double> yBegin,
                                      CubicInterpolation.DerivativeApprox da,
                                      bool monotonic,
                                      CubicInterpolation.BoundaryCondition leftCondition,
                                      double leftConditionValue,
                                      CubicInterpolation.BoundaryCondition rightCondition,
                                      double rightConditionValue)
            : base(xBegin, size, yBegin)
        {
            da_         = da;
            monotonic_  = monotonic;
            leftType_   = leftCondition;
            rightType_  = rightCondition;
            leftValue_  = leftConditionValue;
            rightValue_ = rightConditionValue;

            // coefficients
            primitiveConst_ = new InitializedList <double>(size - 1);
            a_ = new InitializedList <double>(size - 1);
            b_ = new InitializedList <double>(size - 1);
            c_ = new InitializedList <double>(size - 1);
            monotonicityAdjustments_ = new InitializedList <bool>(size);

            if (leftType_ == CubicInterpolation.BoundaryCondition.Lagrange ||
                rightType_ == CubicInterpolation.BoundaryCondition.Lagrange)
            {
                Utils.QL_REQUIRE(size >= 4, () =>
                                 "Lagrange boundary condition requires at least " +
                                 "4 points (" + size.ToString() + " are given)");
            }
        }
Exemplo n.º 2
0
 public Cubic(CubicInterpolation.DerivativeApprox da, bool monotonic, 
     CubicInterpolation.BoundaryCondition leftCondition, double leftConditionValue,
     CubicInterpolation.BoundaryCondition rightCondition, double rightConditionValue)
 {
     da_ = da;
     monotonic_ = monotonic;
     leftType_ = leftCondition;
     rightType_ = rightCondition;
     leftValue_ = leftConditionValue;
     rightValue_ = rightConditionValue;
 }
Exemplo n.º 3
0
 public LogCubic(CubicInterpolation.DerivativeApprox da, bool monotonic,
                 CubicInterpolation.BoundaryCondition leftCondition, double leftConditionValue,
                 CubicInterpolation.BoundaryCondition rightCondition, double rightConditionValue)
 {
     da_         = da;
     monotonic_  = monotonic;
     leftType_   = leftCondition;
     rightType_  = rightCondition;
     leftValue_  = leftConditionValue;
     rightValue_ = rightConditionValue;
 }
Exemplo n.º 4
0
        /*! \pre the \f$ x \f$ values must be sorted. */

        public LogCubicInterpolation(List <double> xBegin, int size, List <double> yBegin,
                                     CubicInterpolation.DerivativeApprox da,
                                     bool monotonic,
                                     CubicInterpolation.BoundaryCondition leftC,
                                     double leftConditionValue,
                                     CubicInterpolation.BoundaryCondition rightC,
                                     double rightConditionValue)
        {
            impl_ = new LogInterpolationImpl <Cubic>(xBegin, size, yBegin,
                                                     new Cubic(da, monotonic, leftC, leftConditionValue, rightC, rightConditionValue));
            impl_.update();
        }
Exemplo n.º 5
0
 /*! \pre the \f$ x \f$ values must be sorted. */
 public MixedLinearCubicInterpolation(List <double> xBegin, int xEnd,
                                      List <double> yBegin, int n,
                                      Behavior behavior,
                                      CubicInterpolation.DerivativeApprox da,
                                      bool monotonic,
                                      CubicInterpolation.BoundaryCondition leftC,
                                      double leftConditionValue,
                                      CubicInterpolation.BoundaryCondition rightC,
                                      double rightConditionValue)
 {
     impl_ = new MixedInterpolationImpl <Linear, Cubic>(xBegin, xEnd, yBegin, n, behavior,
                                                        new Linear(),
                                                        new Cubic(da, monotonic, leftC, leftConditionValue, rightC, rightConditionValue));
     impl_.update();
 }
Exemplo n.º 6
0
        // private CoefficientHolder coeffs_;

        public CubicInterpolation(List <double> xBegin, int size, List <double> yBegin,
                                  CubicInterpolation.DerivativeApprox da,
                                  bool monotonic,
                                  CubicInterpolation.BoundaryCondition leftCond,
                                  double leftConditionValue,
                                  CubicInterpolation.BoundaryCondition rightCond,
                                  double rightConditionValue)
        {
            impl_ = new CubicInterpolationImpl(xBegin, size, yBegin,
                                               da, monotonic,
                                               leftCond, leftConditionValue,
                                               rightCond, rightConditionValue);
            impl_.update();
            // coeffs_ = boost::dynamic_pointer_cast<detail::CoefficientHolder>(impl_);
        }
Exemplo n.º 7
0
 public MixedLinearCubic(int n,
                         Behavior behavior,
                         CubicInterpolation.DerivativeApprox da,
                         bool monotonic = true,
                         CubicInterpolation.BoundaryCondition leftCondition = QLNet.CubicInterpolation.BoundaryCondition.SecondDerivative,
                         double leftConditionValue = 0.0,
                         CubicInterpolation.BoundaryCondition rightCondition = CubicInterpolation.BoundaryCondition.SecondDerivative,
                         double rightConditionValue = 0.0)
 {
     n_          = n;
     behavior_   = behavior;
     da_         = da;
     monotonic_  = monotonic;
     leftType_   = leftCondition;
     rightType_  = rightCondition;
     leftValue_  = leftConditionValue;
     rightValue_ = rightConditionValue;
 }
Exemplo n.º 8
0
        public CubicInterpolationImpl(List <double> xBegin, int size, List <double> yBegin,
                                      CubicInterpolation.DerivativeApprox da,
                                      bool monotonic,
                                      CubicInterpolation.BoundaryCondition leftCondition,
                                      double leftConditionValue,
                                      CubicInterpolation.BoundaryCondition rightCondition,
                                      double rightConditionValue)
            : base(xBegin, size, yBegin)
        {
            da_         = da;
            monotonic_  = monotonic;
            leftType_   = leftCondition;
            rightType_  = rightCondition;
            leftValue_  = leftConditionValue;
            rightValue_ = rightConditionValue;

            // coefficients
            primitiveConst_ = new InitializedList <double>(size - 1);
            a_ = new InitializedList <double>(size - 1);
            b_ = new InitializedList <double>(size - 1);
            c_ = new InitializedList <double>(size - 1);
            monotonicityAdjustments_ = new InitializedList <bool>(size);
        }
Exemplo n.º 9
0
        public CubicInterpolationImpl(List<double> xBegin, int size, List<double> yBegin,
            CubicInterpolation.DerivativeApprox da,
            bool monotonic,
            CubicInterpolation.BoundaryCondition leftCondition,
            double leftConditionValue,
            CubicInterpolation.BoundaryCondition rightCondition,
            double rightConditionValue)
            : base(xBegin, size, yBegin)
        {
            da_ = da;
            monotonic_ = monotonic;
            leftType_ = leftCondition;
            rightType_ = rightCondition;
            leftValue_ = leftConditionValue;
            rightValue_ = rightConditionValue;

            // coefficients
            primitiveConst_ = new InitializedList<double>(size - 1);
            a_ = new InitializedList<double>(size - 1);
            b_ = new InitializedList<double>(size - 1);
            c_ = new InitializedList<double>(size - 1);
            monotonicityAdjustments_ = new InitializedList<bool>(size);
        }