public class ElementWiseVectorFunction extends AbstractCloneableSerializable implements VectorFunction
Constructor and Description |
---|
ElementWiseVectorFunction()
Creates a new
ElementWiseVectorFunction with a default linear
scalar function. |
ElementWiseVectorFunction(ElementWiseVectorFunction other)
Copy Constructor
|
ElementWiseVectorFunction(UnivariateScalarFunction scalarFunction)
Creates a new instance of ElementWiseVectorFunction
|
Modifier and Type | Method and Description |
---|---|
ElementWiseVectorFunction |
clone()
This makes public the clone method on the
Object class and
removes the exception that it throws. |
Vector |
evaluate(Vector input)
Applies the scalar function to each element of the input Vector
independently of all others, returning a Vector of equal dimension as
the input
|
static Vector |
evaluate(Vector input,
UnivariateScalarFunction function)
Applies the scalar function to each element of the input Vector
independently of all others, returning a Vector of equal dimension as
the input
|
UnivariateScalarFunction |
getScalarFunction()
Getter for scalarFunction
|
void |
setScalarFunction(UnivariateScalarFunction scalarFunction)
Setter for scalarFunction
|
public ElementWiseVectorFunction()
ElementWiseVectorFunction
with a default linear
scalar function.public ElementWiseVectorFunction(UnivariateScalarFunction scalarFunction)
scalarFunction
- Underlying scalar function to apply to each Vector elementpublic ElementWiseVectorFunction(ElementWiseVectorFunction other)
other
- ElementWiseVectorFunction to copypublic ElementWiseVectorFunction clone()
AbstractCloneableSerializable
Object
class and
removes the exception that it throws. Its default behavior is to
automatically create a clone of the exact type of object that the
clone is called on and to copy all primitives but to keep all references,
which means it is a shallow copy.
Extensions of this class may want to override this method (but call
super.clone()
to implement a "smart copy". That is, to target
the most common use case for creating a copy of the object. Because of
the default behavior being a shallow copy, extending classes only need
to handle fields that need to have a deeper copy (or those that need to
be reset). Some of the methods in ObjectUtil
may be helpful in
implementing a custom clone method.
Note: The contract of this method is that you must use
super.clone()
as the basis for your implementation.clone
in interface CloneableSerializable
clone
in class AbstractCloneableSerializable
public UnivariateScalarFunction getScalarFunction()
public void setScalarFunction(UnivariateScalarFunction scalarFunction)
scalarFunction
- Underlying scalar function to apply to each Vector elementpublic Vector evaluate(Vector input)
public static Vector evaluate(Vector input, UnivariateScalarFunction function)
input
- Input Vector to considerfunction
- Scalar function to apply to each element