本文整理汇总了Java中org.apache.commons.math3.analysis.ParametricUnivariateFunction类的典型用法代码示例。如果您正苦于以下问题:Java ParametricUnivariateFunction类的具体用法?Java ParametricUnivariateFunction怎么用?Java ParametricUnivariateFunction使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ParametricUnivariateFunction类属于org.apache.commons.math3.analysis包,在下文中一共展示了ParametricUnivariateFunction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDaoCalibration
import org.apache.commons.math3.analysis.ParametricUnivariateFunction; //导入依赖的package包/类
@Override
public DaostormCalibration getDaoCalibration() {
ParametricUnivariateFunction sqrtFn = new DefocusFunctionSqrt().getFittingFunction();
ParametricUnivariateFunction polyFn = new DefocusFunctionPoly().getFittingFunction();
CurveFitter<ParametricUnivariateFunction> fitter1 = new CurveFitter<ParametricUnivariateFunction>(new LevenbergMarquardtOptimizer(new SimplePointChecker(10e-10, 10e-10)));
CurveFitter<ParametricUnivariateFunction> fitter2 = new CurveFitter<ParametricUnivariateFunction>(new LevenbergMarquardtOptimizer(new SimplePointChecker(10e-10, 10e-10)));
double [] polyParams1 = new double[] {w01, c1, a1, b1, d1};
double [] polyParams2 = new double[] {w02, c2, a2, b2, d2};
double zRange = ceil(2*(abs(c1)+abs(c2))); // -zRange:+zRange
for(double z = -zRange; z <= zRange; z += 5.0) {
fitter1.addObservedPoint(z, polyFn.value(z, polyParams1));
fitter2.addObservedPoint(z, polyFn.value(z, polyParams2));
}
double [] parSigma1 = fitter1.fit(1000, sqrtFn, new double[] {2.0, c1, 0.0, 0.0, zRange/2.0});
double [] parSigma2 = fitter2.fit(1000, sqrtFn, new double[] {2.0, c2, 0.0, 0.0, zRange/2.0});
return new DaostormCalibration(angle, homography, parSigma1[0], parSigma1[2], parSigma1[3], parSigma1[1], parSigma1[4],
parSigma2[0], parSigma2[2], parSigma2[3], parSigma2[1], parSigma2[4]);
}
示例2: testPolynomialFit
import org.apache.commons.math3.analysis.ParametricUnivariateFunction; //导入依赖的package包/类
@Test
public void testPolynomialFit() {
final Random randomizer = new Random(53882150042L);
final RealDistribution rng = new UniformRealDistribution(-100, 100);
rng.reseedRandomGenerator(64925784252L);
final double[] coeff = { 12.9, -3.4, 2.1 }; // 12.9 - 3.4 x + 2.1 x^2
final PolynomialFunction f = new PolynomialFunction(coeff);
// Collect data from a known polynomial.
final WeightedObservedPoints obs = new WeightedObservedPoints();
for (int i = 0; i < 100; i++) {
final double x = rng.sample();
obs.add(x, f.value(x) + 0.1 * randomizer.nextGaussian());
}
final ParametricUnivariateFunction function = new PolynomialFunction.Parametric();
// Start fit from initial guesses that are far from the optimal values.
final SimpleCurveFitter fitter
= SimpleCurveFitter.create(function,
new double[] { -1e20, 3e15, -5e25 });
final double[] best = fitter.fit(obs.toList());
TestUtils.assertEquals("best != coeff", coeff, best, 2e-2);
}
示例3: testMath303
import org.apache.commons.math3.analysis.ParametricUnivariateFunction; //导入依赖的package包/类
@Test
public void testMath303() {
LevenbergMarquardtOptimizer optimizer = new LevenbergMarquardtOptimizer();
CurveFitter<ParametricUnivariateFunction> fitter = new CurveFitter<ParametricUnivariateFunction>(optimizer);
fitter.addObservedPoint(2.805d, 0.6934785852953367d);
fitter.addObservedPoint(2.74333333333333d, 0.6306772025518496d);
fitter.addObservedPoint(1.655d, 0.9474675497289684);
fitter.addObservedPoint(1.725d, 0.9013594835804194d);
ParametricUnivariateFunction sif = new SimpleInverseFunction();
double[] initialguess1 = new double[1];
initialguess1[0] = 1.0d;
Assert.assertEquals(1, fitter.fit(sif, initialguess1).length);
double[] initialguess2 = new double[2];
initialguess2[0] = 1.0d;
initialguess2[1] = .5d;
Assert.assertEquals(2, fitter.fit(sif, initialguess2).length);
}
示例4: testMath304
import org.apache.commons.math3.analysis.ParametricUnivariateFunction; //导入依赖的package包/类
@Test
public void testMath304() {
LevenbergMarquardtOptimizer optimizer = new LevenbergMarquardtOptimizer();
CurveFitter<ParametricUnivariateFunction> fitter = new CurveFitter<ParametricUnivariateFunction>(optimizer);
fitter.addObservedPoint(2.805d, 0.6934785852953367d);
fitter.addObservedPoint(2.74333333333333d, 0.6306772025518496d);
fitter.addObservedPoint(1.655d, 0.9474675497289684);
fitter.addObservedPoint(1.725d, 0.9013594835804194d);
ParametricUnivariateFunction sif = new SimpleInverseFunction();
double[] initialguess1 = new double[1];
initialguess1[0] = 1.0d;
Assert.assertEquals(1.6357215104109237, fitter.fit(sif, initialguess1)[0], 1.0e-14);
double[] initialguess2 = new double[1];
initialguess2[0] = 10.0d;
Assert.assertEquals(1.6357215104109237, fitter.fit(sif, initialguess1)[0], 1.0e-14);
}
示例5: testMath303
import org.apache.commons.math3.analysis.ParametricUnivariateFunction; //导入依赖的package包/类
@Test
public void testMath303() {
LevenbergMarquardtOptimizer optimizer = new LevenbergMarquardtOptimizer();
CurveFitter<ParametricUnivariateFunction> fitter = new CurveFitter<ParametricUnivariateFunction>(optimizer);
fitter.addObservedPoint(2.805d, 0.6934785852953367d);
fitter.addObservedPoint(2.74333333333333d, 0.6306772025518496d);
fitter.addObservedPoint(1.655d, 0.9474675497289684);
fitter.addObservedPoint(1.725d, 0.9013594835804194d);
ParametricUnivariateFunction sif = new SimpleInverseFunction();
double[] initialguess1 = new double[1];
initialguess1[0] = 1.0d;
Assert.assertEquals(1, fitter.fit(sif, initialguess1).length);
double[] initialguess2 = new double[2];
initialguess2[0] = 1.0d;
initialguess2[1] = .5d;
Assert.assertEquals(2, fitter.fit(sif, initialguess2).length);
}
示例6: testMath304
import org.apache.commons.math3.analysis.ParametricUnivariateFunction; //导入依赖的package包/类
@Test
public void testMath304() {
LevenbergMarquardtOptimizer optimizer = new LevenbergMarquardtOptimizer();
CurveFitter<ParametricUnivariateFunction> fitter = new CurveFitter<ParametricUnivariateFunction>(optimizer);
fitter.addObservedPoint(2.805d, 0.6934785852953367d);
fitter.addObservedPoint(2.74333333333333d, 0.6306772025518496d);
fitter.addObservedPoint(1.655d, 0.9474675497289684);
fitter.addObservedPoint(1.725d, 0.9013594835804194d);
ParametricUnivariateFunction sif = new SimpleInverseFunction();
double[] initialguess1 = new double[1];
initialguess1[0] = 1.0d;
Assert.assertEquals(1.6357215104109237, fitter.fit(sif, initialguess1)[0], 1.0e-14);
double[] initialguess2 = new double[1];
initialguess2[0] = 10.0d;
Assert.assertEquals(1.6357215104109237, fitter.fit(sif, initialguess1)[0], 1.0e-14);
}
示例7: TheoreticalValuesFunction
import org.apache.commons.math3.analysis.ParametricUnivariateFunction; //导入依赖的package包/类
/**
* @param f function to fit.
* @param observations Observations.
*/
public TheoreticalValuesFunction(final ParametricUnivariateFunction f,
final Collection<WeightedObservedPoint> observations) {
this.f = f;
final int len = observations.size();
this.points = new double[len];
int i = 0;
for (WeightedObservedPoint obs : observations) {
this.points[i++] = obs.getX();
}
}
示例8: MyFuncFitter
import org.apache.commons.math3.analysis.ParametricUnivariateFunction; //导入依赖的package包/类
MyFuncFitter(ParametricUnivariateFunction func) {
this.func = func;
}
示例9: TheoreticalValuesFunction
import org.apache.commons.math3.analysis.ParametricUnivariateFunction; //导入依赖的package包/类
/**
* @param f function to fit.
*/
TheoreticalValuesFunction(final ParametricUnivariateFunction f) {
this.f = f;
}
示例10: OldTheoreticalValuesFunction
import org.apache.commons.math3.analysis.ParametricUnivariateFunction; //导入依赖的package包/类
/** Simple constructor.
* @param f function to fit.
*/
OldTheoreticalValuesFunction(final ParametricUnivariateFunction f) {
this.f = f;
}
示例11: TheoreticalValuesFunction
import org.apache.commons.math3.analysis.ParametricUnivariateFunction; //导入依赖的package包/类
/** Simple constructor.
* @param f function to fit.
*/
TheoreticalValuesFunction(final ParametricUnivariateFunction f) {
this.f = f;
}
示例12: computeResiduals
import org.apache.commons.math3.analysis.ParametricUnivariateFunction; //导入依赖的package包/类
private void computeResiduals(double[] parameters, ParametricUnivariateFunction function, double[] x, double[] y, double[] residualArray) {
for(int i = 0; i < x.length; i++) {
double dx = y[i] - function.value(x[i], parameters);
residualArray[i] = dx * dx;
}
}
示例13: TheoreticalValuesFunction
import org.apache.commons.math3.analysis.ParametricUnivariateFunction; //导入依赖的package包/类
/**
* @param f function to fit.
*/
public TheoreticalValuesFunction(final ParametricUnivariateFunction f) {
this.f = f;
}
示例14: OldTheoreticalValuesFunction
import org.apache.commons.math3.analysis.ParametricUnivariateFunction; //导入依赖的package包/类
/** Simple constructor.
* @param f function to fit.
*/
public OldTheoreticalValuesFunction(final ParametricUnivariateFunction f) {
this.f = f;
}
示例15: TheoreticalValuesFunction
import org.apache.commons.math3.analysis.ParametricUnivariateFunction; //导入依赖的package包/类
/** Simple constructor.
* @param f function to fit.
*/
public TheoreticalValuesFunction(final ParametricUnivariateFunction f) {
this.f = f;
}