Class RegularIndexer

java.lang.Object
org.hipparchus.analysis.interpolation.RegularIndexer

public class RegularIndexer extends Object
Helper for sampled data along a regular grid.
Since:
4.1
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    RegularIndexer(double min, double max, int n)
    Simple constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    coordinate(int index)
    Get coordinates corresponding to index.
    double
    Get the maximum coordinate.
    double
    Get the minimum coordinate.
    int
    Get the number of different coordinates.
    double
    Get the step size between two successive coordinates.
    int
    index(double coordinate)
    Get index corresponding to coordinate.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RegularIndexer

      public RegularIndexer(double min, double max, int n)
      Simple constructor.
      Parameters:
      min - minimum value
      max - maximum value
      n - number of points (including min and max)
  • Method Details

    • getMin

      public double getMin()
      Get the minimum coordinate.
      Returns:
      minimum coordinate
    • getMax

      public double getMax()
      Get the maximum coordinate.
      Returns:
      maximum coordinate
    • getN

      public int getN()
      Get the number of different coordinates.
      Returns:
      number of different coordinates (including getMin() and getMax())
    • getStep

      public double getStep()
      Get the step size between two successive coordinates.
      Returns:
      step size between two successive coordinates
    • index

      public int index(double coordinate)
      Get index corresponding to coordinate.

      The method rounds to the closest index, so it may be called with coordinate slightly overshooting nominal range. If called with coordinate between getMin() - getStep()/2 and getMin() + getStep()/2, it will return 0. If called with coordinate between getMax() - getStep()/2 and getMax() + getStep()/2, it will return getN() - 1. If called outside of this extended range, it will throw an exception.

      Parameters:
      coordinate - coordinate
      Returns:
      index corresponding to coordinate (i.e. 0 for min, n-1 for max)
    • coordinate

      public double coordinate(int index)
      Get coordinates corresponding to index.
      Parameters:
      index - index
      Returns:
      coordinate (i.e. min for 0, max for n-1)