gov.sandia.cognition.math.signals

## Class AutoRegressiveMovingAverageFilter

• All Implemented Interfaces:
Evaluator<java.lang.Double,java.lang.Double>, StatefulEvaluator<java.lang.Double,java.lang.Double,DefaultPair<FiniteCapacityBuffer<java.lang.Double>,FiniteCapacityBuffer<java.lang.Double>>>, Vectorizable, DiscreteTimeFilter<DefaultPair<FiniteCapacityBuffer<java.lang.Double>,FiniteCapacityBuffer<java.lang.Double>>>, CloneableSerializable, java.io.Serializable, java.lang.Cloneable

```@PublicationReference(author="Wikipedia",
title="Infinite impulse response",
type=WebPage,
year=2009,
url="http://en.wikipedia.org/wiki/Infinite_impulse_response")
public class AutoRegressiveMovingAverageFilter
extends AbstractStatefulEvaluator<java.lang.Double,java.lang.Double,DefaultPair<FiniteCapacityBuffer<java.lang.Double>,FiniteCapacityBuffer<java.lang.Double>>>
implements DiscreteTimeFilter<DefaultPair<FiniteCapacityBuffer<java.lang.Double>,FiniteCapacityBuffer<java.lang.Double>>>```
A type of filter using a moving-average calculation. That is, a finite window of inputs are scaled by a (possibly) unique coefficient and then summed together. In other words,
y(n) + a(0)y(n-1) + a(1)y(n-2) + ... + a(p)y(n-p+1)
= b(0)x(n) + b(1)x(n-1) + ... + b(m)x(n-m).
Note that this is slightly different than MATLAB/octave's implementation in that the first autoregressive coefficient (a(0)) scales y(n-1) and not every value.
Since:
3.0
Author:
Kevin R. Dixon
Serialized Form
• ### Constructor Summary

Constructors
Constructor and Description
```AutoRegressiveMovingAverageFilter(double[] autoRegressiveCoefficients, double[] movingAverageCoefficients)```
Creates a new instance of AutoRegressiveMovingAverageFilter
```AutoRegressiveMovingAverageFilter(int numAutoregressiveCoefficients, int numMovingAverageCoefficients)```
Creates a new instance of AutoRegressiveMovingAverageFilter
```AutoRegressiveMovingAverageFilter(Vector autoRegressiveCoefficients, Vector movingAverageCoefficients)```
Creates a new instance of AutoRegressiveMovingAverageFilter
• ### Method Summary

All Methods
Modifier and Type Method and Description
`AutoRegressiveMovingAverageFilter` `clone()`
This makes public the clone method on the `Object` class and removes the exception that it throws.
`void` `convertFromVector(Vector parameters)`
Converts the object from a Vector of parameters.
`Vector` `convertToVector()`
Converts the object to a vector.
`DefaultPair<FiniteCapacityBuffer<java.lang.Double>,FiniteCapacityBuffer<java.lang.Double>>` `createDefaultState()`
Creates a new default state object.
`java.lang.Double` `evaluate(java.lang.Double input)`
Evaluates the object using the given input and current state objects, returning the output.
`Vector` `getAutoRegressiveCoefficients()`
Getter for autoregressiveCoefficients
`Vector` `getMovingAverageCoefficients()`
Setter for movingAverageCoefficients
`int` `getNumAutoRegressiveCoefficients()`
Gets the number of autoregressive coefficients.
`int` `getNumMovingAverageCoefficients()`
Returns the number of coefficients in the moving-average filter.
`void` `setAutoregressiveCoefficients(Vector autoRegressiveCoefficients)`
Setter for autoregressiveCoefficients
`void` `setMovingAverageCoefficients(Vector movingAverageCoefficients)`
Setter for movingAverageCoefficients
• ### Methods inherited from class gov.sandia.cognition.evaluator.AbstractStatefulEvaluator

`evaluate, getState, resetState, setState`
• ### Methods inherited from class java.lang.Object

`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Methods inherited from interface gov.sandia.cognition.evaluator.StatefulEvaluator

`evaluate, getState, resetState, setState`
• ### Constructor Detail

• #### AutoRegressiveMovingAverageFilter

```public AutoRegressiveMovingAverageFilter(int numAutoregressiveCoefficients,
int numMovingAverageCoefficients)```
Creates a new instance of AutoRegressiveMovingAverageFilter
Parameters:
`numAutoregressiveCoefficients` - Number of autoregressive coefficients.
`numMovingAverageCoefficients` - Number of moving-average coefficients.
• #### AutoRegressiveMovingAverageFilter

```public AutoRegressiveMovingAverageFilter(double[] autoRegressiveCoefficients,
double[] movingAverageCoefficients)```
Creates a new instance of AutoRegressiveMovingAverageFilter
Parameters:
`autoRegressiveCoefficients` - Coefficients of the autoregressive filter. Element 0 is applied to the most-recent output, Element 1 is applied to the second-most-recent, and so forth. The dimensionality of the Vector is the order of the filter.
`movingAverageCoefficients` - Coefficients of the moving-average filter. Element 0 is applied to the most-recent input, Element 1 is applied to the second-most-recent, and so forth. The dimensionality of the Vector is the order of the filter.
• #### AutoRegressiveMovingAverageFilter

```public AutoRegressiveMovingAverageFilter(Vector autoRegressiveCoefficients,
Vector movingAverageCoefficients)```
Creates a new instance of AutoRegressiveMovingAverageFilter
Parameters:
`autoRegressiveCoefficients` - Coefficients of the autoregressive filter. Element 0 is applied to the most-recent output, Element 1 is applied to the second-most-recent, and so forth. The dimensionality of the Vector is the order of the filter.
`movingAverageCoefficients` - Coefficients of the moving-average filter. Element 0 is applied to the most-recent input, Element 1 is applied to the second-most-recent, and so forth. The dimensionality of the Vector is the order of the filter.
• ### Method Detail

• #### createDefaultState

`public DefaultPair<FiniteCapacityBuffer<java.lang.Double>,FiniteCapacityBuffer<java.lang.Double>> createDefaultState()`
Description copied from interface: `StatefulEvaluator`
Creates a new default state object.
Specified by:
`createDefaultState` in interface `StatefulEvaluator<java.lang.Double,java.lang.Double,DefaultPair<FiniteCapacityBuffer<java.lang.Double>,FiniteCapacityBuffer<java.lang.Double>>>`
Returns:
A new default state object.
• #### evaluate

`public java.lang.Double evaluate(java.lang.Double input)`
Description copied from interface: `StatefulEvaluator`
Evaluates the object using the given input and current state objects, returning the output. The current state may be modified by side effect.
Specified by:
`evaluate` in interface `Evaluator<java.lang.Double,java.lang.Double>`
Specified by:
`evaluate` in interface `StatefulEvaluator<java.lang.Double,java.lang.Double,DefaultPair<FiniteCapacityBuffer<java.lang.Double>,FiniteCapacityBuffer<java.lang.Double>>>`
Parameters:
`input` - The input to evaluate.
Returns:
output that results from the evaluation, state is modified by side effect
• #### clone

`public AutoRegressiveMovingAverageFilter 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 `Vectorizable`
Specified by:
`clone` in interface `CloneableSerializable`
Overrides:
`clone` in class `AbstractStatefulEvaluator<java.lang.Double,java.lang.Double,DefaultPair<FiniteCapacityBuffer<java.lang.Double>,FiniteCapacityBuffer<java.lang.Double>>>`
Returns:
A clone of this object.
• #### convertToVector

`public Vector convertToVector()`
Description copied from interface: `Vectorizable`
Converts the object to a vector.
Specified by:
`convertToVector` in interface `Vectorizable`
Returns:
The Vector form of the object.
• #### convertFromVector

`public void convertFromVector(Vector parameters)`
Description copied from interface: `Vectorizable`
Converts the object from a Vector of parameters.
Specified by:
`convertFromVector` in interface `Vectorizable`
Parameters:
`parameters` - The parameters to incorporate.
• #### getNumMovingAverageCoefficients

`public int getNumMovingAverageCoefficients()`
Returns the number of coefficients in the moving-average filter.
Returns:
Number of coefficients in the moving-average filter.
• #### getMovingAverageCoefficients

`public Vector getMovingAverageCoefficients()`
Setter for movingAverageCoefficients
Returns:
Coefficients of the moving-average filter. Element 0 is applied to the most-recent input, Element 1 is applied to the second-most-recent, and so forth. The dimensionality of the Vector is the order of the filter.
• #### setMovingAverageCoefficients

`public void setMovingAverageCoefficients(Vector movingAverageCoefficients)`
Setter for movingAverageCoefficients
Parameters:
`movingAverageCoefficients` - Coefficients of the moving-average filter. Element 0 is applied to the most-recent input, Element 1 is applied to the second-most-recent, and so forth. The dimensionality of the Vector is the order of the filter.
• #### getNumAutoRegressiveCoefficients

`public int getNumAutoRegressiveCoefficients()`
Gets the number of autoregressive coefficients.
Returns:
Number of autoregressive coefficients.
• #### getAutoRegressiveCoefficients

`public Vector getAutoRegressiveCoefficients()`
Getter for autoregressiveCoefficients
Returns:
Coefficients of the autoregressive filter. Element 0 is applied to the most-recent output, Element 1 is applied to the second-most-recent, and so forth. The dimensionality of the Vector is the order of the filter.
• #### setAutoregressiveCoefficients

`public void setAutoregressiveCoefficients(Vector autoRegressiveCoefficients)`
Setter for autoregressiveCoefficients
Parameters:
`autoRegressiveCoefficients` - Coefficients of the autoregressive filter. Element 0 is applied to the most-recent output, Element 1 is applied to the second-most-recent, and so forth. The dimensionality of the Vector is the order of the filter.