Class RealValuedFunctionVA.Linear

java.lang.Object
org.bzdev.math.RealValuedFunctionVA
org.bzdev.math.RealValuedFunctionVA.Linear
All Implemented Interfaces:
RealValuedFunctVAOps, VADomainOps
Enclosing class:
RealValuedFunctionVA

public static final class RealValuedFunctionVA.Linear extends RealValuedFunctionVA
Class representing a real-valued function of the form f(x,β1,...) = ∑i βifi(x). The function this class represents is a linear function of all its arguments except the first. The functions in the sum are sometimes called basis functions as they form the basis for a vector space.
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.bzdev.math.RealValuedFunctionVA

    RealValuedFunctionVA.Linear
  • Constructor Summary

    Constructors
    Constructor
    Description
    Linear(T... args)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    derivAt(int i, double... args)
    Evaluate the partial derivative $\frac{\partial f}{\partial x_i}$ 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.
    Get the basis functions—the functions that will be combined linearly.
    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.
    double
    secondDerivAt(int i, int j, double... args)
    Evaluate the partial derivative $\frac{\partial^2 f}{\partial x_i \partial z_j}$ for a function f(x0,x1, ...).
    double
    valueAt(double... args)
    Call the function.

    Methods inherited from class org.bzdev.math.RealValuedFunctionVA

    isInDomain, jacobian, jacobian, maxArgLength, minArgLength

    Methods inherited from class java.lang.Object

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

    • Linear

      @SafeVarargs public Linear(T... args) throws IllegalArgumentException
      Constructor. The arguments are the basis functions. The basis functions must implement derivatives if this function's derivatives with respect to its first argument are to be evaluated.

      The number of double-precision arguments that should be passed to valueAt(double...), derivAt(int,double...), and secondDerivAt(int,int,double...) will be the next integer larger than the number of arguments passed to this constructor. The first double-precision argument will be passed to the basis functions and the remainder will represent parameters for the basis functions, both in the same order as that used by this constructor.

      Type Parameters:
      T - an interface that extends RealValuedFunctOps
      Parameters:
      args - a non-zero number of real valued functions of one argument
      Throws:
      IllegalArgumentException - an argument was null or no arguments were provided
  • Method Details

    • getBasis

      public RealValuedFunction[] getBasis()
      Get the basis functions—the functions that will be combined linearly. These are the real-valued functions passed to the constructor, returned in the same order.
      Returns:
      the basis functions
    • getDomainMin

      public double getDomainMin(int argIndex) throws IllegalArgumentException, IllegalStateException
      Description copied from class: RealValuedFunctionVA
      Get the greatest lower bound of the ith argument when the arguments are in the domain of the function. The implementation will either return the most negative double-precision number or the result of calling a method named getDomainMin (with the same arguments as this method) provided by an object created by a scripting language. If an object created via a scripting language is not passed to a constructor, and a different value is appropriate, this method should be overridden.
      Specified by:
      getDomainMin in interface VADomainOps
      Overrides:
      getDomainMin in class RealValuedFunctionVA
      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
      IllegalStateException - the function was not fully initialized.
    • getDomainMax

      public double getDomainMax(int argIndex) throws IllegalArgumentException, IllegalStateException
      Description copied from class: RealValuedFunctionVA
      Get the least upper bound of the ith argument when the arguments are in the domain of the function. The implementation will either return the largest double-precision number or the result of calling a method named getDomainMax (with the same arguments as this method) provided by an object created by a scripting language. If an object created via a scripting language is not passed to a constructor, and a different value is appropriate, this method should be overridden.
      Specified by:
      getDomainMax in interface VADomainOps
      Overrides:
      getDomainMax in class RealValuedFunctionVA
      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
      IllegalStateException - the function was not fully initialized.
    • domainMinClosed

      public boolean domainMinClosed(int argIndex) throws IllegalArgumentException, IllegalStateException
      Description copied from class: RealValuedFunctionVA
      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. The implementation will either return true or the result of calling a method named getDomainMinClosed (with the same arguments as this method) provided by an object created by a scripting language. If an object created via a scripting language is not passed to a constructor, and a different value is appropriate, this method should be overridden.
      Specified by:
      domainMinClosed in interface VADomainOps
      Overrides:
      domainMinClosed in class RealValuedFunctionVA
      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
      IllegalStateException - the function was not fully initialized.
    • domainMaxClosed

      public boolean domainMaxClosed(int argIndex) throws IllegalArgumentException, IllegalStateException
      Description copied from class: RealValuedFunctionVA
      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. The implementation will either return true or the result of calling a method named getDomainMaxClosed (with the same arguments as this method) provided by an object created by a scripting language. If an object created via a scripting language is not passed to a constructor, and a different value is appropriate, this method should be overridden.
      Specified by:
      domainMaxClosed in interface VADomainOps
      Overrides:
      domainMaxClosed in class RealValuedFunctionVA
      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
      IllegalStateException - the function was not fully initialized.
    • valueAt

      public double valueAt(double... args) throws IllegalArgumentException, UnsupportedOperationException, IllegalStateException
      Description copied from class: RealValuedFunctionVA
      Call the function.
      Specified by:
      valueAt in interface RealValuedFunctVAOps
      Overrides:
      valueAt in class RealValuedFunctionVA
      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.
      IllegalStateException - the function was not fully initialized.
    • derivAt

      public double derivAt(int i, double... args) throws IllegalArgumentException, UnsupportedOperationException, IllegalStateException
      Description copied from class: RealValuedFunctionVA
      Evaluate the partial derivative $\frac{\partial f}{\partial x_i}$ for a function f(x0,x1, ...).
      Overrides:
      derivAt in class RealValuedFunctionVA
      Parameters:
      i - the index indicating that the partial derivative is computed for the ith argument, numbered from zero
      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.
      IllegalStateException - the function was not fully initialized.
    • secondDerivAt

      public double secondDerivAt(int i, int j, double... args) throws IllegalArgumentException, UnsupportedOperationException, IllegalStateException
      Description copied from class: RealValuedFunctionVA
      Evaluate the partial derivative $\frac{\partial^2 f}{\partial x_i \partial z_j}$ for a function f(x0,x1, ...).
      Overrides:
      secondDerivAt in class RealValuedFunctionVA
      Parameters:
      i - the index indicating that the partial derivative is computed for the ith argument, numbered from 0
      j - the index indicating that the partial derivative is computed for the jth argument, numbered from 0
      args - the function f's arguments
      Returns:
      the value of the partial derivative $\frac{\partial^2 f}{\partial x_i \partial z_j}$ for the given arguments x0, x1, ...
      Throws:
      IllegalArgumentException - the function's arguments were out of range
      UnsupportedOperationException - the operation is not supported.
      IllegalStateException - the function was not fully initialized.