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


Java BivariateFunction类代码示例

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


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

示例1: computePartialDerivatives

import org.apache.commons.math3.analysis.BivariateFunction; //导入依赖的package包/类
/**
 * Compute all partial derivatives.
 */
private void computePartialDerivatives() {
    final int lastI = xval.length - 1;
    final int lastJ = yval.length - 1;
    partialDerivatives = new BivariateFunction[5][lastI][lastJ];

    for (int i = 0; i < lastI; i++) {
        for (int j = 0; j < lastJ; j++) {
            final BicubicSplineFunction f = splines[i][j];
            partialDerivatives[0][i][j] = f.partialDerivativeX();
            partialDerivatives[1][i][j] = f.partialDerivativeY();
            partialDerivatives[2][i][j] = f.partialDerivativeXX();
            partialDerivatives[3][i][j] = f.partialDerivativeYY();
            partialDerivatives[4][i][j] = f.partialDerivativeXY();
        }
    }
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:20,代码来源:BicubicSplineInterpolatingFunction.java

示例2: testPlane

import org.apache.commons.math3.analysis.BivariateFunction; //导入依赖的package包/类
/**
 * Interpolating a plane.
 * <p>
 * z = 2 x - 3 y + 5
 */
@Test
public void testPlane() {
    final int numberOfElements = 10;
    final double minimumX = -10;
    final double maximumX = 10;
    final double minimumY = -10;
    final double maximumY = 10;
    final int numberOfSamples = 100;

    final double interpolationTolerance = 7e-15;
    final double maxTolerance = 6e-14;

    // Function values
    BivariateFunction f = new BivariateFunction() {
            public double value(double x, double y) {
                return 2 * x - 3 * y + 5;
            }
        };

    testInterpolation(minimumX,
                      maximumX,
                      minimumY,
                      maximumY,
                      numberOfElements,
                      numberOfSamples,
                      f,
                      interpolationTolerance,
                      maxTolerance);
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:35,代码来源:PiecewiseBicubicSplineInterpolatingFunctionTest.java

示例3: testParabaloid

import org.apache.commons.math3.analysis.BivariateFunction; //导入依赖的package包/类
/**
 * Interpolating a paraboloid.
 * <p>
 * z = 2 x<sup>2</sup> - 3 y<sup>2</sup> + 4 x y - 5
 */
@Test
public void testParabaloid() {
    final int numberOfElements = 10;
    final double minimumX = -10;
    final double maximumX = 10;
    final double minimumY = -10;
    final double maximumY = 10;
    final int numberOfSamples = 100;

    final double interpolationTolerance = 2e-14;
    final double maxTolerance = 6e-14;

    // Function values
    BivariateFunction f = new BivariateFunction() {
            public double value(double x, double y) {
                return 2 * x * x - 3 * y * y + 4 * x * y - 5;
            }
        };

    testInterpolation(minimumX,
                      maximumX,
                      minimumY,
                      maximumY,
                      numberOfElements,
                      numberOfSamples,
                      f,
                      interpolationTolerance,
                      maxTolerance);
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:35,代码来源:PiecewiseBicubicSplineInterpolatingFunctionTest.java

示例4: testPlane

import org.apache.commons.math3.analysis.BivariateFunction; //导入依赖的package包/类
/**
 * Interpolating a plane.
 * <p>
 * z = 2 x - 3 y + 5
 */
@Test
public void testPlane() {
    BivariateFunction f = new BivariateFunction() {
            public double value(double x, double y) {
                return 2 * x - 3 * y + 5;
            }
        };

    testInterpolation(3000,
                      1e-13,
                      f,
                      false);
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:19,代码来源:BicubicInterpolatorTest.java

示例5: testParaboloid

import org.apache.commons.math3.analysis.BivariateFunction; //导入依赖的package包/类
/**
 * Interpolating a paraboloid.
 * <p>
 * z = 2 x<sup>2</sup> - 3 y<sup>2</sup> + 4 x y - 5
 */
@Test
public void testParaboloid() {
    BivariateFunction f = new BivariateFunction() {
            public double value(double x, double y) {
                return 2 * x * x - 3 * y * y + 4 * x * y - 5;
            }
        };

    testInterpolation(3000,
                      1e-12,
                      f,
                      false);
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:19,代码来源:BicubicInterpolatorTest.java

示例6: getBiInterpFunc

import org.apache.commons.math3.analysis.BivariateFunction; //导入依赖的package包/类
/**
 * Make interpolation function for grid data
 * @param x X data
 * @param y Y data
 * @param z Z data
 * @return Interpolation function
 */
public static BivariateFunction getBiInterpFunc(Array x, Array y, Array z) {
    double[] xd = (double[]) ArrayUtil.copyToNDJavaArray(x);
    double[] yd = (double[]) ArrayUtil.copyToNDJavaArray(y);
    double[][] zd = (double[][]) ArrayUtil.copyToNDJavaArray(z);
    BivariateGridInterpolator li = new BicubicInterpolator();
    BivariateFunction func = li.interpolate(xd, yd, zd);

    return func;
}
 
开发者ID:meteoinfo,项目名称:MeteoInfoLib,代码行数:17,代码来源:InterpUtil.java

示例7: evaluate

import org.apache.commons.math3.analysis.BivariateFunction; //导入依赖的package包/类
/**
 * Compute the value of the function
 * @param func The function
 * @param x Input x data
 * @param y Input y data
 * @return Function value
 */
public static Array evaluate(BivariateFunction func, Array x, Array y) {
    Array r = Array.factory(DataType.DOUBLE, x.getShape());
    for (int i = 0; i < r.getSize(); i++)
        r.setDouble(i, func.value(x.getDouble(i), y.getDouble(i)));
    
    return r;
}
 
开发者ID:meteoinfo,项目名称:MeteoInfoLib,代码行数:15,代码来源:InterpUtil.java

示例8: partialDerivativeX

import org.apache.commons.math3.analysis.BivariateFunction; //导入依赖的package包/类
/**
 * @return the partial derivative wrt {@code x}.
 */
public BivariateFunction partialDerivativeX() {
    if (partialDerivativeX == null) {
        computePartialDerivatives();
    }

    return partialDerivativeX;
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:11,代码来源:BicubicSplineInterpolatingFunction.java

示例9: partialDerivativeY

import org.apache.commons.math3.analysis.BivariateFunction; //导入依赖的package包/类
/**
 * @return the partial derivative wrt {@code y}.
 */
public BivariateFunction partialDerivativeY() {
    if (partialDerivativeY == null) {
        computePartialDerivatives();
    }

    return partialDerivativeY;
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:11,代码来源:BicubicSplineInterpolatingFunction.java

示例10: partialDerivativeXX

import org.apache.commons.math3.analysis.BivariateFunction; //导入依赖的package包/类
/**
 * @return the second partial derivative wrt {@code x}.
 */
public BivariateFunction partialDerivativeXX() {
    if (partialDerivativeXX == null) {
        computePartialDerivatives();
    }

    return partialDerivativeXX;
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:11,代码来源:BicubicSplineInterpolatingFunction.java

示例11: partialDerivativeYY

import org.apache.commons.math3.analysis.BivariateFunction; //导入依赖的package包/类
/**
 * @return the second partial derivative wrt {@code y}.
 */
public BivariateFunction partialDerivativeYY() {
    if (partialDerivativeYY == null) {
        computePartialDerivatives();
    }

    return partialDerivativeYY;
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:11,代码来源:BicubicSplineInterpolatingFunction.java

示例12: partialDerivativeXY

import org.apache.commons.math3.analysis.BivariateFunction; //导入依赖的package包/类
/**
 * @return the second partial cross-derivative.
 */
public BivariateFunction partialDerivativeXY() {
    if (partialDerivativeXY == null) {
        computePartialDerivatives();
    }

    return partialDerivativeXY;
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:11,代码来源:BicubicSplineInterpolatingFunction.java

示例13: interpolate

import org.apache.commons.math3.analysis.BivariateFunction; //导入依赖的package包/类
@Override
public BivariateFunction interpolate(double[] xval, double[] yval, double[][] fval) throws NoDataException, DimensionMismatchException, NonMonotonicSequenceException, NumberIsTooSmallException {
    if (xval.length == 0 || yval.length == 0 || fval.length == 0)
        throw new NoDataException();
    if (xval.length != fval.length)
        throw new DimensionMismatchException(xval.length, fval.length);
    if (yval.length != fval[0].length)
        throw new DimensionMismatchException(yval.length, fval[0].length);
    MathArrays.checkOrder(xval);
    MathArrays.checkOrder(yval);
    return new BilinearInterpolatingFunction(xval, yval, fval);
}
 
开发者ID:vimsh,项目名称:mafscaling,代码行数:13,代码来源:Utils.java

示例14: calculateNewValues

import org.apache.commons.math3.analysis.BivariateFunction; //导入依赖的package包/类
private static double[][] calculateNewValues(
	double[][] data, int interpolationLevel
) {
	final int initialRows = data.length;
	final int initialColumns = data[0].length;
	
	final BivariateGridInterpolator interpolator = new BilinearInterpolator();
	final BivariateFunction function = interpolator.interpolate(
		IntStream.range(0, initialRows).asDoubleStream().toArray(),
		IntStream.range(0, initialColumns).asDoubleStream().toArray(),
		data
	);
	
	final int newNumRows = CALCULATE_SIZE.applyAsInt(
		initialRows, interpolationLevel);
	final int newNumColumns = CALCULATE_SIZE.applyAsInt(
		initialColumns, interpolationLevel);
	
	final double[][] newValues = new double[newNumRows][newNumColumns];
	
	final double xFactor = ((double) initialRows - 1d) / ((double) newNumRows - 1d);
	final double yFactor = ((double) initialColumns - 1d) / ((double) newNumColumns - 1d);
	for (int i = 0; i < newValues.length; i++) {
		for (int j = 0; j < newValues[i].length; j++) {
			newValues[i][j] = function.value(
				(double) i * xFactor, (double) j * yFactor
			);
		}
	}
	
	return newValues;
}
 
开发者ID:sing-group,项目名称:la-images,代码行数:33,代码来源:Interpolator.java


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