java.lang.Object
org.bzdev.math.VectorValuedFunctionVA
- All Implemented Interfaces:
VADomainOps
- Direct Known Subclasses:
VectorValuedFunction
Vector-valued functions with a variable number of arguments.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int
The dimenion for the vectors that will be returned. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
VectorValuedFunctionVA
(int dim, int minArgLength, int maxArgLength) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionfinal 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.
-
Field Details
-
dim
protected int dimThe 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 defaultmaxArgLength
- 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
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 interfaceVADomainOps
- 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
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 interfaceVADomainOps
- 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
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 interfaceVADomainOps
- 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
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 interfaceVADomainOps
- 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 interfaceVADomainOps
- 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 interfaceVADomainOps
- 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 interfaceVADomainOps
- 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 rangeUnsupportedOperationException
- 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 rangeUnsupportedOperationException
- 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 argumentargs
- 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 rangeUnsupportedOperationException
- 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 argumentarray
- 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 rangeUnsupportedOperationException
- 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 argumentj
- the index indicating that the partial derivative is computed for the jth argumentargs
- 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 rangeUnsupportedOperationException
- 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 argumentj
- the index indicating that the partial derivative is computed for the jth argumentarray
- 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 rangeUnsupportedOperationException
- the operation is not supported.
-