当前位置: 首页>>代码示例>>Java>>正文


Java ParametricUnivariateFunction类代码示例

本文整理汇总了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]);
}
 
开发者ID:zitmen,项目名称:thunderstorm,代码行数:24,代码来源:PolynomialCalibration.java

示例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);
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:26,代码来源:SimpleCurveFitterTest.java

示例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);
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:21,代码来源:CurveFitterTest.java

示例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);
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:20,代码来源:CurveFitterTest.java

示例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);

}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:23,代码来源:CurveFitterTest.java

示例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);

}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:22,代码来源:CurveFitterTest.java

示例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();
    }
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:16,代码来源:AbstractCurveFitter.java

示例8: MyFuncFitter

import org.apache.commons.math3.analysis.ParametricUnivariateFunction; //导入依赖的package包/类
MyFuncFitter(ParametricUnivariateFunction func) {
	this.func = func;
}
 
开发者ID:Auraya,项目名称:armorvox-client,代码行数:4,代码来源:VxmlClientGetVoiceprint.java

示例9: TheoreticalValuesFunction

import org.apache.commons.math3.analysis.ParametricUnivariateFunction; //导入依赖的package包/类
/**
 * @param f function to fit.
 */
TheoreticalValuesFunction(final ParametricUnivariateFunction f) {
    this.f = f;
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:7,代码来源:CurveFitter.java

示例10: OldTheoreticalValuesFunction

import org.apache.commons.math3.analysis.ParametricUnivariateFunction; //导入依赖的package包/类
/** Simple constructor.
 * @param f function to fit.
 */
OldTheoreticalValuesFunction(final ParametricUnivariateFunction f) {
    this.f = f;
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:7,代码来源:CurveFitter.java

示例11: TheoreticalValuesFunction

import org.apache.commons.math3.analysis.ParametricUnivariateFunction; //导入依赖的package包/类
/** Simple constructor.
 * @param f function to fit.
 */
TheoreticalValuesFunction(final ParametricUnivariateFunction f) {
    this.f = f;
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:7,代码来源:CurveFitter.java

示例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;
    }
}
 
开发者ID:zitmen,项目名称:thunderstorm,代码行数:7,代码来源:IterativeFitting.java

示例13: TheoreticalValuesFunction

import org.apache.commons.math3.analysis.ParametricUnivariateFunction; //导入依赖的package包/类
/**
 * @param f function to fit.
 */
public TheoreticalValuesFunction(final ParametricUnivariateFunction f) {
    this.f = f;
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:7,代码来源:CurveFitter.java

示例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;
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:7,代码来源:CurveFitter.java

示例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;
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:7,代码来源:CurveFitter.java


注:本文中的org.apache.commons.math3.analysis.ParametricUnivariateFunction类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。