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.void
derivAt
(double[] array, int offset, double u) Evaluate the function's first derivative, storing the results.final 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
Determine if the domain maximum is in the domain.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
Determine if the domain minimum is in the domain.final 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.double
Get the maximum value in the domain of the function.final double
getDomainMax
(int argIndex) Get the least upper bound of the ith argument when the arguments are in the domain of the function.double
Get the minimum value in the domain of the function.final 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 x) Determine if an argument is within the domain of a function.boolean
isInDomain
(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.void
secondDerivAt
(double[] array, int offset, double u) Evaluate the function's second derivative, storing the results.final 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 u) Call the function.abstract void
valueAt
(double[] array, int offset, double u) Call the function, storing the value in an array.final void
valueAt
(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: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
- Overrides:
getDomainMin
in 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: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
- Overrides:
getDomainMax
in 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: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
- Overrides:
domainMinClosed
in 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: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
- Overrides:
domainMaxClosed
in 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: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
- Overrides:
isInDomain
in 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:RealValuedDomainOps
Get the minimum value in the domain of the function.- Specified by:
getDomainMin
in interfaceRealValuedDomainOps
- Returns:
- the minimum value
-
getDomainMax
public double getDomainMax()Description copied from interface:RealValuedDomainOps
Get the maximum value in the domain of the function.- Specified by:
getDomainMax
in interfaceRealValuedDomainOps
- Returns:
- the maximum value
-
domainMinClosed
public boolean domainMinClosed()Description copied from interface:RealValuedDomainOps
Determine if the domain minimum is in the domain.- Specified by:
domainMinClosed
in 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:RealValuedDomainOps
Determine if the domain maximum is in the domain.- Specified by:
domainMaxClosed
in 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:RealValuedDomainOps
Determine if an argument is within the domain of a function.- Specified by:
isInDomain
in 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:VectorValuedFunctionVA
Call the function, storing the results in an array.- Overrides:
valueAt
in 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:VectorValuedFunctionVA
Evaluate the first partial derivative, storing the results ∂f / ∂xi for a function f(x0,x1, ...).- Overrides:
derivAt
in 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:VectorValuedFunctionVA
Evaluate the second partial derivative ∂2f / ∂x1∂x1 for a function f(x1x2), storing the results in an array.- Overrides:
secondDerivAt
in 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.
-