gov.sandia.cognition.learning.function.vector
Class ElementWiseVectorFunction

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.learning.function.vector.ElementWiseVectorFunction
All Implemented Interfaces:
Evaluator<Vector,Vector>, VectorFunction, CloneableSerializable, Serializable, Cloneable
Direct Known Subclasses:
ElementWiseDifferentiableVectorFunction

public class ElementWiseVectorFunction
extends AbstractCloneableSerializable
implements VectorFunction

A VectorFunction that operates on each element of the Vector indepenently of all others.

Since:
2.0
Author:
Kevin R. Dixon
See Also:
Serialized Form

Constructor Summary
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
 
Method Summary
 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
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ElementWiseVectorFunction

public ElementWiseVectorFunction()
Creates a new ElementWiseVectorFunction with a default linear scalar function.


ElementWiseVectorFunction

public ElementWiseVectorFunction(UnivariateScalarFunction scalarFunction)
Creates a new instance of ElementWiseVectorFunction

Parameters:
scalarFunction - Underlying scalar function to apply to each Vector element

ElementWiseVectorFunction

public ElementWiseVectorFunction(ElementWiseVectorFunction other)
Copy Constructor

Parameters:
other - ElementWiseVectorFunction to copy
Method Detail

clone

public ElementWiseVectorFunction clone()
Description copied from class: AbstractCloneableSerializable
This makes public the clone method on the 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.

Specified by:
clone in interface CloneableSerializable
Overrides:
clone in class AbstractCloneableSerializable
Returns:
A clone of this object.

getScalarFunction

public UnivariateScalarFunction getScalarFunction()
Getter for scalarFunction

Returns:
Underlying scalar function to apply to each Vector element

setScalarFunction

public void setScalarFunction(UnivariateScalarFunction scalarFunction)
Setter for scalarFunction

Parameters:
scalarFunction - Underlying scalar function to apply to each Vector element

evaluate

public 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

Specified by:
evaluate in interface Evaluator<Vector,Vector>
Parameters:
input - Input Vector to consider
Returns:
Vector of identical dimension as input, having scalarFunction applied to each element of the input

evaluate

public 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

Parameters:
input - Input Vector to consider
function - Scalar function to apply to each element
Returns:
Vector of identical dimension as input, having scalarFunction applied to each element of the input