本文整理汇总了Java中org.apache.commons.math3.util.MathArrays.ebeSubtract方法的典型用法代码示例。如果您正苦于以下问题:Java MathArrays.ebeSubtract方法的具体用法?Java MathArrays.ebeSubtract怎么用?Java MathArrays.ebeSubtract使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.math3.util.MathArrays
的用法示例。
在下文中一共展示了MathArrays.ebeSubtract方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: value
import org.apache.commons.math3.util.MathArrays; //导入方法依赖的package包/类
/**
* Estimate the value at the requested location.
* This microsphere is placed at the given {@code point}, contribution
* of the given {@code samplePoints} to each sphere facet is computed
* (illumination) and the interpolation is performed (integration of
* the illumination).
*
* @param point Interpolation point.
* @param samplePoints Sampling data points.
* @param sampleValues Sampling data values at the corresponding
* {@code samplePoints}.
* @param exponent Exponent used in the power law that computes
* the weights (distance dimming factor) of the sample data.
* @param noInterpolationTolerance When the distance between the
* {@code point} and one of the {@code samplePoints} is less than
* this value, no interpolation will be performed, and the value
* of the sample will just be returned.
* @return the estimated value at the given {@code point}.
* @throws NotPositiveException if {@code exponent < 0}.
*/
public double value(double[] point,
double[][] samplePoints,
double[] sampleValues,
double exponent,
double noInterpolationTolerance) {
if (exponent < 0) {
throw new NotPositiveException(exponent);
}
clear();
// Contribution of each sample point to the illumination of the
// microsphere's facets.
final int numSamples = samplePoints.length;
for (int i = 0; i < numSamples; i++) {
// Vector between interpolation point and current sample point.
final double[] diff = MathArrays.ebeSubtract(samplePoints[i], point);
final double diffNorm = MathArrays.safeNorm(diff);
if (FastMath.abs(diffNorm) < noInterpolationTolerance) {
// No need to interpolate, as the interpolation point is
// actually (very close to) one of the sampled points.
return sampleValues[i];
}
final double weight = FastMath.pow(diffNorm, -exponent);
illuminate(diff, sampleValues[i], weight);
}
return interpolate();
}