Java Code Examples for org.apache.commons.math.exception.util.LocalizedFormats#DIMENSIONS_MISMATCH_SIMPLE

The following examples show how to use org.apache.commons.math.exception.util.LocalizedFormats#DIMENSIONS_MISMATCH_SIMPLE . 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: AbstractIntegrator.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** Perform some sanity checks on the integration parameters.
 * @param ode differential equations set
 * @param t0 start time
 * @param y0 state vector at t0
 * @param t target time for the integration
 * @param y placeholder where to put the state vector
 * @exception IntegratorException if some inconsistency is detected
 */
protected void sanityChecks(final FirstOrderDifferentialEquations ode,
                            final double t0, final double[] y0,
                            final double t, final double[] y)
    throws IntegratorException {

    if (ode.getDimension() != y0.length) {
        throw new IntegratorException(
                LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, ode.getDimension(), y0.length);
    }

    if (ode.getDimension() != y.length) {
        throw new IntegratorException(
                LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, ode.getDimension(), y.length);
    }

    if (FastMath.abs(t - t0) <= 1.0e-12 * FastMath.max(FastMath.abs(t0), FastMath.abs(t))) {
        throw new IntegratorException(
                LocalizedFormats.TOO_SMALL_INTEGRATION_INTERVAL,
                FastMath.abs(t - t0));
    }

}
 
Example 2
Source File: MatrixUtils.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**Solve  a  system of composed of a Lower Triangular Matrix
 * {@link RealMatrix}.
 * <p>
 * This method is called to solve systems of equations which are
 * of the lower triangular form. The matrix {@link RealMatrix}
 * is assumed, though not checked, to be in lower triangular form.
 * The vector {@link RealVector} is overwritten with the solution.
 * The matrix is checked that it is square and its dimensions match
 * the length of the vector.
 * </p>
 * @param rm RealMatrix which is lower triangular
 * @param b  RealVector this is overwritten
 * @exception IllegalArgumentException if the matrix and vector are not conformable
 * @exception ArithmeticException there is a zero or near zero on the diagonal of rm
 */
public static void solveLowerTriangularSystem( RealMatrix rm, RealVector b){
    if ((rm == null) || (b == null) || ( rm.getRowDimension() != b.getDimension())) {
        throw new MathIllegalArgumentException(LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE,
                (rm == null) ? 0 : rm.getRowDimension(),
                (b == null) ? 0 : b.getDimension());
    }
    if( rm.getColumnDimension() != rm.getRowDimension() ){
        throw new MathIllegalArgumentException(LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
                rm.getRowDimension(),rm.getRowDimension(),
                rm.getRowDimension(),rm.getColumnDimension());
    }
    int rows = rm.getRowDimension();
    for( int i = 0 ; i < rows ; i++ ){
        double diag = rm.getEntry(i, i);
        if( FastMath.abs(diag) < MathUtils.SAFE_MIN ){
            throw new MathArithmeticException(LocalizedFormats.ZERO_DENOMINATOR);
        }
        double bi = b.getEntry(i)/diag;
        b.setEntry(i,  bi );
        for( int j = i+1; j< rows; j++ ){
            b.setEntry(j, b.getEntry(j)-bi*rm.getEntry(j,i)  );
        }
    }
}
 
Example 3
Source File: MillerUpdatingRegression.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Adds multiple observations to the model
 * @param x observations on the regressors
 * @param y observations on the regressand
 * @throws ModelSpecificationException if {@code x} is not rectangular, does not match
 * the length of {@code y} or does not contain sufficient data to estimate the model
 */
public void addObservations(double[][] x, double[] y) {
    if ((x == null) || (y == null) || (x.length != y.length)) {
        throw new ModelSpecificationException(
              LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE,
              (x == null) ? 0 : x.length,
              (y == null) ? 0 : y.length);
    }
    if (x.length == 0) {  // Must be no y data either
        throw new ModelSpecificationException(
                LocalizedFormats.NO_DATA);
    }
    if (x[0].length + 1 > x.length) {
        throw new ModelSpecificationException(
              LocalizedFormats.NOT_ENOUGH_DATA_FOR_NUMBER_OF_PREDICTORS,
              x.length, x[0].length);
    }
    for (int i = 0; i < x.length; i++) {
        this.addObservation(x[i], y[i]);
    }
    return;
}
 
Example 4
Source File: AbstractIntegrator.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** Perform some sanity checks on the integration parameters.
 * @param ode differential equations set
 * @param t0 start time
 * @param y0 state vector at t0
 * @param t target time for the integration
 * @param y placeholder where to put the state vector
 * @exception IntegratorException if some inconsistency is detected
 */
protected void sanityChecks(final FirstOrderDifferentialEquations ode,
                            final double t0, final double[] y0,
                            final double t, final double[] y)
    throws IntegratorException {

    if (ode.getDimension() != y0.length) {
        throw new IntegratorException(
                LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, ode.getDimension(), y0.length);
    }

    if (ode.getDimension() != y.length) {
        throw new IntegratorException(
                LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, ode.getDimension(), y.length);
    }

    if (FastMath.abs(t - t0) <= 1.0e-12 * FastMath.max(FastMath.abs(t0), FastMath.abs(t))) {
        throw new IntegratorException(
                LocalizedFormats.TOO_SMALL_INTEGRATION_INTERVAL,
                FastMath.abs(t - t0));
    }

}
 
Example 5
Source File: AdaptiveStepsizeIntegrator.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** Perform some sanity checks on the integration parameters.
 * @param equations differential equations set
 * @param t0 start time
 * @param y0 state vector at t0
 * @param t target time for the integration
 * @param y placeholder where to put the state vector
 * @exception IntegratorException if some inconsistency is detected
 */
@Override
protected void sanityChecks(final FirstOrderDifferentialEquations equations,
                            final double t0, final double[] y0,
                            final double t, final double[] y)
    throws IntegratorException {

    super.sanityChecks(equations, t0, y0, t, y);

    if (equations instanceof ExtendedFirstOrderDifferentialEquations) {
        mainSetDimension = ((ExtendedFirstOrderDifferentialEquations) equations).getMainSetDimension();
    } else {
        mainSetDimension = equations.getDimension();
    }

    if ((vecAbsoluteTolerance != null) && (vecAbsoluteTolerance.length != mainSetDimension)) {
        throw new IntegratorException(
                LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, mainSetDimension, vecAbsoluteTolerance.length);
    }

    if ((vecRelativeTolerance != null) && (vecRelativeTolerance.length != mainSetDimension)) {
        throw new IntegratorException(
                LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, mainSetDimension, vecRelativeTolerance.length);
    }

}
 
Example 6
Source File: MatrixUtils.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** Solver a  system composed  of an Upper Triangular Matrix
 * {@link RealMatrix}.
 * <p>
 * This method is called to solve systems of equations which are
 * of the lower triangular form. The matrix {@link RealMatrix}
 * is assumed, though not checked, to be in upper triangular form.
 * The vector {@link RealVector} is overwritten with the solution.
 * The matrix is checked that it is square and its dimensions match
 * the length of the vector.
 * </p>
 * @param rm RealMatrix which is upper triangular
 * @param b  RealVector this is overwritten
 * @exception IllegalArgumentException if the matrix and vector are not conformable
 * @exception ArithmeticException there is a zero or near zero on the diagonal of rm
 */
public static void solveUpperTriangularSystem( RealMatrix rm, RealVector b){
    if ((rm == null) || (b == null) || ( rm.getRowDimension() != b.getDimension())) {
        throw new MathIllegalArgumentException(LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE,
                (rm == null) ? 0 : rm.getRowDimension(),
                (b == null) ? 0 : b.getDimension());
    }
    if( rm.getColumnDimension() != rm.getRowDimension() ){
        throw new MathIllegalArgumentException(LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
                rm.getRowDimension(),rm.getRowDimension(),
                rm.getRowDimension(),rm.getColumnDimension());
    }
    int rows = rm.getRowDimension();
    for( int i = rows-1 ; i >-1 ; i-- ){
        double diag = rm.getEntry(i, i);
        if( FastMath.abs(diag) < MathUtils.SAFE_MIN ){
            throw new MathArithmeticException(LocalizedFormats.ZERO_DENOMINATOR);
        }
        double bi = b.getEntry(i)/diag;
        b.setEntry(i,  bi );
        for( int j = i-1; j>-1; j-- ){
            b.setEntry(j, b.getEntry(j)-bi*rm.getEntry(j,i)  );
        }
    }
}
 
Example 7
Source File: MatrixUtils.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**Solve  a  system of composed of a Lower Triangular Matrix
 * {@link RealMatrix}.
 * <p>
 * This method is called to solve systems of equations which are
 * of the lower triangular form. The matrix {@link RealMatrix}
 * is assumed, though not checked, to be in lower triangular form.
 * The vector {@link RealVector} is overwritten with the solution.
 * The matrix is checked that it is square and its dimensions match
 * the length of the vector.
 * </p>
 * @param rm RealMatrix which is lower triangular
 * @param b  RealVector this is overwritten
 * @exception IllegalArgumentException if the matrix and vector are not conformable
 * @exception ArithmeticException there is a zero or near zero on the diagonal of rm
 */
public static void solveLowerTriangularSystem( RealMatrix rm, RealVector b){
    if ((rm == null) || (b == null) || ( rm.getRowDimension() != b.getDimension())) {
        throw new MathIllegalArgumentException(LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE,
                (rm == null) ? 0 : rm.getRowDimension(),
                (b == null) ? 0 : b.getDimension());
    }
    if( rm.getColumnDimension() != rm.getRowDimension() ){
        throw new MathIllegalArgumentException(LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
                rm.getRowDimension(),rm.getRowDimension(),
                rm.getRowDimension(),rm.getColumnDimension());
    }
    int rows = rm.getRowDimension();
    for( int i = 0 ; i < rows ; i++ ){
        double diag = rm.getEntry(i, i);
        if( FastMath.abs(diag) < MathUtils.SAFE_MIN ){
            throw new MathArithmeticException(LocalizedFormats.ZERO_DENOMINATOR);
        }
        double bi = b.getEntry(i)/diag;
        b.setEntry(i,  bi );
        for( int j = i+1; j< rows; j++ ){
            b.setEntry(j, b.getEntry(j)-bi*rm.getEntry(j,i)  );
        }
    }
}
 
Example 8
Source File: MillerUpdatingRegression.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Adds multiple observations to the model
 * @param x observations on the regressors
 * @param y observations on the regressand
 * @throws ModelSpecificationException if {@code x} is not rectangular, does not match
 * the length of {@code y} or does not contain sufficient data to estimate the model
 */
public void addObservations(double[][] x, double[] y) {
    if ((x == null) || (y == null) || (x.length != y.length)) {
        throw new ModelSpecificationException(
              LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE,
              (x == null) ? 0 : x.length,
              (y == null) ? 0 : y.length);
    }
    if (x.length == 0) {  // Must be no y data either
        throw new ModelSpecificationException(
                LocalizedFormats.NO_DATA);
    }
    if (x[0].length + 1 > x.length) {
        throw new ModelSpecificationException(
              LocalizedFormats.NOT_ENOUGH_DATA_FOR_NUMBER_OF_PREDICTORS,
              x.length, x[0].length);
    }
    for (int i = 0; i < x.length; i++) {
        this.addObservation(x[i], y[i]);
    }
    return;
}
 
Example 9
Source File: AdaptiveStepsizeIntegrator.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** Perform some sanity checks on the integration parameters.
 * @param equations differential equations set
 * @param t0 start time
 * @param y0 state vector at t0
 * @param t target time for the integration
 * @param y placeholder where to put the state vector
 * @exception IntegratorException if some inconsistency is detected
 */
@Override
protected void sanityChecks(final FirstOrderDifferentialEquations equations,
                            final double t0, final double[] y0,
                            final double t, final double[] y)
    throws IntegratorException {

    super.sanityChecks(equations, t0, y0, t, y);

    if (equations instanceof ExtendedFirstOrderDifferentialEquations) {
        mainSetDimension = ((ExtendedFirstOrderDifferentialEquations) equations).getMainSetDimension();
    } else {
        mainSetDimension = equations.getDimension();
    }

    if ((vecAbsoluteTolerance != null) && (vecAbsoluteTolerance.length != mainSetDimension)) {
        throw new IntegratorException(
                LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, mainSetDimension, vecAbsoluteTolerance.length);
    }

    if ((vecRelativeTolerance != null) && (vecRelativeTolerance.length != mainSetDimension)) {
        throw new IntegratorException(
                LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, mainSetDimension, vecRelativeTolerance.length);
    }

}
 
Example 10
Source File: AdaptiveStepsizeIntegrator.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** Perform some sanity checks on the integration parameters.
 * @param equations differential equations set
 * @param t0 start time
 * @param y0 state vector at t0
 * @param t target time for the integration
 * @param y placeholder where to put the state vector
 * @exception IntegratorException if some inconsistency is detected
 */
@Override
protected void sanityChecks(final FirstOrderDifferentialEquations equations,
                            final double t0, final double[] y0,
                            final double t, final double[] y)
    throws IntegratorException {

    super.sanityChecks(equations, t0, y0, t, y);

    if (equations instanceof ExtendedFirstOrderDifferentialEquations) {
        mainSetDimension = ((ExtendedFirstOrderDifferentialEquations) equations).getMainSetDimension();
    } else {
        mainSetDimension = equations.getDimension();
    }

    if ((vecAbsoluteTolerance != null) && (vecAbsoluteTolerance.length != mainSetDimension)) {
        throw new IntegratorException(
                LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, mainSetDimension, vecAbsoluteTolerance.length);
    }

    if ((vecRelativeTolerance != null) && (vecRelativeTolerance.length != mainSetDimension)) {
        throw new IntegratorException(
                LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, mainSetDimension, vecRelativeTolerance.length);
    }

}
 
Example 11
Source File: AbstractLeastSquaresOptimizer.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Update the residuals array and cost function value.
 * @exception FunctionEvaluationException if the function cannot be evaluated
 * or its dimension doesn't match problem dimension or maximal number of
 * of evaluations is exceeded
 */
protected void updateResidualsAndCost() throws FunctionEvaluationException {
    objective = computeObjectiveValue(point);
    if (objective.length != rows) {
        throw new FunctionEvaluationException(point, LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE,
                                              objective.length, rows);
    }

    final double[] targetValues = getTargetRef();
    final double[] residualsWeights = getWeightRef();

    cost = 0;
    int index = 0;
    for (int i = 0; i < rows; i++) {
        final double residual = targetValues[i] - objective[i];
        weightedResiduals[i]= residual*FastMath.sqrt(residualsWeights[i]);
        cost += residualsWeights[i] * residual * residual;
        index += cols;
    }
    cost = FastMath.sqrt(cost);
}
 
Example 12
Source File: AbstractLeastSquaresOptimizer.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Update the jacobian matrix.
 * @exception FunctionEvaluationException if the function jacobian
 * cannot be evaluated or its dimension doesn't match problem dimension
 */
protected void updateJacobian() throws FunctionEvaluationException {
    ++jacobianEvaluations;
    weightedResidualJacobian = jF.value(point);
    if (weightedResidualJacobian.length != rows) {
        throw new FunctionEvaluationException(point, LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE,
                                              weightedResidualJacobian.length, rows);
    }

    final double[] residualsWeights = getWeightRef();

    for (int i = 0; i < rows; i++) {
        final double[] ji = weightedResidualJacobian[i];
        double wi = FastMath.sqrt(residualsWeights[i]);
        for (int j = 0; j < cols; ++j) {
            //ji[j] *=  -1.0;
            weightedResidualJacobian[i][j] = -ji[j]*wi;
        }
    }
}
 
Example 13
Source File: AbstractIntegrator.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** Perform some sanity checks on the integration parameters.
 * @param ode differential equations set
 * @param t0 start time
 * @param y0 state vector at t0
 * @param t target time for the integration
 * @param y placeholder where to put the state vector
 * @exception IntegratorException if some inconsistency is detected
 */
protected void sanityChecks(final FirstOrderDifferentialEquations ode,
                            final double t0, final double[] y0,
                            final double t, final double[] y)
    throws IntegratorException {

    if (ode.getDimension() != y0.length) {
        throw new IntegratorException(
                LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, ode.getDimension(), y0.length);
    }

    if (ode.getDimension() != y.length) {
        throw new IntegratorException(
                LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, ode.getDimension(), y.length);
    }

    if (FastMath.abs(t - t0) <= 1.0e-12 * FastMath.max(FastMath.abs(t0), FastMath.abs(t))) {
        throw new IntegratorException(
                LocalizedFormats.TOO_SMALL_INTEGRATION_INTERVAL,
                FastMath.abs(t - t0));
    }

}
 
Example 14
Source File: AdaptiveStepsizeIntegrator.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** Perform some sanity checks on the integration parameters.
 * @param equations differential equations set
 * @param t0 start time
 * @param y0 state vector at t0
 * @param t target time for the integration
 * @param y placeholder where to put the state vector
 * @exception IntegratorException if some inconsistency is detected
 */
@Override
protected void sanityChecks(final FirstOrderDifferentialEquations equations,
                            final double t0, final double[] y0,
                            final double t, final double[] y)
    throws IntegratorException {

    super.sanityChecks(equations, t0, y0, t, y);

    if (equations instanceof ExtendedFirstOrderDifferentialEquations) {
        mainSetDimension = ((ExtendedFirstOrderDifferentialEquations) equations).getMainSetDimension();
    } else {
        mainSetDimension = equations.getDimension();
    }

    if ((vecAbsoluteTolerance != null) && (vecAbsoluteTolerance.length != mainSetDimension)) {
        throw new IntegratorException(
                LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, mainSetDimension, vecAbsoluteTolerance.length);
    }

    if ((vecRelativeTolerance != null) && (vecRelativeTolerance.length != mainSetDimension)) {
        throw new IntegratorException(
                LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, mainSetDimension, vecRelativeTolerance.length);
    }

}
 
Example 15
Source File: MatrixUtils.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** Solver a  system composed  of an Upper Triangular Matrix
 * {@link RealMatrix}.
 * <p>
 * This method is called to solve systems of equations which are
 * of the lower triangular form. The matrix {@link RealMatrix}
 * is assumed, though not checked, to be in upper triangular form.
 * The vector {@link RealVector} is overwritten with the solution.
 * The matrix is checked that it is square and its dimensions match
 * the length of the vector.
 * </p>
 * @param rm RealMatrix which is upper triangular
 * @param b  RealVector this is overwritten
 * @exception IllegalArgumentException if the matrix and vector are not conformable
 * @exception ArithmeticException there is a zero or near zero on the diagonal of rm
 */
public static void solveUpperTriangularSystem( RealMatrix rm, RealVector b){
    if ((rm == null) || (b == null) || ( rm.getRowDimension() != b.getDimension())) {
        throw new MathIllegalArgumentException(LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE,
                (rm == null) ? 0 : rm.getRowDimension(),
                (b == null) ? 0 : b.getDimension());
    }
    if( rm.getColumnDimension() != rm.getRowDimension() ){
        throw new MathIllegalArgumentException(LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
                rm.getRowDimension(),rm.getRowDimension(),
                rm.getRowDimension(),rm.getColumnDimension());
    }
    int rows = rm.getRowDimension();
    for( int i = rows-1 ; i >-1 ; i-- ){
        double diag = rm.getEntry(i, i);
        if( FastMath.abs(diag) < MathUtils.SAFE_MIN ){
            throw new MathArithmeticException(LocalizedFormats.ZERO_DENOMINATOR);
        }
        double bi = b.getEntry(i)/diag;
        b.setEntry(i,  bi );
        for( int j = i-1; j>-1; j-- ){
            b.setEntry(j, b.getEntry(j)-bi*rm.getEntry(j,i)  );
        }
    }
}
 
Example 16
Source File: AbstractIntegrator.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** Perform some sanity checks on the integration parameters.
 * @param ode differential equations set
 * @param t0 start time
 * @param y0 state vector at t0
 * @param t target time for the integration
 * @param y placeholder where to put the state vector
 * @exception IntegratorException if some inconsistency is detected
 */
protected void sanityChecks(final FirstOrderDifferentialEquations ode,
                            final double t0, final double[] y0,
                            final double t, final double[] y)
    throws IntegratorException {

    if (ode.getDimension() != y0.length) {
        throw new IntegratorException(
                LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, ode.getDimension(), y0.length);
    }

    if (ode.getDimension() != y.length) {
        throw new IntegratorException(
                LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, ode.getDimension(), y.length);
    }

    if (FastMath.abs(t - t0) <= 1.0e-12 * FastMath.max(FastMath.abs(t0), FastMath.abs(t))) {
        throw new IntegratorException(
                LocalizedFormats.TOO_SMALL_INTEGRATION_INTERVAL,
                FastMath.abs(t - t0));
    }

}
 
Example 17
Source File: DimensionMismatchException.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Construct an exception from the mismatched dimensions
 * @param dimension1 first dimension
 * @param dimension2 second dimension
 */
public DimensionMismatchException(final int dimension1, final int dimension2) {
    super(LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, dimension1, dimension2);
    this.dimension1 = dimension1;
    this.dimension2 = dimension2;
}
 
Example 18
Source File: DimensionMismatchException.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Construct an exception from the mismatched dimensions.
 *
 * @param wrong Wrong dimension.
 * @param expected Expected dimension.
 */
public DimensionMismatchException(int wrong,
                                  int expected) {
    this(LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, wrong, expected);
}
 
Example 19
Source File: DimensionMismatchException.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Construct an exception from the mismatched dimensions.
 *
 * @param wrong Wrong dimension.
 * @param expected Expected dimension.
 */
public DimensionMismatchException(int wrong,
                                  int expected) {
    super(LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, wrong, expected);
    dimension = expected;
}
 
Example 20
Source File: DimensionMismatchException.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Construct an exception from the mismatched dimensions.
 *
 * @param wrong Wrong dimension.
 * @param expected Expected dimension.
 */
public DimensionMismatchException(int wrong,
                                  int expected) {
    this(LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, wrong, expected);
}