本文整理汇总了Java中org.apache.commons.math3.exception.util.LocalizedFormats.SIMPLEX_NEED_ONE_POINT属性的典型用法代码示例。如果您正苦于以下问题:Java LocalizedFormats.SIMPLEX_NEED_ONE_POINT属性的具体用法?Java LocalizedFormats.SIMPLEX_NEED_ONE_POINT怎么用?Java LocalizedFormats.SIMPLEX_NEED_ONE_POINT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.commons.math3.exception.util.LocalizedFormats
的用法示例。
在下文中一共展示了LocalizedFormats.SIMPLEX_NEED_ONE_POINT属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AbstractSimplex
/**
* The real initial simplex will be set up by moving the reference
* simplex such that its first point is located at the start point of the
* optimization.
*
* @param referenceSimplex Reference simplex.
* @throws NotStrictlyPositiveException if the reference simplex does not
* contain at least one point.
* @throws DimensionMismatchException if there is a dimension mismatch
* in the reference simplex.
* @throws IllegalArgumentException if one of its vertices is duplicated.
*/
protected AbstractSimplex(final double[][] referenceSimplex) {
if (referenceSimplex.length <= 0) {
throw new NotStrictlyPositiveException(LocalizedFormats.SIMPLEX_NEED_ONE_POINT,
referenceSimplex.length);
}
dimension = referenceSimplex.length - 1;
// Only the relative position of the n final vertices with respect
// to the first one are stored.
startConfiguration = new double[dimension][dimension];
final double[] ref0 = referenceSimplex[0];
// Loop over vertices.
for (int i = 0; i < referenceSimplex.length; i++) {
final double[] refI = referenceSimplex[i];
// Safety checks.
if (refI.length != dimension) {
throw new DimensionMismatchException(refI.length, dimension);
}
for (int j = 0; j < i; j++) {
final double[] refJ = referenceSimplex[j];
boolean allEquals = true;
for (int k = 0; k < dimension; k++) {
if (refI[k] != refJ[k]) {
allEquals = false;
break;
}
}
if (allEquals) {
throw new MathIllegalArgumentException(LocalizedFormats.EQUAL_VERTICES_IN_SIMPLEX,
i, j);
}
}
// Store vertex i position relative to vertex 0 position.
if (i > 0) {
final double[] confI = startConfiguration[i - 1];
for (int k = 0; k < dimension; k++) {
confI[k] = refI[k] - ref0[k];
}
}
}
}