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

The following examples show how to use org.apache.commons.math3.exception.util.LocalizedFormats#UNKNOWN_PARAMETER . 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: JacobianMatrices.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** Set the initial value of a column of the Jacobian matrix with respect to one parameter.
 * <p>
 * If this method is not called for some parameter, the initial value of
 * the column of the Jacobian matrix with respect to this parameter is set to zero.
 * </p>
 * @param pName parameter name
 * @param dYdP initial Jacobian column vector with respect to the parameter
 * @exception MathIllegalArgumentException if a parameter is not supported
 */
public void setInitialParameterJacobian(final String pName, final double[] dYdP)
    throws MathIllegalArgumentException {

    // Check dimensions
    checkDimension(stateDim, dYdP);

    // store the column in a global single dimension array
    int i = stateDim * stateDim;
    for (ParameterConfiguration param: selectedParameters) {
        if (pName.equals(param.getParameterName())) {
            System.arraycopy(dYdP, 0, matricesData, i, stateDim);
            if (efode != null) {
                efode.setSecondaryState(index, matricesData);
            }
            return;
        }
        i += stateDim;
    }

    throw new MathIllegalArgumentException(LocalizedFormats.UNKNOWN_PARAMETER, pName);

}
 
Example 2
Source File: JacobianMatrices.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** Set the initial value of a column of the Jacobian matrix with respect to one parameter.
 * <p>
 * If this method is not called for some parameter, the initial value of
 * the column of the Jacobian matrix with respect to this parameter is set to zero.
 * </p>
 * @param pName parameter name
 * @param dYdP initial Jacobian column vector with respect to the parameter
 * @exception MathIllegalArgumentException if a parameter is not supported
 */
public void setInitialParameterJacobian(final String pName, final double[] dYdP)
    throws MathIllegalArgumentException {

    // Check dimensions
    checkDimension(stateDim, dYdP);

    // store the column in a global single dimension array
    int i = stateDim * stateDim;
    for (ParameterConfiguration param: selectedParameters) {
        if (pName.equals(param.getParameterName())) {
            System.arraycopy(dYdP, 0, matricesData, i, stateDim);
            if (efode != null) {
                efode.setSecondaryState(index, matricesData);
            }
            return;
        }
        i += stateDim;
    }

    throw new MathIllegalArgumentException(LocalizedFormats.UNKNOWN_PARAMETER, pName);

}
 
Example 3
Source File: AbstractParameterizable.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** Check if a parameter is supported and throw an IllegalArgumentException if not.
 * @param name name of the parameter to check
 * @exception MathIllegalArgumentException if the parameter is not supported
 * @see #isSupported(String)
 */
public void complainIfNotSupported(final String name)
    throws MathIllegalArgumentException {
    if (!isSupported(name)) {
        throw new MathIllegalArgumentException(LocalizedFormats.UNKNOWN_PARAMETER, name);
    }
}
 
Example 4
Source File: ParameterizedWrapper.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
public double getParameter(String name)
    throws MathIllegalArgumentException {
    if (!isSupported(name)) {
        throw new MathIllegalArgumentException(LocalizedFormats.UNKNOWN_PARAMETER, name);
    }
    return Double.NaN;
}
 
Example 5
Source File: AbstractParameterizable.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** Check if a parameter is supported and throw an IllegalArgumentException if not.
 * @param name name of the parameter to check
 * @exception MathIllegalArgumentException if the parameter is not supported
 * @see #isSupported(String)
 */
public void complainIfNotSupported(final String name)
    throws MathIllegalArgumentException {
    if (!isSupported(name)) {
        throw new MathIllegalArgumentException(LocalizedFormats.UNKNOWN_PARAMETER, name);
    }
}
 
Example 6
Source File: ParameterizedWrapper.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
public double getParameter(String name)
    throws MathIllegalArgumentException {
    if (!isSupported(name)) {
        throw new MathIllegalArgumentException(LocalizedFormats.UNKNOWN_PARAMETER, name);
    }
    return Double.NaN;
}
 
Example 7
Source File: JacobianMatrices.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/** Set the step associated to a parameter in order to compute by finite
 *  difference the Jacobian matrix.
 * <p>
 * Needed if and only if the primary ODE set is a {@link ParameterizedODE}.
 * </p>
 * <p>
 * Given a non zero parameter value pval for the parameter, a reasonable value
 * for such a step is {@code pval * FastMath.sqrt(Precision.EPSILON)}.
 * </p>
 * <p>
 * A zero value for such a step doesn't enable to compute the parameter Jacobian matrix.
 * </p>
 * @param parameter parameter to consider for Jacobian processing
 * @param hP step for Jacobian finite difference computation w.r.t. the specified parameter
 * @see ParameterizedODE
 * @exception IllegalArgumentException if the parameter is not supported
 */
public void setParameterStep(final String parameter, final double hP) {

    for (ParameterConfiguration param: selectedParameters) {
        if (parameter.equals(param.getParameterName())) {
            param.setHP(hP);
            dirtyParameter = true;
            return;
        }
    }

    throw new MathIllegalArgumentException(LocalizedFormats.UNKNOWN_PARAMETER, parameter);

}
 
Example 8
Source File: JacobianMatrices.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/** Set the step associated to a parameter in order to compute by finite
 *  difference the Jacobian matrix.
 * <p>
 * Needed if and only if the primary ODE set is a {@link ParameterizedODE}.
 * </p>
 * <p>
 * Given a non zero parameter value pval for the parameter, a reasonable value
 * for such a step is {@code pval * FastMath.sqrt(Precision.EPSILON)}.
 * </p>
 * <p>
 * A zero value for such a step doesn't enable to compute the parameter Jacobian matrix.
 * </p>
 * @param parameter parameter to consider for Jacobian processing
 * @param hP step for Jacobian finite difference computation w.r.t. the specified parameter
 * @see ParameterizedODE
 * @exception IllegalArgumentException if the parameter is not supported
 */
public void setParameterStep(final String parameter, final double hP) {

    for (ParameterConfiguration param: selectedParameters) {
        if (parameter.equals(param.getParameterName())) {
            param.setHP(hP);
            dirtyParameter = true;
            return;
        }
    }

    throw new MathIllegalArgumentException(LocalizedFormats.UNKNOWN_PARAMETER, parameter);

}
 
Example 9
Source File: UnknownParameterException.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Construct an exception from the unknown parameter.
 *
 * @param name parameter name.
 */
public UnknownParameterException(final String name) {
    super(LocalizedFormats.UNKNOWN_PARAMETER);
    this.name = name;
}
 
Example 10
Source File: UnknownParameterException.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Construct an exception from the unknown parameter.
 *
 * @param name parameter name.
 */
public UnknownParameterException(final String name) {
    super(LocalizedFormats.UNKNOWN_PARAMETER);
    this.name = name;
}
 
Example 11
Source File: UnknownParameterException.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Construct an exception from the unknown parameter.
 *
 * @param name parameter name.
 */
public UnknownParameterException(final String name) {
    super(LocalizedFormats.UNKNOWN_PARAMETER);
    this.name = name;
}
 
Example 12
Source File: UnknownParameterException.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Construct an exception from the unknown parameter.
 *
 * @param name parameter name.
 */
public UnknownParameterException(final String name) {
    super(LocalizedFormats.UNKNOWN_PARAMETER);
    this.name = name;
}
 
Example 13
Source File: UnknownParameterException.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Construct an exception from the unknown parameter.
 *
 * @param name parameter name.
 */
public UnknownParameterException(final String name) {
    super(LocalizedFormats.UNKNOWN_PARAMETER);
    this.name = name;
}
 
Example 14
Source File: UnknownParameterException.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Construct an exception from the unknown parameter.
 *
 * @param name parameter name.
 */
public UnknownParameterException(final String name) {
    super(LocalizedFormats.UNKNOWN_PARAMETER);
    this.name = name;
}