Added since tag for filter package, minor javadoc fixes.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1242174 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ddc27b4a15
commit
6a63df5151
|
@ -23,6 +23,7 @@ import org.apache.commons.math.linear.RealMatrix;
|
||||||
* Default implementation of a {@link MeasurementModel} for the use with a
|
* Default implementation of a {@link MeasurementModel} for the use with a
|
||||||
* {@link KalmanFilter}.
|
* {@link KalmanFilter}.
|
||||||
*
|
*
|
||||||
|
* @since 3.0
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class DefaultMeasurementModel implements MeasurementModel {
|
public class DefaultMeasurementModel implements MeasurementModel {
|
||||||
|
@ -42,10 +43,8 @@ public class DefaultMeasurementModel implements MeasurementModel {
|
||||||
* Create a new {@link MeasurementModel}, taking double arrays as input
|
* Create a new {@link MeasurementModel}, taking double arrays as input
|
||||||
* parameters for the respective measurement matrix and noise.
|
* parameters for the respective measurement matrix and noise.
|
||||||
*
|
*
|
||||||
* @param measMatrix
|
* @param measMatrix the measurement matrix
|
||||||
* the measurement matrix
|
* @param measNoise the measurement noise matrix
|
||||||
* @param measNoise
|
|
||||||
* the measurement noise matrix
|
|
||||||
*/
|
*/
|
||||||
public DefaultMeasurementModel(final double[][] measMatrix,
|
public DefaultMeasurementModel(final double[][] measMatrix,
|
||||||
final double[][] measNoise) {
|
final double[][] measNoise) {
|
||||||
|
@ -57,10 +56,8 @@ public class DefaultMeasurementModel implements MeasurementModel {
|
||||||
* Create a new {@link MeasurementModel}, taking {@link RealMatrix} objects
|
* Create a new {@link MeasurementModel}, taking {@link RealMatrix} objects
|
||||||
* as input parameters for the respective measurement matrix and noise.
|
* as input parameters for the respective measurement matrix and noise.
|
||||||
*
|
*
|
||||||
* @param measMatrix
|
* @param measMatrix the measurement matrix
|
||||||
* the measurement matrix
|
* @param measNoise the measurement noise matrix
|
||||||
* @param measNoise
|
|
||||||
* the measurement noise matrix
|
|
||||||
*/
|
*/
|
||||||
public DefaultMeasurementModel(final RealMatrix measMatrix,
|
public DefaultMeasurementModel(final RealMatrix measMatrix,
|
||||||
final RealMatrix measNoise) {
|
final RealMatrix measNoise) {
|
||||||
|
@ -68,16 +65,12 @@ public class DefaultMeasurementModel implements MeasurementModel {
|
||||||
this.measurementNoise = measNoise;
|
this.measurementNoise = measNoise;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** {@inheritDoc} */
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public RealMatrix getMeasurementMatrix() {
|
public RealMatrix getMeasurementMatrix() {
|
||||||
return measurementMatrix;
|
return measurementMatrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** {@inheritDoc} */
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public RealMatrix getMeasurementNoise() {
|
public RealMatrix getMeasurementNoise() {
|
||||||
return measurementNoise;
|
return measurementNoise;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ import org.apache.commons.math.linear.RealVector;
|
||||||
* Default implementation of a {@link ProcessModel} for the use with a
|
* Default implementation of a {@link ProcessModel} for the use with a
|
||||||
* {@link KalmanFilter}.
|
* {@link KalmanFilter}.
|
||||||
*
|
*
|
||||||
|
* @since 3.0
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class DefaultProcessModel implements ProcessModel {
|
public class DefaultProcessModel implements ProcessModel {
|
||||||
|
@ -40,40 +41,30 @@ public class DefaultProcessModel implements ProcessModel {
|
||||||
*/
|
*/
|
||||||
private RealMatrix controlMatrix;
|
private RealMatrix controlMatrix;
|
||||||
|
|
||||||
/**
|
/** The process noise covariance matrix. */
|
||||||
* The process noise covariance matrix.
|
|
||||||
*/
|
|
||||||
private RealMatrix processNoiseCovMatrix;
|
private RealMatrix processNoiseCovMatrix;
|
||||||
|
|
||||||
/**
|
/** The initial state estimation of the observed process. */
|
||||||
* The initial state estimation of the observed process.
|
|
||||||
*/
|
|
||||||
private RealVector initialStateEstimateVector;
|
private RealVector initialStateEstimateVector;
|
||||||
|
|
||||||
/**
|
/** The initial error covariance matrix of the observed process. */
|
||||||
* The initial error covariance matrix of the observed process.
|
|
||||||
*/
|
|
||||||
private RealMatrix initialErrorCovMatrix;
|
private RealMatrix initialErrorCovMatrix;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new {@link ProcessModel}, taking double arrays as input
|
* Create a new {@link ProcessModel}, taking double arrays as input
|
||||||
* parameters.
|
* parameters.
|
||||||
*
|
*
|
||||||
* @param stateTransition
|
* @param stateTransition the state transition matrix
|
||||||
* the state transition matrix
|
* @param control the control matrix
|
||||||
* @param control
|
* @param processNoise the process noise matrix
|
||||||
* the control matrix
|
* @param initialStateEstimate the initial state estimate vector
|
||||||
* @param processNoise
|
* @param initialErrorCovariance the initial error covariance matrix
|
||||||
* the process noise matrix
|
|
||||||
* @param initialStateEstimate
|
|
||||||
* the initial state estimate vector
|
|
||||||
* @param initialErrorCovariance
|
|
||||||
* the initial error covariance matrix
|
|
||||||
*/
|
*/
|
||||||
public DefaultProcessModel(final double[][] stateTransition,
|
public DefaultProcessModel(final double[][] stateTransition,
|
||||||
final double[][] control, final double[][] processNoise,
|
final double[][] control,
|
||||||
final double[] initialStateEstimate,
|
final double[][] processNoise,
|
||||||
final double[][] initialErrorCovariance) {
|
final double[] initialStateEstimate,
|
||||||
|
final double[][] initialErrorCovariance) {
|
||||||
this(new Array2DRowRealMatrix(stateTransition),
|
this(new Array2DRowRealMatrix(stateTransition),
|
||||||
new Array2DRowRealMatrix(control),
|
new Array2DRowRealMatrix(control),
|
||||||
new Array2DRowRealMatrix(processNoise),
|
new Array2DRowRealMatrix(processNoise),
|
||||||
|
@ -86,15 +77,13 @@ public class DefaultProcessModel implements ProcessModel {
|
||||||
* parameters. The initial state estimate and error covariance are omitted
|
* parameters. The initial state estimate and error covariance are omitted
|
||||||
* and will be initialized by the {@link KalmanFilter} to default values.
|
* and will be initialized by the {@link KalmanFilter} to default values.
|
||||||
*
|
*
|
||||||
* @param stateTransition
|
* @param stateTransition the state transition matrix
|
||||||
* the state transition matrix
|
* @param control the control matrix
|
||||||
* @param control
|
* @param processNoise the process noise matrix
|
||||||
* the control matrix
|
|
||||||
* @param processNoise
|
|
||||||
* the process noise matrix
|
|
||||||
*/
|
*/
|
||||||
public DefaultProcessModel(final double[][] stateTransition,
|
public DefaultProcessModel(final double[][] stateTransition,
|
||||||
final double[][] control, final double[][] processNoise) {
|
final double[][] control,
|
||||||
|
final double[][] processNoise) {
|
||||||
this(new Array2DRowRealMatrix(stateTransition),
|
this(new Array2DRowRealMatrix(stateTransition),
|
||||||
new Array2DRowRealMatrix(control),
|
new Array2DRowRealMatrix(control),
|
||||||
new Array2DRowRealMatrix(processNoise), null, null);
|
new Array2DRowRealMatrix(processNoise), null, null);
|
||||||
|
@ -104,21 +93,17 @@ public class DefaultProcessModel implements ProcessModel {
|
||||||
* Create a new {@link ProcessModel}, taking double arrays as input
|
* Create a new {@link ProcessModel}, taking double arrays as input
|
||||||
* parameters.
|
* parameters.
|
||||||
*
|
*
|
||||||
* @param stateTransition
|
* @param stateTransition the state transition matrix
|
||||||
* the state transition matrix
|
* @param control the control matrix
|
||||||
* @param control
|
* @param processNoise the process noise matrix
|
||||||
* the control matrix
|
* @param initialStateEstimate the initial state estimate vector
|
||||||
* @param processNoise
|
* @param initialErrorCovariance the initial error covariance matrix
|
||||||
* the process noise matrix
|
|
||||||
* @param initialStateEstimate
|
|
||||||
* the initial state estimate vector
|
|
||||||
* @param initialErrorCovariance
|
|
||||||
* the initial error covariance matrix
|
|
||||||
*/
|
*/
|
||||||
public DefaultProcessModel(final RealMatrix stateTransition,
|
public DefaultProcessModel(final RealMatrix stateTransition,
|
||||||
final RealMatrix control, final RealMatrix processNoise,
|
final RealMatrix control,
|
||||||
final RealVector initialStateEstimate,
|
final RealMatrix processNoise,
|
||||||
final RealMatrix initialErrorCovariance) {
|
final RealVector initialStateEstimate,
|
||||||
|
final RealMatrix initialErrorCovariance) {
|
||||||
this.stateTransitionMatrix = stateTransition;
|
this.stateTransitionMatrix = stateTransition;
|
||||||
this.controlMatrix = control;
|
this.controlMatrix = control;
|
||||||
this.processNoiseCovMatrix = processNoise;
|
this.processNoiseCovMatrix = processNoise;
|
||||||
|
@ -126,37 +111,27 @@ public class DefaultProcessModel implements ProcessModel {
|
||||||
this.initialErrorCovMatrix = initialErrorCovariance;
|
this.initialErrorCovMatrix = initialErrorCovariance;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** {@inheritDoc} */
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public RealMatrix getStateTransitionMatrix() {
|
public RealMatrix getStateTransitionMatrix() {
|
||||||
return stateTransitionMatrix;
|
return stateTransitionMatrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** {@inheritDoc} */
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public RealMatrix getControlMatrix() {
|
public RealMatrix getControlMatrix() {
|
||||||
return controlMatrix;
|
return controlMatrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** {@inheritDoc} */
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public RealMatrix getProcessNoise() {
|
public RealMatrix getProcessNoise() {
|
||||||
return processNoiseCovMatrix;
|
return processNoiseCovMatrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** {@inheritDoc} */
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public RealVector getInitialStateEstimate() {
|
public RealVector getInitialStateEstimate() {
|
||||||
return initialStateEstimateVector;
|
return initialStateEstimateVector;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** {@inheritDoc} */
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public RealMatrix getInitialErrorCovariance() {
|
public RealMatrix getInitialErrorCovariance() {
|
||||||
return initialErrorCovMatrix;
|
return initialErrorCovMatrix;
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,6 +78,7 @@ import org.apache.commons.math.util.MathUtils;
|
||||||
* Kalman filter example by Dan Simon</a>
|
* Kalman filter example by Dan Simon</a>
|
||||||
* @see ProcessModel
|
* @see ProcessModel
|
||||||
* @see MeasurementModel
|
* @see MeasurementModel
|
||||||
|
* @since 3.0
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class KalmanFilter {
|
public class KalmanFilter {
|
||||||
|
@ -286,10 +287,9 @@ public class KalmanFilter {
|
||||||
/**
|
/**
|
||||||
* Predict the internal state estimation one time step ahead.
|
* Predict the internal state estimation one time step ahead.
|
||||||
*
|
*
|
||||||
* @param u
|
* @param u the control vector
|
||||||
* the control vector
|
* @throws DimensionMismatchException if the dimension of the control
|
||||||
* @throws DimensionMismatchException
|
* vector does not fit
|
||||||
* if the dimension of the control vector does not fit
|
|
||||||
*/
|
*/
|
||||||
public void predict(final RealVector u) {
|
public void predict(final RealVector u) {
|
||||||
// sanity checks
|
// sanity checks
|
||||||
|
@ -318,12 +318,11 @@ public class KalmanFilter {
|
||||||
/**
|
/**
|
||||||
* Correct the current state estimate with an actual measurement.
|
* Correct the current state estimate with an actual measurement.
|
||||||
*
|
*
|
||||||
* @param z
|
* @param z the measurement vector
|
||||||
* the measurement vector
|
|
||||||
* @throws DimensionMismatchException
|
* @throws DimensionMismatchException
|
||||||
* if the dimension of the measurement vector does not fit
|
* if the dimension of the measurement vector does not fit
|
||||||
* @throws org.apache.commons.math.linear.SingularMatrixException
|
* @throws org.apache.commons.math.linear.SingularMatrixException
|
||||||
* if the covariance matrix could not be inverted
|
* if the covariance matrix could not be inverted
|
||||||
*/
|
*/
|
||||||
public void correct(final double[] z) {
|
public void correct(final double[] z) {
|
||||||
correct(new ArrayRealVector(z));
|
correct(new ArrayRealVector(z));
|
||||||
|
@ -332,12 +331,11 @@ public class KalmanFilter {
|
||||||
/**
|
/**
|
||||||
* Correct the current state estimate with an actual measurement.
|
* Correct the current state estimate with an actual measurement.
|
||||||
*
|
*
|
||||||
* @param z
|
* @param z the measurement vector
|
||||||
* the measurement vector
|
* @throws DimensionMismatchException if the dimension of the
|
||||||
* @throws DimensionMismatchException
|
* measurement vector does not fit
|
||||||
* if the dimension of the measurement vector does not fit
|
|
||||||
* @throws org.apache.commons.math.linear.SingularMatrixException
|
* @throws org.apache.commons.math.linear.SingularMatrixException
|
||||||
* if the covariance matrix could not be inverted
|
* if the covariance matrix could not be inverted
|
||||||
*/
|
*/
|
||||||
public void correct(final RealVector z) {
|
public void correct(final RealVector z) {
|
||||||
// sanity checks
|
// sanity checks
|
||||||
|
|
|
@ -21,6 +21,7 @@ import org.apache.commons.math.linear.RealMatrix;
|
||||||
/**
|
/**
|
||||||
* Defines the measurement model for the use with a {@link KalmanFilter}.
|
* Defines the measurement model for the use with a {@link KalmanFilter}.
|
||||||
*
|
*
|
||||||
|
* @since 3.0
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public interface MeasurementModel {
|
public interface MeasurementModel {
|
||||||
|
|
|
@ -22,6 +22,7 @@ import org.apache.commons.math.linear.RealVector;
|
||||||
/**
|
/**
|
||||||
* Defines the process dynamics model for the use with a {@link KalmanFilter}.
|
* Defines the process dynamics model for the use with a {@link KalmanFilter}.
|
||||||
*
|
*
|
||||||
|
* @since 3.0
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public interface ProcessModel {
|
public interface ProcessModel {
|
||||||
|
|
Loading…
Reference in New Issue