congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
NoDataException
Code IndexAdd Tabnine to your IDE (free)

How to use
NoDataException
in
org.apache.commons.math3.exception

Best Java code snippets using org.apache.commons.math3.exception.NoDataException (Showing top 20 results out of 315)

origin: org.apache.commons/commons-math3

/** Check interpolation can be performed.
 * @exception NoDataException if interpolation cannot be performed
 * because sample is empty
 */
private void checkInterpolation() throws NoDataException {
  if (abscissae.isEmpty()) {
    throw new NoDataException(LocalizedFormats.EMPTY_INTERPOLATION_SAMPLE);
  }
}
origin: org.apache.commons/commons-math3

/**
 * Get the elements type from an array.
 *
 * @param <T> Type of the field elements.
 * @param d Data array.
 * @return the field to which the array elements belong.
 * @throws NoDataException if array is empty.
 */
protected static <T extends FieldElement<T>> Field<T> extractField(final T[] d)
  throws NoDataException {
  if (d.length == 0) {
    throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_ROW);
  }
  return d[0].getField();
}
origin: org.apache.commons/commons-math3

/**
 * Ensures that the provided arrays fulfills the assumptions.
 *
 * @param x first sample
 * @param y second sample
 * @throws NullArgumentException if {@code x} or {@code y} are {@code null}.
 * @throws NoDataException if {@code x} or {@code y} are zero-length.
 */
private void ensureDataConformance(final double[] x, final double[] y)
  throws NullArgumentException, NoDataException {
  if (x == null ||
    y == null) {
    throw new NullArgumentException();
  }
  if (x.length == 0 ||
    y.length == 0) {
    throw new NoDataException();
  }
}
origin: org.apache.commons/commons-math3

/**
 * Get the elements type from an array.
 *
 * @param <T> Type of the field elements.
 * @param d Data array.
 * @return the field to which the array elements belong.
 * @throws NullArgumentException if the array is {@code null}.
 * @throws NoDataException if the array is empty.
 */
protected static <T extends FieldElement<T>> Field<T> extractField(final T[][] d)
  throws NoDataException, NullArgumentException {
  if (d == null) {
    throw new NullArgumentException();
  }
  if (d.length == 0) {
    throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_ROW);
  }
  if (d[0].length == 0) {
    throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
  }
  return d[0][0].getField();
}
origin: org.apache.commons/commons-math3

/**
 * Uses Horner's Method to evaluate the polynomial with the given coefficients at
 * the argument.
 *
 * @param coefficients Coefficients of the polynomial to evaluate.
 * @param argument Input value.
 * @return the value of the polynomial.
 * @throws NoDataException if {@code coefficients} is empty.
 * @throws NullArgumentException if {@code coefficients} is {@code null}.
 */
protected static double evaluate(double[] coefficients, double argument)
  throws NullArgumentException, NoDataException {
  MathUtils.checkNotNull(coefficients);
  int n = coefficients.length;
  if (n == 0) {
    throw new NoDataException(LocalizedFormats.EMPTY_POLYNOMIALS_COEFFICIENTS_ARRAY);
  }
  double result = coefficients[n - 1];
  for (int j = n - 2; j >= 0; j--) {
    result = argument * result + coefficients[j];
  }
  return result;
}
origin: org.apache.commons/commons-math3

/**
 * Returns the coefficients of the derivative of the polynomial with the given coefficients.
 *
 * @param coefficients Coefficients of the polynomial to differentiate.
 * @return the coefficients of the derivative or {@code null} if coefficients has length 1.
 * @throws NoDataException if {@code coefficients} is empty.
 * @throws NullArgumentException if {@code coefficients} is {@code null}.
 */
protected static double[] differentiate(double[] coefficients)
  throws NullArgumentException, NoDataException {
  MathUtils.checkNotNull(coefficients);
  int n = coefficients.length;
  if (n == 0) {
    throw new NoDataException(LocalizedFormats.EMPTY_POLYNOMIALS_COEFFICIENTS_ARRAY);
  }
  if (n == 1) {
    return new double[]{0};
  }
  double[] result = new double[n - 1];
  for (int i = n - 1; i > 0; i--) {
    result[i - 1] = i * coefficients[i];
  }
  return result;
}
origin: org.apache.commons/commons-math3

/**
 * Returns the sum of the (signed) differences between corresponding elements of the
 * input arrays -- i.e., sum(sample1[i] - sample2[i]).
 *
 * @param sample1  the first array
 * @param sample2  the second array
 * @return sum of paired differences
 * @throws DimensionMismatchException if the arrays do not have the same
 * (positive) length.
 * @throws NoDataException if the sample arrays are empty.
 */
public static double sumDifference(final double[] sample1, final double[] sample2)
throws DimensionMismatchException, NoDataException {
  int n = sample1.length;
  if (n != sample2.length) {
    throw new DimensionMismatchException(n, sample2.length);
  }
  if (n <= 0) {
    throw new NoDataException(LocalizedFormats.INSUFFICIENT_DIMENSION);
  }
  double result = 0;
  for (int i = 0; i < n; i++) {
    result += sample1[i] - sample2[i];
  }
  return result;
}
origin: org.apache.commons/commons-math3

/**
 * Construct a polynomial with the given coefficients.  The first element
 * of the coefficients array is the constant term.  Higher degree
 * coefficients follow in sequence.  The degree of the resulting polynomial
 * is the index of the last non-null element of the array, or 0 if all elements
 * are null.
 * <p>
 * The constructor makes a copy of the input array and assigns the copy to
 * the coefficients property.</p>
 *
 * @param c Polynomial coefficients.
 * @throws NullArgumentException if {@code c} is {@code null}.
 * @throws NoDataException if {@code c} is empty.
 */
public PolynomialFunction(double c[])
  throws NullArgumentException, NoDataException {
  super();
  MathUtils.checkNotNull(c);
  int n = c.length;
  if (n == 0) {
    throw new NoDataException(LocalizedFormats.EMPTY_POLYNOMIALS_COEFFICIENTS_ARRAY);
  }
  while ((n > 1) && (c[n - 1] == 0)) {
    --n;
  }
  this.coefficients = new double[n];
  System.arraycopy(c, 0, this.coefficients, 0, n);
}
origin: org.apache.commons/commons-math3

/**
 * Loads new y sample data, overriding any previous data.
 *
 * @param y the array representing the y sample
 * @throws NullArgumentException if y is null
 * @throws NoDataException if y is empty
 */
protected void newYSampleData(double[] y) {
  if (y == null) {
    throw new NullArgumentException();
  }
  if (y.length == 0) {
    throw new NoDataException();
  }
  this.yVector = new ArrayRealVector(y);
}
origin: org.apache.commons/commons-math3

final int nRows = d.length;
if (nRows == 0) {
  throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_ROW);
  throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
origin: org.apache.commons/commons-math3

/**
 * Calculates |z[i]| for all i
 *
 * @param z sample
 * @return |z|
 * @throws NullArgumentException if {@code z} is {@code null}
 * @throws NoDataException if {@code z} is zero-length.
 */
private double[] calculateAbsoluteDifferences(final double[] z)
  throws NullArgumentException, NoDataException {
  if (z == null) {
    throw new NullArgumentException();
  }
  if (z.length == 0) {
    throw new NoDataException();
  }
  final double[] zAbs = new double[z.length];
  for (int i = 0; i < z.length; ++i) {
    zAbs[i] = FastMath.abs(z[i]);
  }
  return zAbs;
}
origin: org.apache.commons/commons-math3

throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_ROW);
throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
origin: org.apache.commons/commons-math3

/**
 * Ensures that the provided arrays fulfills the assumptions.
 *
 * @param x first sample
 * @param y second sample
 * @throws NullArgumentException if {@code x} or {@code y} are {@code null}.
 * @throws NoDataException if {@code x} or {@code y} are zero-length.
 * @throws DimensionMismatchException if {@code x} and {@code y} do not
 * have the same length.
 */
private void ensureDataConformance(final double[] x, final double[] y)
  throws NullArgumentException, NoDataException, DimensionMismatchException {
  if (x == null ||
    y == null) {
      throw new NullArgumentException();
  }
  if (x.length == 0 ||
    y.length == 0) {
    throw new NoDataException();
  }
  if (y.length != x.length) {
    throw new DimensionMismatchException(y.length, x.length);
  }
}
origin: org.apache.commons/commons-math3

throw new NoDataException(LocalizedFormats.EMPTY_SELECTED_ROW_INDEX_ARRAY);
throw new NoDataException(LocalizedFormats.EMPTY_SELECTED_COLUMN_INDEX_ARRAY);
origin: org.apache.commons/commons-math3

final int nRows = subMatrix.length;
if (nRows == 0) {
  throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_ROW);
  throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
origin: org.apache.commons/commons-math3

throw new NoDataException();
origin: org.apache.commons/commons-math3

/**
 * Check if submatrix ranges indices are valid.
 * Rows and columns are indicated counting from 0 to n-1.
 *
 * @param selectedRows Array of row indices.
 * @param selectedColumns Array of column indices.
 * @throws NullArgumentException if the arrays are {@code null}.
 * @throws NoDataException if the arrays have zero length.
 * @throws OutOfRangeException if row or column selections are not valid.
 */
protected void checkSubMatrixIndex(final int[] selectedRows, final int[] selectedColumns)
  throws NoDataException, NullArgumentException, OutOfRangeException {
  if (selectedRows == null ||
    selectedColumns == null) {
    throw new NullArgumentException();
  }
  if (selectedRows.length == 0 ||
    selectedColumns.length == 0) {
    throw new NoDataException();
  }
  for (final int row : selectedRows) {
    checkRowIndex(row);
  }
  for (final int column : selectedColumns) {
    checkColumnIndex(column);
  }
}
origin: org.apache.commons/commons-math3

/**
 * Computes the quantization error.
 * The quantization error is the average distance between a feature vector
 * and its "best matching unit" (closest neuron).
 *
 * @param data Feature vectors.
 * @param neurons List of neurons to scan.
 * @param distance Distance function.
 * @return the error.
 * @throws NoDataException if {@code data} is empty.
 */
public static double computeQuantizationError(Iterable<double[]> data,
                       Iterable<Neuron> neurons,
                       DistanceMeasure distance) {
  double d = 0;
  int count = 0;
  for (double[] f : data) {
    ++count;
    d += distance.compute(f, findBest(f, neurons, distance).getFeatures());
  }
  if (count == 0) {
    throw new NoDataException();
  }
  return d / count;
}
origin: org.apache.commons/commons-math3

throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_ROW);
throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
origin: org.apache.commons/commons-math3

/** Interpolate value at a specified abscissa.
 * @param x interpolation abscissa
 * @return interpolated value
 * @exception NoDataException if sample is empty
 * @throws NullArgumentException if x is null
 */
public T[] value(T x) throws NoDataException, NullArgumentException {
  // safety check
  MathUtils.checkNotNull(x);
  if (abscissae.isEmpty()) {
    throw new NoDataException(LocalizedFormats.EMPTY_INTERPOLATION_SAMPLE);
  }
  final T[] value = MathArrays.buildArray(x.getField(), topDiagonal.get(0).length);
  T valueCoeff = x.getField().getOne();
  for (int i = 0; i < topDiagonal.size(); ++i) {
    T[] dividedDifference = topDiagonal.get(i);
    for (int k = 0; k < value.length; ++k) {
      value[k] = value[k].add(dividedDifference[k].multiply(valueCoeff));
    }
    final T deltaX = x.subtract(abscissae.get(i));
    valueCoeff = valueCoeff.multiply(deltaX);
  }
  return value;
}
org.apache.commons.math3.exceptionNoDataException

Javadoc

Exception to be thrown when the required data is missing.

Most used methods

  • <init>
    Construct the exception with a specific context.

Popular in Java

  • Start an intent from android
  • getSystemService (Context)
  • findViewById (Activity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • Top 25 Plugins for Webstorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now