Examples of MathIllegalArgumentException


Examples of org.apache.commons.math3.exception.MathIllegalArgumentException

     * @return the smallest prime greater than or equal to n.
     * @throws MathIllegalArgumentException if n < 0.
     */
    public static int nextPrime(int n) {
        if (n < 0) {
            throw new MathIllegalArgumentException(LocalizedFormats.NUMBER_TOO_SMALL, n, 0);
        }
        if (n == 2) {
            return 2;
        }
        n |= 1;//make sure n is odd
View Full Code Here

Examples of org.apache.commons.math3.exception.MathIllegalArgumentException

     * @throws MathIllegalArgumentException if n &lt; 2.
     */
    public static List<Integer> primeFactors(int n) {

        if (n < 2) {
            throw new MathIllegalArgumentException(LocalizedFormats.NUMBER_TOO_SMALL, n, 2);
        }
        // slower than trial div unless we do an awful lot of computation
        // (then it finally gets JIT-compiled efficiently
        // List<Integer> out = PollardRho.primeFactors(n);
        return SmallPrimes.trialDivision(n);
View Full Code Here

Examples of org.apache.commons.math3.exception.MathIllegalArgumentException

   */
  public Rotation(Vector3D axis, double angle) throws MathIllegalArgumentException {

    double norm = axis.getNorm();
    if (norm == 0) {
      throw new MathIllegalArgumentException(LocalizedFormats.ZERO_NORM_FOR_ROTATION_AXIS);
    }

    double halfAngle = -0.5 * angle;
    double coeff = FastMath.sin(halfAngle) / norm;

View Full Code Here

Examples of org.apache.commons.math3.exception.MathIllegalArgumentException

    public FieldRotation(final FieldVector3D<T> axis, final T angle)
        throws MathIllegalArgumentException {

        final T norm = axis.getNorm();
        if (norm.getReal() == 0) {
            throw new MathIllegalArgumentException(LocalizedFormats.ZERO_NORM_FOR_ROTATION_AXIS);
        }

        final T halfAngle = angle.multiply(-0.5);
        final T coeff = halfAngle.sin().divide(norm);
View Full Code Here

Examples of org.apache.commons.math3.exception.MathIllegalArgumentException

        // assign tolerance as it will be used by the isConvex method
        this.tolerance = tolerance;

        if (!isConvex(vertices)) {
            throw new MathIllegalArgumentException(LocalizedFormats.NOT_CONVEX);
        }

        this.vertices = vertices.clone();
    }
View Full Code Here

Examples of org.apache.commons.math3.exception.MathIllegalArgumentException

            c1Y = cXY * cY1 - cYY * cX1;
            c1X = cXX * cY1 - cYX * cX1;
            c11 = cXX * cYY - cYX * cXY;

            if (FastMath.abs(c11) < 1.0e-20) {
                throw new MathIllegalArgumentException(LocalizedFormats.NON_INVERTIBLE_TRANSFORM);
            }

        }
View Full Code Here

Examples of org.apache.commons.math3.exception.MathIllegalArgumentException

        case 5 :
            abscissas = ABSCISSAS_5;
            weights   = WEIGHTS_5;
            break;
        default :
            throw new MathIllegalArgumentException(
                    LocalizedFormats.N_POINTS_GAUSS_LEGENDRE_INTEGRATOR_NOT_SUPPORTED,
                    n, 2, 5);
        }

    }
View Full Code Here

Examples of org.apache.commons.math3.exception.MathIllegalArgumentException

     */
    private NestedLoops(final Vector2D[] loop, final double tolerance)
        throws MathIllegalArgumentException {

        if (loop[0] == null) {
            throw new MathIllegalArgumentException(LocalizedFormats.OUTLINE_BOUNDARY_LOOP_OPEN);
        }

        this.loop       = loop;
        this.surrounded = new ArrayList<NestedLoops>();
        this.tolerance  = tolerance;
View Full Code Here

Examples of org.apache.commons.math3.exception.MathIllegalArgumentException

        // we should be separate from the remaining children
        RegionFactory<Euclidean2D> factory = new RegionFactory<Euclidean2D>();
        for (final NestedLoops child : surrounded) {
            if (!factory.intersection(node.polygon, child.polygon).isEmpty()) {
                throw new MathIllegalArgumentException(LocalizedFormats.CROSSING_BOUNDARY_LOOPS);
            }
        }

        surrounded.add(node);
View Full Code Here

Examples of org.apache.commons.math3.exception.MathIllegalArgumentException

        }
        if (x.length == 0) {  // Must be no y data either
            throw new NoDataException();
        }
        if (x[0].length + 1 > x.length) {
            throw new MathIllegalArgumentException(
                    LocalizedFormats.NOT_ENOUGH_DATA_FOR_NUMBER_OF_PREDICTORS,
                    x.length, x[0].length);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.