本文整理汇总了Java中org.apache.commons.math.MathRuntimeException.createIllegalStateException方法的典型用法代码示例。如果您正苦于以下问题:Java MathRuntimeException.createIllegalStateException方法的具体用法?Java MathRuntimeException.createIllegalStateException怎么用?Java MathRuntimeException.createIllegalStateException使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.math.MathRuntimeException
的用法示例。
在下文中一共展示了MathRuntimeException.createIllegalStateException方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getOmegaImaginary
import org.apache.commons.math.MathRuntimeException; //导入方法依赖的package包/类
/**
* Get the imaginary part of the k<sup>th</sup> n<sup>th</sup> root of unity
* @param k index of the n<sup>th</sup> root of unity
* @return imaginary part of the k<sup>th</sup> n<sup>th</sup> root of unity
* @throws IllegalStateException if no roots of unity have been computed yet
* @throws IllegalArgumentException if k is out of range
*/
public synchronized double getOmegaImaginary(int k)
throws IllegalStateException, IllegalArgumentException {
if (omegaCount == 0) {
throw MathRuntimeException.createIllegalStateException(
"roots of unity have not been computed yet");
}
if ((k < 0) || (k >= omegaCount)) {
throw MathRuntimeException.createIllegalArgumentException(
"out of range root of unity index {0} (must be in [{1};{2}])",
k, 0, omegaCount - 1);
}
return (isForward) ?
omegaImaginaryForward[k] : omegaImaginaryInverse[k];
}
示例2: getOmegaImaginary
import org.apache.commons.math.MathRuntimeException; //导入方法依赖的package包/类
/**
* Get the imaginary part of the k<sup>th</sup> n<sup>th</sup> root of unity
* @param k index of the n<sup>th</sup> root of unity
* @return imaginary part of the k<sup>th</sup> n<sup>th</sup> root of unity
* @throws IllegalStateException if no roots of unity have been computed yet
* @throws IllegalArgumentException if k is out of range
*/
public synchronized double getOmegaImaginary(int k)
throws IllegalStateException, IllegalArgumentException {
if (omegaCount == 0) {
throw MathRuntimeException.createIllegalStateException(
MISSING_ROOTS_OF_UNITY_MESSAGE);
}
if ((k < 0) || (k >= omegaCount)) {
throw MathRuntimeException.createIllegalArgumentException(
OUT_OF_RANGE_ROOT_INDEX_MESSAGE, k, 0, omegaCount - 1);
}
return isForward ? omegaImaginaryForward[k] : omegaImaginaryInverse[k];
}
示例3: getNextValue
import org.apache.commons.math.MathRuntimeException; //导入方法依赖的package包/类
/**
* Generates a random value from this distribution.
*
* @return the random value.
* @throws IllegalStateException if the distribution has not been loaded
*/
public double getNextValue() throws IllegalStateException {
if (!loaded) {
throw MathRuntimeException.createIllegalStateException("distribution not loaded");
}
// Start with a uniformly distributed random number in (0,1)
double x = Math.random();
// Use this to select the bin and generate a Gaussian within the bin
for (int i = 0; i < binCount; i++) {
if (x <= upperBounds[i]) {
SummaryStatistics stats = binStats.get(i);
if (stats.getN() > 0) {
if (stats.getStandardDeviation() > 0) { // more than one obs
return randomData.nextGaussian
(stats.getMean(),stats.getStandardDeviation());
} else {
return stats.getMean(); // only one obs in bin
}
}
}
}
throw new MathRuntimeException("no bin selected");
}
示例4: getNextValue
import org.apache.commons.math.MathRuntimeException; //导入方法依赖的package包/类
/**
* Generates a random value from this distribution.
*
* @return the random value.
* @throws IllegalStateException if the distribution has not been loaded
*/
public double getNextValue() throws IllegalStateException {
if (!loaded) {
throw MathRuntimeException.createIllegalStateException("distribution not loaded");
}
// Start with a uniformly distributed random number in (0,1)
double x = Math.random();
// Use this to select the bin and generate a Gaussian within the bin
for (int i = 0; i < binCount; i++) {
if (x <= upperBounds[i]) {
SummaryStatistics stats = binStats.get(i);
if (stats.getN() > 0) {
if (stats.getStandardDeviation() > 0) { // more than one obs
return randomData.nextGaussian
(stats.getMean(),stats.getStandardDeviation());
} else {
return stats.getMean(); // only one obs in bin
}
}
}
}
throw new MathRuntimeException("no bin selected");
}
示例5: getOmegaReal
import org.apache.commons.math.MathRuntimeException; //导入方法依赖的package包/类
/**
* Get the real part of the k<sup>th</sup> n<sup>th</sup> root of unity
* @param k index of the n<sup>th</sup> root of unity
* @return real part of the k<sup>th</sup> n<sup>th</sup> root of unity
* @throws IllegalStateException if no roots of unity have been computed yet
* @throws IllegalArgumentException if k is out of range
*/
public synchronized double getOmegaReal(int k)
throws IllegalStateException, IllegalArgumentException {
if (omegaCount == 0) {
throw MathRuntimeException.createIllegalStateException(
"roots of unity have not been computed yet");
}
if ((k < 0) || (k >= omegaCount)) {
throw MathRuntimeException.createIllegalArgumentException(
"out of range root of unity index {0} (must be in [{1};{2}])",
k, 0, omegaCount - 1);
}
return omegaReal[k];
}
示例6: getResult
import org.apache.commons.math.MathRuntimeException; //导入方法依赖的package包/类
/**
* Access the last computed integral.
*
* @return the last computed integral
* @throws IllegalStateException if no integral has been computed
*/
public double getResult() throws IllegalStateException {
if (resultComputed) {
return result;
} else {
throw MathRuntimeException.createIllegalStateException("no result available");
}
}
示例7: isForward
import org.apache.commons.math.MathRuntimeException; //导入方法依赖的package包/类
/**
* Check if computation has been done for forward or reverse transform.
* @return true if computation has been done for forward transform
* @throws IllegalStateException if no roots of unity have been computed yet
*/
public synchronized boolean isForward() throws IllegalStateException {
if (omegaCount == 0) {
throw MathRuntimeException.createIllegalStateException(
"roots of unity have not been computed yet");
}
return isForward;
}
示例8: setSubMatrix
import org.apache.commons.math.MathRuntimeException; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public void setSubMatrix(final double[][] subMatrix, final int row, final int column)
throws MatrixIndexException {
if (data == null) {
if (row > 0) {
throw MathRuntimeException.createIllegalStateException(
"first {0} rows are not initialized yet",
row);
}
if (column > 0) {
throw MathRuntimeException.createIllegalStateException(
"first {0} columns are not initialized yet",
column);
}
final int nRows = subMatrix.length;
if (nRows == 0) {
throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one row");
}
final int nCols = subMatrix[0].length;
if (nCols == 0) {
throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one column");
}
data = new double[subMatrix.length][nCols];
for (int i = 0; i < data.length; ++i) {
if (subMatrix[i].length != nCols) {
throw MathRuntimeException.createIllegalArgumentException(
"some rows have length {0} while others have length {1}",
nCols, subMatrix[i].length);
}
System.arraycopy(subMatrix[i], 0, data[i + row], column, nCols);
}
} else {
super.setSubMatrix(subMatrix, row, column);
}
}
示例9: getOmegaReal
import org.apache.commons.math.MathRuntimeException; //导入方法依赖的package包/类
/**
* Get the real part of the k<sup>th</sup> n<sup>th</sup> root of unity
* @param k index of the n<sup>th</sup> root of unity
* @return real part of the k<sup>th</sup> n<sup>th</sup> root of unity
* @throws IllegalStateException if no roots of unity have been computed yet
* @throws IllegalArgumentException if k is out of range
*/
public synchronized double getOmegaReal(int k)
throws IllegalStateException, IllegalArgumentException {
if (omegaCount == 0) {
throw MathRuntimeException.createIllegalStateException(LocalizedFormats.ROOTS_OF_UNITY_NOT_COMPUTED_YET);
}
if ((k < 0) || (k >= omegaCount)) {
throw MathRuntimeException.createIllegalArgumentException(
LocalizedFormats.OUT_OF_RANGE_ROOT_OF_UNITY_INDEX, k, 0, omegaCount - 1);
}
return omegaReal[k];
}
示例10: checkEmpty
import org.apache.commons.math.MathRuntimeException; //导入方法依赖的package包/类
/**
* Throws IllegalStateException if n > 0.
*/
private void checkEmpty() {
if (n > 0) {
throw MathRuntimeException.createIllegalStateException(
"{0} values have been added before statistic is configured",
n);
}
}
示例11: getResult
import org.apache.commons.math.MathRuntimeException; //导入方法依赖的package包/类
/**
* Access the last computed integral.
*
* @return the last computed integral
* @throws IllegalStateException if no integral has been computed
*/
public double getResult() throws IllegalStateException {
if (resultComputed) {
return result;
} else {
throw MathRuntimeException.createIllegalStateException("no result available");
}
}
示例12: checkResultComputed
import org.apache.commons.math.MathRuntimeException; //导入方法依赖的package包/类
/** Check if a result has been computed.
* @exception IllegalStateException if no result has been computed
*/
protected void checkResultComputed() throws IllegalStateException {
if (!resultComputed) {
throw MathRuntimeException.createIllegalStateException("no result available");
}
}
示例13: getOptima
import org.apache.commons.math.MathRuntimeException; //导入方法依赖的package包/类
/** Get all the optima found during the last call to {@link
* #optimize(DifferentiableMultivariateVectorialFunction,
* double[], double[], double[]) optimize}.
* <p>The optimizer stores all the optima found during a set of
* restarts. The {@link #optimize(DifferentiableMultivariateVectorialFunction,
* double[], double[], double[]) optimize} method returns the
* best point only. This method returns all the points found at the
* end of each starts, including the best one already returned by the {@link
* #optimize(DifferentiableMultivariateVectorialFunction, double[],
* double[], double[]) optimize} method.
* </p>
* <p>
* The returned array as one element for each start as specified
* in the constructor. It is ordered with the results from the
* runs that did converge first, sorted from best to worst
* objective value (i.e in ascending order if minimizing and in
* descending order if maximizing), followed by and null elements
* corresponding to the runs that did not converge. This means all
* elements will be null if the {@link #optimize(DifferentiableMultivariateVectorialFunction,
* double[], double[], double[]) optimize} method did throw a {@link
* org.apache.commons.math.ConvergenceException ConvergenceException}).
* This also means that if the first element is non null, it is the best
* point found across all starts.</p>
* @return array containing the optima
* @exception IllegalStateException if {@link #optimize(DifferentiableMultivariateVectorialFunction,
* double[], double[], double[]) optimize} has not been called
*/
public VectorialPointValuePair[] getOptima() throws IllegalStateException {
if (optima == null) {
throw MathRuntimeException.createIllegalStateException("no optimum computed yet");
}
return optima.clone();
}
示例14: getNextDigest
import org.apache.commons.math.MathRuntimeException; //导入方法依赖的package包/类
/**
* Gets a random value in DIGEST_MODE.
* <p>
* <strong>Preconditions</strong>: <ul>
* <li>Before this method is called, <code>computeDistribution()</code>
* must have completed successfully; otherwise an
* <code>IllegalStateException</code> will be thrown</li></ul></p>
*
* @return next random value from the empirical distribution digest
*/
private double getNextDigest() {
if ((empiricalDistribution == null) ||
(empiricalDistribution.getBinStats().size() == 0)) {
throw MathRuntimeException.createIllegalStateException("digest not initialized");
}
return empiricalDistribution.getNextValue();
}