Class VectorValuedFunctionVA

java.lang.Object
org.bzdev.math.VectorValuedFunctionVA
All Implemented Interfaces:
VADomainOps
Direct Known Subclasses:
VectorValuedFunction

public abstract class VectorValuedFunctionVA extends Object implements VADomainOps
Vector-valued functions with a variable number of arguments.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected int
    The dimenion for the vectors that will be returned.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    VectorValuedFunctionVA(int dim, int minArgLength, int maxArgLength)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    final double[]
    derivAt(int i, double... args)
    Evaluate the first partial derivative $\frac{\partial f}{x_i}$ for a function f(x0,x1, ...).
    void
    derivAt(int i, double[] array, int offset, double... args)
    Evaluate the first partial derivative, storing the results ∂f / ∂xi for a function f(x0,x1, ...).
    boolean
    domainMaxClosed(int argIndex)
    Determine if the domain maximum for the ith argument, when the arguments are in the domain of the function, is in the function's domain.
    boolean
    domainMinClosed(int argIndex)
    Determine if the domain minimum for the ith argument, when the arguments are in the domain of the function, is in the function's domain.
    int
    Get the dimension of the vectors returned by a vector-valued function.
    double
    getDomainMax(int argIndex)
    Get the least upper bound of the ith argument when the arguments are in the domain of the function.
    double
    getDomainMin(int argIndex)
    Get the greatest lower bound of the ith argument when the arguments are in the domain of the function implementing this interface.
    boolean
    isInDomain(double... args)
    Determine if a sequence of arguments represents arguments that are in the domain of the function implementing this interface.
    int
    Get the maximum number of arguments allowed in calls to methods whose arguments are in the domain of a function implementing this interface.
    int
    Get the minimum number of arguments allowed in calls to methods whose arguments are in the domain of a function implementing this interface.
    final double[]
    secondDerivAt(int i, int j, double... args)
    Evaluate the second partial derivative ∂2f / ∂x1∂x1 for a function f(x1x2).
    void
    secondDerivAt(int i, int j, double[] array, int offset, double... args)
    Evaluate the second partial derivative ∂2f / ∂x1∂x1 for a function f(x1x2), storing the results in an array.
    final double[]
    valueAt(double... args)
    Call the function.
    void
    valueAt(double[] array, int offset, double... args)
    Call the function, storing the results in an array.

    Methods inherited from class java.lang.Object

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

    • dim

      protected int dim
      The dimenion for the vectors that will be returned.

      This value is read-only.

  • Constructor Details

    • VectorValuedFunctionVA

      protected VectorValuedFunctionVA(int dim, int minArgLength, int maxArgLength)
      Constructor.
      Parameters:
      dim - the dimension of the arrays that will be returned by methods that evaluate the function or its derivatives.
      minArgLength - the minimum number of double-precision arguments for methods that allow a variable number of arguments; -1 for the default
      maxArgLength - the mmaximum number of double-precision arguments for methods that allow a variable number of arguments; -1 for the default
  • Method Details

    • getDimension

      public int getDimension()
      Get the dimension of the vectors returned by a vector-valued function.
      Returns:
      the dimension of the vectors returned by this vector-valued function
    • getDomainMin

      public double getDomainMin(int argIndex) throws IllegalArgumentException
      Description copied from interface: VADomainOps
      Get the greatest lower bound of the ith argument when the arguments are in the domain of the function implementing this interface.
      Specified by:
      getDomainMin in interface VADomainOps
      Parameters:
      argIndex - the index determining the argument for which this method applies (0th, 1st, ...)
      Returns:
      the minimum value
      Throws:
      IllegalArgumentException - the argument is out of range
    • getDomainMax

      public double getDomainMax(int argIndex) throws IllegalArgumentException
      Description copied from interface: VADomainOps
      Get the least upper bound of the ith argument when the arguments are in the domain of the function.
      Specified by:
      getDomainMax in interface VADomainOps
      Parameters:
      argIndex - the index determining the argument for which this method applies (0th, 1st, ...)
      Returns:
      the maximum value
      Throws:
      IllegalArgumentException - the argument is out of range
    • domainMinClosed

      public boolean domainMinClosed(int argIndex) throws IllegalArgumentException
      Description copied from interface: VADomainOps
      Determine if the domain minimum for the ith argument, when the arguments are in the domain of the function, is in the function's domain.
      Specified by:
      domainMinClosed in interface VADomainOps
      Parameters:
      argIndex - the index determining the argument for which this method applies (0th, 1st, ...)
      Returns:
      true if the domain minimum is in the domain; false if it is the greatest lower bound for the domain
      Throws:
      IllegalArgumentException - the argument is out of range
    • domainMaxClosed

      public boolean domainMaxClosed(int argIndex) throws IllegalArgumentException
      Description copied from interface: VADomainOps
      Determine if the domain maximum for the ith argument, when the arguments are in the domain of the function, is in the function's domain.
      Specified by:
      domainMaxClosed in interface VADomainOps
      Parameters:
      argIndex - the index determining the argument for which this method applies (0th, 1st, ...)
      Returns:
      true if the domain maximum is in the domain; false if it is the least upper bound for the domain
      Throws:
      IllegalArgumentException - the argument is out of range
    • isInDomain

      public boolean isInDomain(double... args) throws UnsupportedOperationException, IllegalArgumentException
      Description copied from interface: VADomainOps
      Determine if a sequence of arguments represents arguments that are in the domain of the function implementing this interface.
      Specified by:
      isInDomain in interface VADomainOps
      Parameters:
      args - the arguments (x0,x1,...) giving the coordinates of a point
      Returns:
      true if the point (x0,x1,...) is in this function's domain; false otherwise
      Throws:
      UnsupportedOperationException - domain membership could not be determined.
      IllegalArgumentException - an argument is out of range
    • minArgLength

      public int minArgLength()
      Description copied from interface: VADomainOps
      Get the minimum number of arguments allowed in calls to methods whose arguments are in the domain of a function implementing this interface. A subclass must not return a value less than 1.
      Specified by:
      minArgLength in interface VADomainOps
      Returns:
      the minimum number of arguments
    • maxArgLength

      public int maxArgLength()
      Description copied from interface: VADomainOps
      Get the maximum number of arguments allowed in calls to methods whose arguments are in the domain of a function implementing this interface.
      Specified by:
      maxArgLength in interface VADomainOps
      Returns:
      the maximum number of arguments
    • valueAt

      public final double[] valueAt(double... args) throws IllegalArgumentException, UnsupportedOperationException
      Call the function.

      A subclass must implement valueAt(double[],int,double...), which this method calls to compute the value.

      Parameters:
      args - the function's arguments
      Returns:
      the value of the function for the given arguments
      Throws:
      IllegalArgumentException - the function's argument(s) were out of range
      UnsupportedOperationException - the operation is not supported.
    • valueAt

      public void valueAt(double[] array, int offset, double... args) throws IllegalArgumentException, UnsupportedOperationException
      Call the function, storing the results in an array.
      Parameters:
      array - the array used to store the results.
      offset - the offset into the array at which to store the results.
      args - the function's arguments
      Throws:
      IllegalArgumentException - the function's argument(s) were out of range
      UnsupportedOperationException - the operation is not supported.
    • derivAt

      public final double[] derivAt(int i, double... args) throws IllegalArgumentException, UnsupportedOperationException
      Evaluate the first partial derivative $\frac{\partial f}{x_i}$ for a function f(x0,x1, ...).

      A subclass must implement derivAt(int,double[],int,double...), which this method calls to compute a derivative.

      Parameters:
      i - the index indicating that the partial derivative is computed for the ith argument
      args - the function f's arguments
      Returns:
      the value of the partial derivative for the given argument
      Throws:
      IllegalArgumentException - the function's argument(s) were out of range
      UnsupportedOperationException - the operation is not supported.
    • derivAt

      public void derivAt(int i, double[] array, int offset, double... args) throws IllegalArgumentException, UnsupportedOperationException
      Evaluate the first partial derivative, storing the results ∂f / ∂xi for a function f(x0,x1, ...).
      Parameters:
      i - the index indicating that the partial derivative is computed for the ith argument
      array - the array used to store the results.
      offset - the offset into the array at which to store the results.
      args - the function f's arguments
      Throws:
      IllegalArgumentException - the function's argument(s) were out of range
      UnsupportedOperationException - the operation is not supported.
    • secondDerivAt

      public final double[] secondDerivAt(int i, int j, double... args) throws IllegalArgumentException, UnsupportedOperationException
      Evaluate the second partial derivative ∂2f / ∂x1∂x1 for a function f(x1x2).

      A subclass must implement secondDerivAt(int,int,double[],int,double...), which this method calls to compute a derivative.

      Parameters:
      i - the index indicating that the partial derivative is computed for the ith argument
      j - the index indicating that the partial derivative is computed for the jth argument
      args - the function f's arguments
      Returns:
      the value of the partial derivative ∂2f / ∂xi∂xj for the given arguments x0, x1, ...
      Throws:
      IllegalArgumentException - the function's arguments were out of range
      UnsupportedOperationException - the operation is not supported.
    • secondDerivAt

      public void secondDerivAt(int i, int j, double[] array, int offset, double... args) throws IllegalArgumentException, UnsupportedOperationException
      Evaluate the second partial derivative ∂2f / ∂x1∂x1 for a function f(x1x2), storing the results in an array.
      Parameters:
      i - the index indicating that the partial derivative is computed for the ith argument
      j - the index indicating that the partial derivative is computed for the jth argument
      array - the array used to store the results.
      offset - the offset into the array at which to store the results.
      args - the function f's arguments
      Throws:
      IllegalArgumentException - the function's arguments were out of range
      UnsupportedOperationException - the operation is not supported.