Java Code Examples for org.apache.commons.math3.exception.util.LocalizedFormats#SIMPLEX_NEED_ONE_POINT

The following examples show how to use org.apache.commons.math3.exception.util.LocalizedFormats#SIMPLEX_NEED_ONE_POINT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractSimplex.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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];
            }
        }
    }
}
 
Example 2
Source File: AbstractSimplex.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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];
            }
        }
    }
}
 
Example 3
Source File: AbstractSimplex.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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];
            }
        }
    }
}
 
Example 4
Source File: AbstractSimplex.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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];
            }
        }
    }
}
 
Example 5
Source File: AbstractSimplex.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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];
            }
        }
    }
}
 
Example 6
Source File: AbstractSimplex.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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];
            }
        }
    }
}
 
Example 7
Source File: AbstractSimplex.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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];
            }
        }
    }
}
 
Example 8
Source File: AbstractSimplex.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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];
            }
        }
    }
}
 
Example 9
Source File: AbstractSimplex.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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];
            }
        }
    }
}
 
Example 10
Source File: AbstractSimplex.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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];
            }
        }
    }
}
 
Example 11
Source File: AbstractSimplex.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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];
            }
        }
    }
}
 
Example 12
Source File: AbstractSimplex.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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];
            }
        }
    }
}
 
Example 13
Source File: AbstractSimplex.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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];
            }
        }
    }
}