本文整理汇总了Java中org.apache.commons.math3.exception.util.LocalizedFormats.WRONG_NUMBER_OF_POINTS属性的典型用法代码示例。如果您正苦于以下问题:Java LocalizedFormats.WRONG_NUMBER_OF_POINTS属性的具体用法?Java LocalizedFormats.WRONG_NUMBER_OF_POINTS怎么用?Java LocalizedFormats.WRONG_NUMBER_OF_POINTS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.commons.math3.exception.util.LocalizedFormats
的用法示例。
在下文中一共展示了LocalizedFormats.WRONG_NUMBER_OF_POINTS属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findReferences
/** Find the facets that reference each edges.
* @param vertices list of polyhedrons set vertices
* @param facets list of facets, as vertices indices in the vertices list
* @return references array such that r[v][k] = f for some k if facet f contains vertex v
* @exception MathIllegalArgumentException if some facets have fewer than 3 vertices
* @since 3.5
*/
private static int[][] findReferences(final List<Vector3D> vertices, final List<int[]> facets) {
// find the maximum number of facets a vertex belongs to
final int[] nbFacets = new int[vertices.size()];
int maxFacets = 0;
for (final int[] facet : facets) {
if (facet.length < 3) {
throw new NumberIsTooSmallException(LocalizedFormats.WRONG_NUMBER_OF_POINTS,
3, facet.length, true);
}
for (final int index : facet) {
maxFacets = FastMath.max(maxFacets, ++nbFacets[index]);
}
}
// set up the references array
final int[][] references = new int[vertices.size()][maxFacets];
for (int[] r : references) {
Arrays.fill(r, -1);
}
for (int f = 0; f < facets.size(); ++f) {
for (final int v : facets.get(f)) {
// vertex v is referenced by facet f
int k = 0;
while (k < maxFacets && references[v][k] >= 0) {
++k;
}
references[v][k] = f;
}
}
return references;
}
示例2: verifyInterpolationArray
/**
* Check that the interpolation arrays are valid.
* The arrays features checked by this method are that both arrays have the
* same length and this length is at least 2.
*
* @param x Interpolating points array.
* @param y Interpolating values array.
* @param abort Whether to throw an exception if {@code x} is not sorted.
* @throws DimensionMismatchException if the array lengths are different.
* @throws NumberIsTooSmallException if the number of points is less than 2.
* @throws org.apache.commons.math3.exception.NonMonotonicSequenceException
* if {@code x} is not sorted in strictly increasing order and {@code abort}
* is {@code true}.
* @return {@code false} if the {@code x} is not sorted in increasing order,
* {@code true} otherwise.
* @see #evaluate(double[], double[], double)
* @see #computeCoefficients()
*/
public static boolean verifyInterpolationArray(double x[], double y[], boolean abort)
throws DimensionMismatchException, NumberIsTooSmallException, NonMonotonicSequenceException {
if (x.length != y.length) {
throw new DimensionMismatchException(x.length, y.length);
}
if (x.length < 2) {
throw new NumberIsTooSmallException(LocalizedFormats.WRONG_NUMBER_OF_POINTS, 2, x.length, true);
}
return MathArrays.checkOrder(x, MathArrays.OrderDirection.INCREASING, true, abort);
}