Examples of differentiate()


Examples of com.opengamma.analytics.math.differentiation.VectorFieldFirstOrderDifferentiator.differentiate()

   * @return value of the fitted parameters
   */
  public LeastSquareResults solve(final DoubleMatrix1D observedValues, final DoubleMatrix1D sigma, final Function1D<DoubleMatrix1D, DoubleMatrix1D> func, final DoubleMatrix1D startPos,
      final DoubleMatrix2D penalty, final Function1D<DoubleMatrix1D, Boolean> allowedValue) {
    final VectorFieldFirstOrderDifferentiator jac = new VectorFieldFirstOrderDifferentiator();
    return solve(observedValues, sigma, func, jac.differentiate(func), startPos, penalty, allowedValue);
  }

  /**
   * Use this when the model is given as a function of its parameters only (i.e. a function that takes a set of parameters and return a set of model values,
   * so the measurement points are already known to the function), and  analytic parameter sensitivity is available
View Full Code Here

Examples of com.opengamma.analytics.math.differentiation.VectorFieldFirstOrderDifferentiator.differentiate()

   * @return value of the fitted parameters
   */
  public LeastSquareResults solve(final DoubleMatrix1D observedValues, final Function1D<DoubleMatrix1D, DoubleMatrix1D> func, final DoubleMatrix1D startPos) {
    final int n = observedValues.getNumberOfElements();
    final VectorFieldFirstOrderDifferentiator jac = new VectorFieldFirstOrderDifferentiator();
    return solve(observedValues, new DoubleMatrix1D(n, 1.0), func, jac.differentiate(func), startPos, null);
  }

  /**
   *  Use this when the model is given as a function of its parameters only (i.e. a function that takes a set of parameters and return a set of model values,
   *  so the measurement points are already known to the function), and  analytic parameter sensitivity is not available
View Full Code Here

Examples of com.opengamma.analytics.math.differentiation.VectorFieldFirstOrderDifferentiator.differentiate()

   * @return value of the fitted parameters
   */
  public LeastSquareResults solve(final DoubleMatrix1D observedValues, final DoubleMatrix1D sigma, final Function1D<DoubleMatrix1D, DoubleMatrix1D> func,
      final DoubleMatrix1D startPos) {
    final VectorFieldFirstOrderDifferentiator jac = new VectorFieldFirstOrderDifferentiator();
    return solve(observedValues, sigma, func, jac.differentiate(func), startPos, null);
  }

  /**
   *  Use this when the model is given as a function of its parameters only (i.e. a function that takes a set of parameters and return a set of model values,
   *  so the measurement points are already known to the function), and  analytic parameter sensitivity is not available
View Full Code Here

Examples of com.opengamma.analytics.math.differentiation.VectorFieldFirstOrderDifferentiator.differentiate()

   * @return value of the fitted parameters
   */
  public LeastSquareResults solve(final DoubleMatrix1D observedValues, final DoubleMatrix1D sigma, final Function1D<DoubleMatrix1D, DoubleMatrix1D> func,
      final DoubleMatrix1D startPos, final DoubleMatrix1D maxJumps) {
    final VectorFieldFirstOrderDifferentiator jac = new VectorFieldFirstOrderDifferentiator();
    return solve(observedValues, sigma, func, jac.differentiate(func), startPos, maxJumps);
  }

  /**
   * Use this when the model is given as a function of its parameters only (i.e. a function that takes a set of parameters and return a set of model values,
   * so the measurement points are already known to the function), and  analytic parameter sensitivity is available
View Full Code Here

Examples of com.opengamma.analytics.math.differentiation.VectorFieldFirstOrderDifferentiator.differentiate()

    final Function1D<DoubleMatrix1D, DoubleMatrix1D> func = _fitter.getModelValueFunction();
    final Function1D<DoubleMatrix1D, DoubleMatrix2D> jacFunc = _fitter.getModelJacobianFunction();

    final VectorFieldFirstOrderDifferentiator differ = new VectorFieldFirstOrderDifferentiator();
    final Function1D<DoubleMatrix1D, DoubleMatrix2D> jacFuncFD = differ.differentiate(func);

    final DoubleMatrix2D jac = jacFunc.evaluate(x);
    final DoubleMatrix2D jacFD = jacFuncFD.evaluate(x);
    final int rows = jacFD.getNumberOfRows();
    final int cols = jacFD.getNumberOfColumns();
View Full Code Here

Examples of com.opengamma.analytics.math.differentiation.VectorFieldFirstOrderDifferentiator.differentiate()

  @Test
  public void testJacobian() {

    final VectorFieldFirstOrderDifferentiator jacFDCal = new VectorFieldFirstOrderDifferentiator();
    final Function1D<DoubleMatrix1D, DoubleMatrix1D> func = new CapletStrippingFunction(CAPS, YIELD_CURVES, VOL_MODEL_PROVIDER);
    final Function1D<DoubleMatrix1D, DoubleMatrix2D> jacFDFunc = jacFDCal.differentiate(func);
    final Function1D<DoubleMatrix1D, DoubleMatrix2D> jacAnalFunc = new CapletStrippingJacobian(CAPS, YIELD_CURVES, CURVE_NODES, INTERPOLATORS, TRANSFORMS, null);

    final DoubleMatrix2D jacFD = jacFDFunc.evaluate(END);
    final DoubleMatrix2D jacAnal = jacAnalFunc.evaluate(END);
    final int rows = jacFD.getNumberOfRows();
View Full Code Here

Examples of com.opengamma.analytics.math.differentiation.VectorFieldFirstOrderDifferentiator.differentiate()

    NonLinearTransformFunction transFunc = new NonLinearTransformFunction(FUNCTION, JACOBIAN, transforms);
    Function1D<DoubleMatrix1D, DoubleMatrix1D> func = transFunc.getFittingFunction();
    Function1D<DoubleMatrix1D, DoubleMatrix2D> jacFunc = transFunc.getFittingJacobian();

    VectorFieldFirstOrderDifferentiator diff = new VectorFieldFirstOrderDifferentiator();
    Function1D<DoubleMatrix1D, DoubleMatrix2D> jacFuncFD = diff.differentiate(func);

    DoubleMatrix1D testPoint = new DoubleMatrix1D(new double[] {4.5, -2.1 });
    DoubleMatrix2D jac = jacFunc.evaluate(testPoint);
    DoubleMatrix2D jacFD = jacFuncFD.evaluate(testPoint);
    assertEquals(3, jac.getNumberOfRows());
View Full Code Here

Examples of com.opengamma.analytics.math.differentiation.VectorFieldFirstOrderDifferentiator.differentiate()

  }

  @Override
  public DoubleMatrix1D getRoot(final Function1D<DoubleMatrix1D, DoubleMatrix1D> function, final DoubleMatrix1D startPosition) {
    final VectorFieldFirstOrderDifferentiator jac = new VectorFieldFirstOrderDifferentiator();
    return getRoot(function, jac.differentiate(function), startPosition);
  }

  /**
   *@param function a vector function (i.e. vector to vector)
   *@param jacobianFunction calculates the Jacobian
View Full Code Here

Examples of com.opengamma.analytics.math.differentiation.VectorFieldSecondOrderDifferentiator.differentiate()

        final SVDecompositionCommons svd = (SVDecompositionCommons) DecompositionFactory.SV_COMMONS;

        //add the second derivative information to the Hessian matrix to check we are not at a local maximum or saddle point
        final VectorFieldSecondOrderDifferentiator diff = new VectorFieldSecondOrderDifferentiator();
        final Function1D<DoubleMatrix1D, DoubleMatrix2D[]> secDivFunc = diff.differentiate(func, constraints);
        final DoubleMatrix2D[] secDiv = secDivFunc.evaluate(trialTheta);
        final double[][] temp = new double[nParms][nParms];
        for (int i = 0; i < nObs; i++) {
          for (int j = 0; j < nParms; j++) {
            for (int k = 0; k < nParms; k++) {
View Full Code Here

Examples of com.opengamma.analytics.math.function.PiecewisePolynomialFunction1D.differentiate()

   * @param x1Key
   * @return Value of first derivative with respect to x0 at (x0Key, x1Key)
   */
  public double differentiateX0(final double[] x0Values, final double[] x1Values, final double[][] yValues, final double x0Key, final double x1Key) {
    final PiecewisePolynomialFunction1D func = new PiecewisePolynomialFunction1D();
    final double[] interpX0Diff = func.differentiate(_method[0].interpolate(x0Values, OG_ALGEBRA.getTranspose(new DoubleMatrix2D(yValues)).getData()), x0Key).getData();
    return _method[1].interpolate(x1Values, interpX0Diff, x1Key);
  }

  /**
   * @param x0Values
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.