Examples of differentiate()


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

  @Override
  public DoubleMatrix1D minimize(final Function1D<DoubleMatrix1D, Double> function, final DoubleMatrix1D startPosition) {
    Validate.notNull(function, "function");
    Validate.notNull(startPosition, "start position");
    final ScalarFieldFirstOrderDifferentiator diff = new ScalarFieldFirstOrderDifferentiator();
    final Function1D<DoubleMatrix1D, DoubleMatrix1D> grad = diff.differentiate(function);
    return minimize(function, grad, startPosition);
  }

  /**
   * {@inheritDoc}
 
View Full Code Here

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

        return ird.accept(valueCalculator, curves);
      }
    };

    final ScalarFieldFirstOrderDifferentiator fd = new ScalarFieldFirstOrderDifferentiator();
    final Function1D<DoubleMatrix1D, DoubleMatrix1D> grad = fd.differentiate(f);

    return grad.evaluate(new DoubleMatrix1D(yields));

  }
View Full Code Here

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

        return ird.accept(valueCalculator, curves);
      }
    };

    final ScalarFieldFirstOrderDifferentiator fd = new ScalarFieldFirstOrderDifferentiator();
    final Function1D<DoubleMatrix1D, DoubleMatrix1D> grad = fd.differentiate(f);
    return grad.evaluate(new DoubleMatrix1D(param));
  }
}
View Full Code Here

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

        return ird.accept(valueCalculator, curves);
      }
    };

    final ScalarFieldFirstOrderDifferentiator fd = new ScalarFieldFirstOrderDifferentiator();
    final Function1D<DoubleMatrix1D, DoubleMatrix1D> grad = fd.differentiate(f);

    return grad.evaluate(new DoubleMatrix1D(yields));

  }
View Full Code Here

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

        return ird.accept(valueCalculator, curves);
      }
    };

    final ScalarFieldFirstOrderDifferentiator fd = new ScalarFieldFirstOrderDifferentiator();
    final Function1D<DoubleMatrix1D, DoubleMatrix1D> grad = fd.differentiate(f);
    return grad.evaluate(new DoubleMatrix1D(df));
  }

  protected InstrumentDerivative getSwap() {
    return SWAP;
View Full Code Here

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

    final Function1D<Double, Double> grad = diff.differentiate(func);
    assertEquals(-0.5, grad.evaluate(0.0), 1e-8);

    final Function1D<DoubleMatrix1D, Double> params_func = VECTOR_PARAMS.asFunctionOfParameters(1.0);
    final ScalarFieldFirstOrderDifferentiator vdiff = new ScalarFieldFirstOrderDifferentiator();
    final Function1D<DoubleMatrix1D, DoubleMatrix1D> vgrad = vdiff.differentiate(params_func);
    final DoubleMatrix1D res = vgrad.evaluate(new DoubleMatrix1D(new double[] {Math.PI, 0}));
    assertEquals(0.0, res.getEntry(0), 1e-8);
    assertEquals(Math.PI, res.getEntry(1), 1e-8);
  }
}
View Full Code Here

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

    final Function1D<Double, Double> func = VECTOR_PARAMS.asFunctionOfArguments(parms);
    assertEquals(1.0, func.evaluate(-Math.PI), 0.0);

    final ScalarFirstOrderDifferentiator diff = new ScalarFirstOrderDifferentiator();
    final Function1D<Double, Double> grad = diff.differentiate(func);
    assertEquals(-0.5, grad.evaluate(0.0), 1e-8);

    final Function1D<DoubleMatrix1D, Double> params_func = VECTOR_PARAMS.asFunctionOfParameters(1.0);
    final ScalarFieldFirstOrderDifferentiator vdiff = new ScalarFieldFirstOrderDifferentiator();
    final Function1D<DoubleMatrix1D, DoubleMatrix1D> vgrad = vdiff.differentiate(params_func);
View Full Code Here

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

  @Test
  public void testDerivative() {
    final Function1D<Double, Double> func = CURVE_NS.toFunction1D();
    final ScalarFirstOrderDifferentiator diff = new ScalarFirstOrderDifferentiator();
    final Function1D<Double, Double> grad = diff.differentiate(func);

    for (int i = 0; i < 50; i++) {
      final double t = 0 + 10.0 * i / 99.;
      final double fd = grad.evaluate(t);
      final double anal = CURVE_NS.getDyDx(t);
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 DoubleMatrix2D penalty) {
    final int n = observedValues.getNumberOfElements();
    final VectorFieldFirstOrderDifferentiator jac = new VectorFieldFirstOrderDifferentiator();
    return solve(observedValues, new DoubleMatrix1D(n, 1.0), func, jac.differentiate(func), startPos, penalty);
  }

  /**
   *  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 DoubleMatrix2D penalty) {
    final VectorFieldFirstOrderDifferentiator jac = new VectorFieldFirstOrderDifferentiator();
    return solve(observedValues, sigma, func, jac.differentiate(func), startPos, penalty);
  }

  /**
   *  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
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.