Class LogarithmicTransform1D

All Implemented Interfaces:
Serializable, Parameterized, LenientComparable, org.opengis.referencing.operation.MathTransform, org.opengis.referencing.operation.MathTransform1D
Direct Known Subclasses:
LogarithmicTransform1D.Base10

class LogarithmicTransform1D extends AbstractMathTransform1D implements Serializable
A one dimensional, logarithmic transform. This transform is the inverse of ExponentialTransform1D. The default implementation computes the natural logarithm of input values using Math.log(double). Subclasses compute alternate logarithms, for example in base 10 computed by Math.log10(double).

Logarithms in bases other than e or 10 are computed by concatenating a linear transform, using the following mathematical identity:

logbase(x) = ln(x) / ln(base)

Serialization

Serialized instances of this class are not guaranteed to be compatible with future SIS versions. Serialization should be used only for short term storage or RMI between applications running the same SIS version.
Since:
0.5
Version:
0.5
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    (package private) static final class 
    Special case for base 10 taking advantage of extra precision provided by Math.log10(double).

    Nested classes/interfaces inherited from class org.apache.sis.referencing.operation.transform.AbstractMathTransform1D

    AbstractMathTransform1D.Inverse
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private org.opengis.referencing.operation.MathTransform1D
    The inverse of this transform.
    private static final LogarithmicTransform1D
    The unique instance of the natural logarithmic transform.
    private static final long
    Serial number for inter-operability with different versions.

    Fields inherited from class org.apache.sis.referencing.operation.transform.AbstractMathTransform

    MAXIMUM_BUFFER_SIZE, MAXIMUM_FAILURES
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a new logarithmic transform.
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) double
    Returns the base of this logarithmic function.
    private org.opengis.referencing.operation.MathTransform1D
    concatenate(double scale, double offset)
    Returns the concatenation of this transform by the given scale and offset.
    static org.opengis.referencing.operation.MathTransform1D
    create(double base, double offset)
    Constructs a new logarithmic transform which add the given offset after the logarithm.
    (package private) static org.opengis.referencing.operation.MathTransform1D
    Constructs a new logarithmic transform which is the inverse of the supplied exponential transform.
    double
    derivative(double value)
    Gets the derivative of this function at a value.
    org.opengis.referencing.operation.MathTransform1D
    Returns the inverse of this transform.
    (package private) double
    Returns the natural logarithm of the base of this logarithmic function.
    (package private) double
    log(double value)
    Returns the logarithm of the given value in the base of this logarithmic transform.
    (package private) double
    Returns the offset applied after this logarithmic function.
    (package private) double
    pow(double value)
    Returns the base of this logarithmic transform raised to the given power.
    double
    transform(double value)
    Transforms the specified value.
    void
    transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts)
    Transforms many positions in a list of coordinate values.
    void
    transform(double[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts)
    Transforms many positions in a list of coordinate values.
    void
    transform(float[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts)
    Transforms many positions in a list of coordinate values.
    void
    transform(float[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts)
    Transforms many positions in a list of coordinate values.
    protected org.opengis.referencing.operation.MathTransform
    tryConcatenate(boolean applyOtherFirst, org.opengis.referencing.operation.MathTransform other, org.opengis.referencing.operation.MathTransformFactory factory)
    Concatenates in an optimized way a MathTransform other to this MathTransform.

    Methods inherited from class org.apache.sis.referencing.operation.transform.AbstractMathTransform1D

    derivative, getSourceDimensions, getTargetDimensions, transform

    Methods inherited from class org.apache.sis.io.wkt.FormattableObject

    print, toString, toString, toWKT

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.opengis.referencing.operation.MathTransform

    isIdentity, toWKT, transform
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Serial number for inter-operability with different versions.
      See Also:
    • NATURAL

      private static final LogarithmicTransform1D NATURAL
      The unique instance of the natural logarithmic transform.
    • inverse

      private org.opengis.referencing.operation.MathTransform1D inverse
      The inverse of this transform. Created only when first needed. Serialized in order to avoid rounding error if this transform is actually the one which was created from the inverse.
  • Constructor Details

    • LogarithmicTransform1D

      LogarithmicTransform1D()
      Constructs a new logarithmic transform.
      See Also:
  • Method Details

    • create

      public static org.opengis.referencing.operation.MathTransform1D create(double base, double offset)
      Constructs a new logarithmic transform which add the given offset after the logarithm.
      Parameters:
      base - the base of the logarithm (typically 10).
      offset - the offset to add to the logarithm.
      Returns:
      the math transform.
    • create

      static org.opengis.referencing.operation.MathTransform1D create(ExponentialTransform1D inverse)
      Constructs a new logarithmic transform which is the inverse of the supplied exponential transform.
    • concatenate

      private org.opengis.referencing.operation.MathTransform1D concatenate(double scale, double offset)
      Returns the concatenation of this transform by the given scale and offset. This method does not check if a simplification is possible.
    • tryConcatenate

      protected org.opengis.referencing.operation.MathTransform tryConcatenate(boolean applyOtherFirst, org.opengis.referencing.operation.MathTransform other, org.opengis.referencing.operation.MathTransformFactory factory) throws org.opengis.util.FactoryException
      Concatenates in an optimized way a MathTransform other to this MathTransform. This implementation can optimize some concatenation with LinearTransform1D and ExponentialTransform1D.
      Overrides:
      tryConcatenate in class AbstractMathTransform
      Parameters:
      applyOtherFirst - true if the transformation order is other followed by this, or false if the transformation order is this followed by other.
      other - the other math transform to (pre-)concatenate with this transform.
      factory - the factory which is (indirectly) invoking this method, or null if none.
      Returns:
      the combined math transform, or null if no optimized combined transform is available.
      Throws:
      org.opengis.util.FactoryException - if an error occurred while combining the transforms.
      See Also:
    • inverse

      public org.opengis.referencing.operation.MathTransform1D inverse()
      Returns the inverse of this transform.
      Specified by:
      inverse in interface org.opengis.referencing.operation.MathTransform
      Specified by:
      inverse in interface org.opengis.referencing.operation.MathTransform1D
      Overrides:
      inverse in class AbstractMathTransform1D
    • base

      double base()
      Returns the base of this logarithmic function.
    • lnBase

      double lnBase()
      Returns the natural logarithm of the base of this logarithmic function. More specifically, returns Math.log(base()).
    • offset

      double offset()
      Returns the offset applied after this logarithmic function.
    • derivative

      public double derivative(double value)
      Gets the derivative of this function at a value.
      Specified by:
      derivative in interface org.opengis.referencing.operation.MathTransform1D
      Specified by:
      derivative in class AbstractMathTransform1D
      Parameters:
      value - the value where to evaluate the derivative.
      Returns:
      the derivative at the specified point.
    • pow

      double pow(double value)
      Returns the base of this logarithmic transform raised to the given power.
      Parameters:
      value - the power to raise the base.
      Returns:
      the base of this transform raised to the given power.
    • log

      double log(double value)
      Returns the logarithm of the given value in the base of this logarithmic transform. This method is similar to transform(double) except that the offset is not added.
      Parameters:
      value - the value for which to compute the log.
      Returns:
      the log of the given value in the base used by this transform.
    • transform

      public double transform(double value)
      Transforms the specified value.
      Specified by:
      transform in interface org.opengis.referencing.operation.MathTransform1D
      Specified by:
      transform in class AbstractMathTransform1D
      Parameters:
      value - the value to transform.
      Returns:
      the transformed value.
    • transform

      public void transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts)
      Transforms many positions in a list of coordinate values.
      Specified by:
      transform in interface org.opengis.referencing.operation.MathTransform
      Overrides:
      transform in class AbstractMathTransform
      Parameters:
      srcPts - the array containing the source point coordinates.
      srcOff - the offset to the first point to be transformed in the source array.
      dstPts - the array into which the transformed point coordinates are returned. May be the same than srcPts.
      dstOff - the offset to the location of the first transformed point that is stored in the destination array.
      numPts - the number of point objects to be transformed.
    • transform

      public void transform(float[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts)
      Transforms many positions in a list of coordinate values.
      Specified by:
      transform in interface org.opengis.referencing.operation.MathTransform
      Overrides:
      transform in class AbstractMathTransform
      Parameters:
      srcPts - the array containing the source point coordinates.
      srcOff - the offset to the first point to be transformed in the source array.
      dstPts - the array into which the transformed point coordinates are returned. May be the same than srcPts.
      dstOff - the offset to the location of the first transformed point that is stored in the destination array.
      numPts - the number of point objects to be transformed.
    • transform

      public void transform(double[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts)
      Transforms many positions in a list of coordinate values.
      Specified by:
      transform in interface org.opengis.referencing.operation.MathTransform
      Overrides:
      transform in class AbstractMathTransform
      Parameters:
      srcPts - the array containing the source point coordinates.
      srcOff - the offset to the first point to be transformed in the source array.
      dstPts - the array into which the transformed point coordinates are returned.
      dstOff - the offset to the location of the first transformed point that is stored in the destination array.
      numPts - the number of point objects to be transformed.
    • transform

      public void transform(float[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts)
      Transforms many positions in a list of coordinate values.
      Specified by:
      transform in interface org.opengis.referencing.operation.MathTransform
      Overrides:
      transform in class AbstractMathTransform
      Parameters:
      srcPts - the array containing the source point coordinates.
      srcOff - the offset to the first point to be transformed in the source array.
      dstPts - the array into which the transformed point coordinates are returned.
      dstOff - the offset to the location of the first transformed point that is stored in the destination array.
      numPts - the number of point objects to be transformed.