1 /* 2 * Licensed to the Hipparchus project under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The Hipparchus project licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * https://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 package org.hipparchus.filtering.kalman; 19 20 import org.hipparchus.linear.RealMatrix; 21 import org.hipparchus.linear.RealVector; 22 23 /** 24 * Holder for process state and covariance. 25 * <p> 26 * The estimate always contains time, state and covariance. These data are 27 * the only ones needed to start a Kalman filter. Once a filter has been 28 * started and produces new estimates, these new estimates will always 29 * contain a state transition matrix and if the measurement has not been 30 * ignored, they will also contain measurement Jacobian, innovation covariance 31 * and Kalman gain. 32 * </p> 33 * @since 1.3 34 */ 35 public class ProcessEstimate { 36 37 /** Process time (typically the time or index of a measurement). */ 38 private final double time; 39 40 /** State vector. */ 41 private final RealVector state; 42 43 /** State covariance. */ 44 private final RealMatrix covariance; 45 46 /** State transition matrix, may be null. 47 * @since 1.4 48 */ 49 private final RealMatrix stateTransitionMatrix; 50 51 /** Jacobian of the measurement with respect to the state (h matrix), may be null. 52 * @since 1.4 53 */ 54 private final RealMatrix measurementJacobian; 55 56 /** Innovation covariance matrix, defined as \(h.P.h^T + r\), may be null. 57 * @since 1.4 58 */ 59 private final RealMatrix innovationCovarianceMatrix; 60 61 /** Kalman gain (k matrix), may be null. 62 * @since 1.4 63 */ 64 private final RealMatrix kalmanGain; 65 66 /** Simple constructor. 67 * <p> 68 * This constructor sets state transition matrix, covariance matrix H, 69 * innovation covariance matrix and Kalman gain k to null. 70 * </p> 71 * @param time process time (typically the time or index of a measurement) 72 * @param state state vector 73 * @param covariance state covariance 74 */ 75 public ProcessEstimate(final double time, final RealVector state, final RealMatrix covariance) { 76 this(time, state, covariance, null, null, null, null); 77 } 78 79 /** Simple constructor. 80 * @param time process time (typically the time or index of a measurement) 81 * @param state state vector 82 * @param covariance state covariance 83 * @param stateTransitionMatrix state transition matrix between previous state and estimated (but not yet corrected) state 84 * @param measurementJacobian Jacobian of the measurement with respect to the state 85 * @param innovationCovariance innovation covariance matrix, defined as \(h.P.h^T + r\), may be null 86 * @param kalmanGain Kalman Gain matrix, may be null 87 * @since 1.4 88 */ 89 public ProcessEstimate(final double time, final RealVector state, final RealMatrix covariance, 90 final RealMatrix stateTransitionMatrix, final RealMatrix measurementJacobian, 91 final RealMatrix innovationCovariance, final RealMatrix kalmanGain) { 92 this.time = time; 93 this.state = state; 94 this.covariance = covariance; 95 this.stateTransitionMatrix = stateTransitionMatrix; 96 this.measurementJacobian = measurementJacobian; 97 this.innovationCovarianceMatrix = innovationCovariance; 98 this.kalmanGain = kalmanGain; 99 } 100 101 /** Get the process time. 102 * @return process time (typically the time or index of a measurement) 103 */ 104 public double getTime() { 105 return time; 106 } 107 108 /** Get the state vector. 109 * @return state vector 110 */ 111 public RealVector getState() { 112 return state; 113 } 114 115 /** Get the state covariance. 116 * @return state covariance 117 */ 118 public RealMatrix getCovariance() { 119 return covariance; 120 } 121 122 /** Get state transition matrix between previous state and estimated (but not yet corrected) state. 123 * @return state transition matrix between previous state and estimated state (but not yet corrected) 124 * (may be null for initial process estimate) 125 * @since 1.4 126 */ 127 public RealMatrix getStateTransitionMatrix() { 128 return stateTransitionMatrix; 129 } 130 131 /** Get the Jacobian of the measurement with respect to the state (H matrix). 132 * @return Jacobian of the measurement with respect to the state (may be null for initial 133 * process estimate or if the measurement has been ignored) 134 * @since 1.4 135 */ 136 public RealMatrix getMeasurementJacobian() { 137 return measurementJacobian; 138 } 139 140 /** Get the innovation covariance matrix. 141 * @return innovation covariance matrix (may be null for initial 142 * process estimate or if the measurement has been ignored) 143 * @since 1.4 144 */ 145 public RealMatrix getInnovationCovariance() { 146 return innovationCovarianceMatrix; 147 } 148 149 /** Get the Kalman gain matrix. 150 * @return Kalman gain matrix (may be null for initial 151 * process estimate or if the measurement has been ignored) 152 * @since 1.4 153 */ 154 public RealMatrix getKalmanGain() { 155 return kalmanGain; 156 } 157 158 }