Package pal.math

Class LineFunction

java.lang.Object
pal.math.LineFunction
All Implemented Interfaces:
UnivariateFunction

public class LineFunction extends Object implements UnivariateFunction
converts a multivariate function into a univariate function
Author:
Korbinian Strimmer
  • Constructor Summary

    Constructors
    Constructor
    Description
    construct univariate function from multivariate function
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    checkDirection(double[] p, double[] dir)
    check direction vector.
    boolean
    checkPoint(double[] p)
    check (and modify, if necessary) whether a point lies properly within the predefined bounds
    int
    checkVariables(double[] p, double[] grad, boolean[] active)
    determine active variables at a point p and corresponding gradient grad (if a component of p lies on a border and the corresponding component of the gradient points out of the border the variable is considered inactive)
    double
    evaluate(double lambda)
    evaluate f(start+lambda*dir)
    double
    find parameter lambda within the given bounds that minimizes the univariate function (due to numerical inaccuaries it may happen that getPoint for the returned lambda produces a point that lies slightly out of bounds)
    double
    get lower bound of argument
    int
    get parameter that limits the lower bound
    void
    getPoint(double lambda, double[] p)
    get point associated with the one-dimensional parameter (bounds of of multivariate function are NOT checked)
    double
    get upper bound of argument
    int
    get parameter that limits the upper bound
    void
    update(double[] start, double[] dir)
    update start point and direction (bounds and search direction are NOT checked)

    Methods inherited from class java.lang.Object

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

    • LineFunction

      public LineFunction(MultivariateFunction func)
      construct univariate function from multivariate function
      Parameters:
      func - multivariate function
      start - start point
      dir - direction vector
  • Method Details

    • update

      public void update(double[] start, double[] dir)
      update start point and direction (bounds and search direction are NOT checked)
      Parameters:
      start - new start point
      dir - new direction vector
    • getPoint

      public void getPoint(double lambda, double[] p)
      get point associated with the one-dimensional parameter (bounds of of multivariate function are NOT checked)
      Parameters:
      lambda - argument
      p - array for coordinates of corresponding point
    • evaluate

      public double evaluate(double lambda)
      evaluate f(start+lambda*dir)
      Specified by:
      evaluate in interface UnivariateFunction
      Returns:
      function value
    • getLowerBound

      public double getLowerBound()
      Description copied from interface: UnivariateFunction
      get lower bound of argument
      Specified by:
      getLowerBound in interface UnivariateFunction
      Returns:
      lower bound
    • getUpperBound

      public double getUpperBound()
      Description copied from interface: UnivariateFunction
      get upper bound of argument
      Specified by:
      getUpperBound in interface UnivariateFunction
      Returns:
      upper bound
    • findMinimum

      public double findMinimum()
      find parameter lambda within the given bounds that minimizes the univariate function (due to numerical inaccuaries it may happen that getPoint for the returned lambda produces a point that lies slightly out of bounds)
      Returns:
      lambda that achieves minimum
    • getUpperBoundParameter

      public int getUpperBoundParameter()
      get parameter that limits the upper bound
      Returns:
      parameter number
    • getLowerBoundParameter

      public int getLowerBoundParameter()
      get parameter that limits the lower bound
      Returns:
      parameter number
    • checkPoint

      public boolean checkPoint(double[] p)
      check (and modify, if necessary) whether a point lies properly within the predefined bounds
      Parameters:
      p - coordinates of point
      Returns:
      true if p was modified, false otherwise
    • checkVariables

      public int checkVariables(double[] p, double[] grad, boolean[] active)
      determine active variables at a point p and corresponding gradient grad (if a component of p lies on a border and the corresponding component of the gradient points out of the border the variable is considered inactive)
      Parameters:
      p - coordinates of point
      grad - gradient at that point
      list - of active variables (on return)
      Returns:
      number of active variables
    • checkDirection

      public int checkDirection(double[] p, double[] dir)
      check direction vector. If it points out of the defined area at a point at the boundary the corresponding component of the direction vector is set to zero.
      Parameters:
      p - coordinates of point
      dir - direction vector at that point
      Returns:
      number of changed components in direction vector