• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java GaussIntegrator类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.commons.math3.analysis.integration.gauss.GaussIntegrator的典型用法代码示例。如果您正苦于以下问题:Java GaussIntegrator类的具体用法?Java GaussIntegrator怎么用?Java GaussIntegrator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



GaussIntegrator类属于org.apache.commons.math3.analysis.integration.gauss包,在下文中一共展示了GaussIntegrator类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: stage

import org.apache.commons.math3.analysis.integration.gauss.GaussIntegrator; //导入依赖的package包/类
/**
 * Compute the n-th stage integral.
 *
 * @param n Number of steps.
 * @return the value of n-th stage integral.
 * @throws TooManyEvaluationsException if the maximum number of evaluations
 * is exceeded.
 */
private double stage(final int n)
    throws TooManyEvaluationsException {
    // Function to be integrated is stored in the base class.
    final UnivariateFunction f = new UnivariateFunction() {
            public double value(double x)
                throws MathIllegalArgumentException, TooManyEvaluationsException {
                return computeObjectiveValue(x);
            }
        };

    final double min = getMin();
    final double max = getMax();
    final double step = (max - min) / n;

    double sum = 0;
    for (int i = 0; i < n; i++) {
        // Integrate over each sub-interval [a, b].
        final double a = min + i * step;
        final double b = a + step;
        final GaussIntegrator g = FACTORY.legendreHighPrecision(numberOfPoints, a, b);
        sum += g.integrate(f);
    }

    return sum;
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:34,代码来源:IterativeLegendreGaussIntegrator.java


示例2: integrate2d

import org.apache.commons.math3.analysis.integration.gauss.GaussIntegrator; //导入依赖的package包/类
public static double integrate2d(final ToDoubleBiFunction<Double, Double> getIntegrand,
                          final double xLowerBound, final double xUpperBound, final int xNumPoints,
                          final double yLowerBound, final double yUpperBound, final int yNumPoints){
    final GaussIntegrator xIntegrator = integratorFactory.legendre(xNumPoints, xLowerBound, xUpperBound);
    final GaussIntegrator yIntegrator = integratorFactory.legendre(yNumPoints, yLowerBound, yUpperBound);

    final double[] xIntegrationWeights = new IndexRange(0, xNumPoints).mapToDouble(xIntegrator::getWeight);
    final double[] xAbscissas = new IndexRange(0, xNumPoints).mapToDouble(xIntegrator::getPoint);

    final double[] yIntegrationWeights = new IndexRange(0, yNumPoints).mapToDouble(yIntegrator::getWeight);
    final double[] yAbscissas = new IndexRange(0, yNumPoints).mapToDouble(yIntegrator::getPoint);

    double integral = 0;
    for (int i = 0; i < xNumPoints; i++) {
        final double x = xAbscissas[i];
        for (int j = 0; j < yNumPoints; j++) {
            final double y = yAbscissas[j];
            final double integrand = getIntegrand.applyAsDouble(x, y);
            integral += xIntegrationWeights[i] * yIntegrationWeights[j] * integrand;
        }
    }

    return integral;
}
 
开发者ID:broadinstitute,项目名称:gatk-protected,代码行数:25,代码来源:IntegrationUtils.java


示例3: initializeIntegrationQuadrature

import org.apache.commons.math3.analysis.integration.gauss.GaussIntegrator; //导入依赖的package包/类
/**
 * Initilizes the quadrature for calculating allele ratio integrals in
 * {@link HeterogeneousHeterozygousPileupPriorModel#getHetLogLikelihood(List)}
 *
 * @param numIntegPoints  number of points in the quadrature
 */
private void initializeIntegrationQuadrature(final int numIntegPoints) {
    /* get Gauss-Legendre quadrature factory of order @numIntegPoints */
    final GaussIntegratorFactory integratorFactory = new GaussIntegratorFactory();
    final GaussIntegrator gaussIntegrator = integratorFactory.legendre(numIntegPoints,
            minHetAlleleFraction, 1.0 - minHetAlleleFraction);

    /* abscissas */
    gaussIntegrationAbscissas.clear();
    gaussIntegrationAbscissas.addAll(IntStream.range(0, numIntegPoints).
            mapToDouble(gaussIntegrator::getPoint).boxed().collect(Collectors.toList()));

    /* weights */
    gaussIntegrationWeights.clear();
    gaussIntegrationWeights.addAll(IntStream.range(0, numIntegPoints).
            mapToDouble(gaussIntegrator::getWeight).boxed().collect(Collectors.toList()));

    /* log of weights */
    gaussIntegrationLogWeights.clear();
    gaussIntegrationLogWeights.addAll(gaussIntegrationWeights.stream().
            mapToDouble(FastMath::log).boxed().collect(Collectors.toList()));
}
 
开发者ID:broadinstitute,项目名称:gatk-protected,代码行数:28,代码来源:HeterogeneousHeterozygousPileupPriorModel.java


示例4: stage

import org.apache.commons.math3.analysis.integration.gauss.GaussIntegrator; //导入依赖的package包/类
/**
 * Compute the n-th stage integral.
 *
 * @param n Number of steps.
 * @return the value of n-th stage integral.
 * @throws TooManyEvaluationsException if the maximum number of evaluations
 * is exceeded.
 */
private double stage(final int n)
    throws TooManyEvaluationsException {
    // Function to be integrated is stored in the base class.
    final UnivariateFunction f = new UnivariateFunction() {
            public double value(double x) {
                return computeObjectiveValue(x);
            }
        };

    final double min = getMin();
    final double max = getMax();
    final double step = (max - min) / n;

    double sum = 0;
    for (int i = 0; i < n; i++) {
        // Integrate over each sub-interval [a, b].
        final double a = min + i * step;
        final double b = a + step;
        final GaussIntegrator g = FACTORY.legendreHighPrecision(numberOfPoints, a, b);
        sum += g.integrate(f);
    }

    return sum;
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:33,代码来源:IterativeLegendreGaussIntegrator.java


示例5: stage

import org.apache.commons.math3.analysis.integration.gauss.GaussIntegrator; //导入依赖的package包/类
/**
 * Compute the n-th stage integral.
 *
 * @param n Number of steps.
 * @return the value of n-th stage integral.
 * @throws TooManyEvaluationsException if the maximum number of evaluations
 * is exceeded.
 */
private double stage(final int n)
    throws TooManyEvaluationsException {
    // Function to be integrated is stored in the base class.
    final UnivariateFunction f = new UnivariateFunction() {
            /** {@inheritDoc} */
            public double value(double x)
                throws MathIllegalArgumentException, TooManyEvaluationsException {
                return computeObjectiveValue(x);
            }
        };

    final double min = getMin();
    final double max = getMax();
    final double step = (max - min) / n;

    double sum = 0;
    for (int i = 0; i < n; i++) {
        // Integrate over each sub-interval [a, b].
        final double a = min + i * step;
        final double b = a + step;
        final GaussIntegrator g = FACTORY.legendreHighPrecision(numberOfPoints, a, b);
        sum += g.integrate(f);
    }

    return sum;
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:35,代码来源:IterativeLegendreGaussIntegrator.java


示例6: integrate

import org.apache.commons.math3.analysis.integration.gauss.GaussIntegrator; //导入依赖的package包/类
public static double integrate(final DoubleFunction<Double> getIntegrand,
                               final double lowerBound,
                               final double upperBound,
                               final int numPoints) {
    final GaussIntegrator integrator = integratorFactory.legendre(numPoints, lowerBound, upperBound);

    final double[] gaussIntegrationWeights = new IndexRange(0, numPoints).mapToDouble(integrator::getWeight);
    final double[] gaussIntegrationAbscissas = new IndexRange(0, numPoints).mapToDouble(integrator::getPoint);
    final double[] integrands = MathUtils.applyToArrayInPlace(gaussIntegrationAbscissas,getIntegrand::apply);

    return GATKProtectedMathUtils.dotProduct(gaussIntegrationWeights, integrands);
}
 
开发者ID:broadinstitute,项目名称:gatk-protected,代码行数:13,代码来源:IntegrationUtils.java


示例7: integrate

import org.apache.commons.math3.analysis.integration.gauss.GaussIntegrator; //导入依赖的package包/类
public static double integrate(final DoubleFunction<Double> getIntegrand,
                               final double lowerBound,
                               final double upperBound,
                               final int numPoints) {
    final GaussIntegrator integrator = integratorFactory.legendre(numPoints, lowerBound, upperBound);

    final double[] gaussIntegrationWeights = new IndexRange(0, numPoints).mapToDouble(integrator::getWeight);
    final double[] gaussIntegrationAbscissas = new IndexRange(0, numPoints).mapToDouble(integrator::getPoint);
    final double[] integrands = MathUtils.applyToArrayInPlace(gaussIntegrationAbscissas,getIntegrand::apply);

    return MathUtils.dotProduct(gaussIntegrationWeights, integrands);
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:13,代码来源:IntegrationUtils.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AccelerationSensorOptions类代码示例发布时间:2022-05-22
下一篇:
Java GwtScriptOnly类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap