java.lang.Object
org.bzdev.math.VectorValuedFunctionVA
org.bzdev.math.VectorValuedFunction
- All Implemented Interfaces:
RealValuedDomainOps,VADomainOps
- Direct Known Subclasses:
BSplineArray,NurbsArray
public abstract class VectorValuedFunction
extends VectorValuedFunctionVA
implements RealValuedDomainOps
Base class for vector-valued functions with one argument.
The vectors have real components, as does the argument, all of
which are a double-precision number (type "double").
Subclasses must implement the following method:
-
valueAt(double[],int,double). This method is expected to throw an IllegalArgumentException if its arguments are out of range.
If the default behavior (throwing an UnsupportedOperationException) is not appropriate, subclasses should implement one or more of the following methods:
-
derivAt(double[],int,double). This method throws an UnsupportedOperationException by default. -
secondDerivAt(double[],int,double). This method throws an UnsupportedOperationException by default. -
RealValuedDomainOps.getDomainMin(). The default is -Double.MAX_VALUE. -
RealValuedDomainOps.getDomainMax(). The default is Double.MAX_VALUE. -
RealValuedDomainOps.domainMinClosed(). The default is "true". -
RealValuedDomainOps.domainMaxClosed(). The default is "true". -
RealValuedDomainOps.isInDomain(double). The default checks that the argument is within the range specified by the domain minimum and maximum, with the end points included or not depending on whether the end points are closed or open respectively.
-
Field Summary
Fields inherited from class org.bzdev.math.VectorValuedFunctionVA
dim -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal double[]derivAt(double u) Evaluate the function's first derivative.voidderivAt(double[] array, int offset, double u) Evaluate the function's first derivative, storing the results.final voidderivAt(int i, double[] array, int offset, double... args) Evaluate the first partial derivative, storing the results ∂f / ∂xi for a function f(x0,x1, ...).booleanDetermine if the domain maximum is in the domain.booleandomainMaxClosed(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.booleanDetermine if the domain minimum is in the domain.final booleandomainMinClosed(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.doubleGet the maximum value in the domain of the function.final doublegetDomainMax(int argIndex) Get the least upper bound of the ith argument when the arguments are in the domain of the function.doubleGet the minimum value in the domain of the function.final doublegetDomainMin(int argIndex) Get the greatest lower bound of the ith argument when the arguments are in the domain of the function implementing this interface.booleanisInDomain(double x) Determine if an argument is within the domain of a function.booleanisInDomain(double... args) Determine if a sequence of arguments represents arguments that are in the domain of the function implementing this interface.final double[]secondDerivAt(double u) Evaluate the function's second derivative.voidsecondDerivAt(double[] array, int offset, double u) Evaluate the function's second derivative, storing the results.final voidsecondDerivAt(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 u) Call the function.abstract voidvalueAt(double[] array, int offset, double u) Call the function, storing the value in an array.final voidvalueAt(double[] array, int offset, double... args) Call the function, storing the results in an array.Methods inherited from class org.bzdev.math.VectorValuedFunctionVA
derivAt, getDimension, maxArgLength, minArgLength, secondDerivAt, valueAt
-
Constructor Details
-
VectorValuedFunction
protected VectorValuedFunction(int dim) Constructor.- Parameters:
dim- the dimension of the vectors that will be returned by various methods.
-
-
Method Details
-
getDomainMin
Description copied from interface:VADomainOpsGet the greatest lower bound of the ith argument when the arguments are in the domain of the function implementing this interface.- Specified by:
getDomainMinin interfaceVADomainOps- Overrides:
getDomainMinin classVectorValuedFunctionVA- 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:VADomainOpsGet the least upper bound of the ith argument when the arguments are in the domain of the function.- Specified by:
getDomainMaxin interfaceVADomainOps- Overrides:
getDomainMaxin classVectorValuedFunctionVA- 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:VADomainOpsDetermine 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:
domainMinClosedin interfaceVADomainOps- Overrides:
domainMinClosedin classVectorValuedFunctionVA- 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:VADomainOpsDetermine 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:
domainMaxClosedin interfaceVADomainOps- Overrides:
domainMaxClosedin classVectorValuedFunctionVA- 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:VADomainOpsDetermine if a sequence of arguments represents arguments that are in the domain of the function implementing this interface.- Specified by:
isInDomainin interfaceVADomainOps- Overrides:
isInDomainin classVectorValuedFunctionVA- 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
-
getDomainMin
public double getDomainMin()Description copied from interface:RealValuedDomainOpsGet the minimum value in the domain of the function.- Specified by:
getDomainMinin interfaceRealValuedDomainOps- Returns:
- the minimum value
-
getDomainMax
public double getDomainMax()Description copied from interface:RealValuedDomainOpsGet the maximum value in the domain of the function.- Specified by:
getDomainMaxin interfaceRealValuedDomainOps- Returns:
- the maximum value
-
domainMinClosed
public boolean domainMinClosed()Description copied from interface:RealValuedDomainOpsDetermine if the domain minimum is in the domain.- Specified by:
domainMinClosedin interfaceRealValuedDomainOps- Returns:
- true if the domain minimum is in the domain; false if it is the greatest lower bound for the domain
-
domainMaxClosed
public boolean domainMaxClosed()Description copied from interface:RealValuedDomainOpsDetermine if the domain maximum is in the domain.- Specified by:
domainMaxClosedin interfaceRealValuedDomainOps- Returns:
- true if the domain maximum is in the domain; false if it is the least upper bound for the domain
-
isInDomain
Description copied from interface:RealValuedDomainOpsDetermine if an argument is within the domain of a function.- Specified by:
isInDomainin interfaceRealValuedDomainOps- Parameters:
x- a value to test- Returns:
- true if x is in this function's domain; false otherwise
- Throws:
UnsupportedOperationException- domain membership could not be determined.
-
valueAt
public final void valueAt(double[] array, int offset, double... args) throws IllegalArgumentException, UnsupportedOperationException Description copied from class:VectorValuedFunctionVACall the function, storing the results in an array.- Overrides:
valueAtin classVectorValuedFunctionVA- 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 void derivAt(int i, double[] array, int offset, double... args) throws IllegalArgumentException, UnsupportedOperationException Description copied from class:VectorValuedFunctionVAEvaluate the first partial derivative, storing the results ∂f / ∂xi for a function f(x0,x1, ...).- Overrides:
derivAtin classVectorValuedFunctionVA- 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 void secondDerivAt(int i, int j, double[] array, int offset, double... args) throws IllegalArgumentException, UnsupportedOperationException Description copied from class:VectorValuedFunctionVAEvaluate the second partial derivative ∂2f / ∂x1∂x1 for a function f(x1x2), storing the results in an array.- Overrides:
secondDerivAtin classVectorValuedFunctionVA- 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.
-
valueAt
Call the function.- Parameters:
u- the function's argument- Returns:
- the value of the function for the given argument
- Throws:
IllegalArgumentException- the function's argument was out of range
-
valueAt
Call the function, storing the value in an array.- Parameters:
array- the array used to store the results of the function call.offset- the offset into the array at which to store the results of the function call.u- the function's argument- Throws:
IllegalArgumentException- the function's argument was out of range
-
derivAt
public final double[] derivAt(double u) throws IllegalArgumentException, UnsupportedOperationException Evaluate the function's first derivative.- Parameters:
u- the function's argument- Returns:
- the value of the function's derivative for the given argument
- Throws:
IllegalArgumentException- the function's argument was out of rangeUnsupportedOperationException- the operation is not supported.
-
derivAt
public void derivAt(double[] array, int offset, double u) throws IllegalArgumentException, UnsupportedOperationException Evaluate the function's first derivative, storing the results.- Parameters:
array- the array used to store the results.offset- the offset into the array at which to store the results.u- the function's argument- Throws:
IllegalArgumentException- the function's argument was out of rangeUnsupportedOperationException- the operation is not supported.
-
secondDerivAt
public final double[] secondDerivAt(double u) throws IllegalArgumentException, UnsupportedOperationException Evaluate the function's second derivative.- Parameters:
u- the function's argument- Returns:
- the value of the function's second derivative for the given argument
- Throws:
IllegalArgumentException- the function's argument was out of rangeUnsupportedOperationException- the operation is not supported.
-
secondDerivAt
public void secondDerivAt(double[] array, int offset, double u) throws IllegalArgumentException, UnsupportedOperationException Evaluate the function's second derivative, storing the results.- Parameters:
array- the array used to store the results.offset- the offset into the array at which to store the results.u- the function's argument- Throws:
IllegalArgumentException- the function's argument was out of rangeUnsupportedOperationException- the operation is not supported.
-